Referencing pieces of code in chat

Coming from Windsurf, I’ve noticed a key area for improvement in code referencing. Currently, I cannot paste or reference code snippets directly in the chat while writing a message. As a workaround, I have to slightly edit the code (for example, by removing a semicolon) before I can paste it.

While I can reference line numbers, this becomes cumbersome when I need to refer to several separate pieces of code. The position of the reference in the chat is critical for the model’s understanding.

Hi @Fredrik1 and welcome to Cursor Forum :slight_smile:

You can copy any code from editor and paste it in the chat, its referenced as a file with the lines listed.

Or did you mean something different?

It it possible somehow to reference this snipped that cursor embedded into chat while writing prompt?

In the prompt simply say something like: “(lines 7-18 in launch.json)“.