Selections and file references in VS Code

Working in VS Code, you can bring what you are looking at into a message: the file open in the editor, the lines you select, and files you drag in. This page covers how that context appears in the message box and what Oda receives. The panel itself is on The Oda extension for VS Code; for everything else a chat can do, see Chat with Oda.

Add a selection or terminal output

Send the lines you have selected in the editor to the chat with Add Selection to Chat, and a terminal command's output with Add Terminal Output to Chat. The commands, and the messages they can show, are on Extension commands and keybindings.

What you send lands in the message box:

The editor context chip

The message box carries a chip for the editor context that will ride with your message: the file open in VS Code, or your selection.

File reference chips

A selection you send, or a file you drag in, becomes a reference chip: it shows the file, and its lines when it points at a range of lines, for example a.ts:3-9. In the message itself, the reference reaches Oda as a mention:

Copy, paste and drag

Questions, answered

What is the chip in the message box?

It is the editor context chip: it shows the file open in VS Code, or your selection, and that context rides with your message. Click the chip to leave it out, and click it again to send it. The chip hides while VS Code shows no file.

Why is the editor context chip crossed out?

The editor context is turned off, so it does not ride with your message. Click the chip to send it again; the crossed-out label and the slashed eye icon clear.

How much of my selection does Oda receive?

The lines you selected, up to about 20,000 characters. From a longer selection, only about the first 20,000 characters are sent, and the rest is left out.

Where does a selection I send from VS Code appear?

In the message box, at the caret you left, as one insert: one undo removes it whole, your other chips stay, and it lands once, in the chat it was sent to.

Why did a selection I sent arrive as plain text?

The file's path could not be written as a mention, so the path itself was inserted as plain text. A selection from an unsaved file is inserted as a code block, because there is no saved file for a chip to point at. Mention files, folders and chats covers mentions.

What does @src/a.ts (lines 10-20) mean?

It is how a reference reaches Oda in your message: the file and the range of lines it points at. A single line is written @src/a.ts (line 7), and a path with spaces is quoted, as in @"a b.ts".

Why does a reference use a relative path?

A file inside the chat's folder is written relative to that folder, with forward slashes, and letter case is ignored on Windows. A file outside the folder keeps its full path.

What happens when I click a file chip?

It opens the file at its line in VS Code.

Can I drag files from VS Code into a message?

Yes. Drag files from VS Code's Explorer, or drag an editor tab, onto the message box: they are added as file chips, and the same file is not added twice.

Where does terminal output I add land?

In the message box, at the caret you left, like a selection. The picker that sends terminal output, and what it keeps, are on Extension commands and keybindings.

Does a pasted selection become a file chip?

It can. A copied selection from a VS Code editor pastes as a file chip with the file and its lines, or as its text. A copy made with no selection, or with several cursors, pastes as ordinary text.