Add files and code to your AI chat

Add code to the DEVUP AI chat from the + menu: the current file, a selection, your open editors or any file in the workspace. Or type @ in the message box and pick a file by its name.

Give the model the code you mean

In the DEVUP AI panel you attach code with the + menu or with @, and each attachment shows as a chip before you send.

The + menu

Attach the file you are editing, the lines you selected, files from your open editors, or any file in the workspace.

@ file search

Type @ in the message box, then a file's name, and choose the match to attach it.

Attachment chips

Everything you attach sits as a chip above the message box, and one click takes it off again.

Context gauge

A small gauge gives a rough idea, before you send, of how much of the model's context this message would take.

Compare

Which way to attach code

The ways to add code to a message, and the situation each one suits
OptionWhat it addsReach for it when
+ → current fileThe file in the editor you are working in.Your question is about the file in front of you.
+ → selectionOnly the lines you have highlighted.One function matters and the rest of the file does not.
+ → open editorsFiles you choose from the editors already open.The pieces of a feature are open side by side.
+ → workspace file, or @Any file in the workspace, found by its name.You know which file it is, but it is not open.

How to add files and code to a chat

  1. Open the DEVUP AI panel from the activity bar.
  2. Click + and pick what to attach: the current file, the selected code, open editors, or a file from the workspace.
  3. Or type @ and a file name, then pick the file from the list.
  4. Check the chips above the message box, and remove any you don't need with one click.
  5. Before sending, look at the gauge: it estimates how much of the model's context your message is going to use.

Walkthrough

How it works in practice: a question that spans several files

Suppose the checkout page of a web shop shows a total that ignores a voucher, and the logic is split between a page, a pricing helper and a formatter.

  1. Open the page component where the wrong total appears, then choose + → current file.
  2. Type @pricing in the message box and pick the pricing helper from the matches.
  3. In the formatter's file, select just the function that rounds the total and add it with + → selection, rather than the whole file.
  4. Look over the chips and click away any that turned out to be unrelated.
  5. Glance at the gauge. If the message takes a large share of the model's context, swap a whole-file chip for a selection.
  6. Ask in Ask mode, for example "Why does the total skip the voucher?". The code your question is about travels with it as attachments.

Use cases

Common ways to use attachments

Explaining an unfamiliar module. You open a file you have never read. Attach it as the current file and ask what it is responsible for and who calls its exports; Ask mode is meant for questions like this.

Reviewing a feature spread over several files. With the route, the service and its test already open, add them in one go from + → open editors, then ask whether they treat empty input the same way.

Keeping a credentials folder out of reach. Your project stores local tokens in a secrets/ folder whose files don't look like .env files. Add secrets/** to devupai.context.neverSend and those files join the built-in protection.

A long investigation. After many back-and-forth messages, the oldest ones may be left out, and the note under the reply tells you. When you move to the next problem, start a new chat; the previous one stays in History.

Long chats and large messages

When a chat grows long, DEVUP AI leaves out the oldest messages if it needs to, and a short note under the reply tells you.

A message that is too large for the model you picked is held back before sending. DEVUP AI explains why and offers a way to switch to another model.

Tips

Tips for attaching code

  • Want the file you are editing attached whenever a chat starts? Turn on devupai.context.attachCurrentFile. It is off by default, so nothing is attached until you add it.
  • devupai.context.searchFollowsGitignore is on by default, which keeps .gitignore entries out of file search.
  • A selection takes less of the model's context than the file around it, and the gauge shows the difference before you send.
  • Repeating the same background in every chat? Put it in project rules once instead of attaching it each time.

Protection

Files that stay protected

  • File search leaves out files that may contain secrets, for example .env files, private keys, certificates and the contents of SSH or Git folders, and none of them can be attached.
  • To protect other files, add your own never-send file patterns with the devupai.context.neverSend setting. Your patterns add to the built-in protection and can't remove any of it.
  • File search also skips what your project excludes, .gitignore entries included.

For the full attachment rules, see which files can be attached in the docs. Once a reply suggests a change, Apply shows it as a diff first.

FAQ

Questions and answers

In the DEVUP AI panel, open the + menu and pick the current file, a selection, any open editors or a workspace file. You can also type @ in the message box and choose a file by name.

Yes. Select the lines in the editor, then choose the selection in the + menu. Only those lines are attached, which also leaves more of the model's context free.

No. A .env file, a private key, a certificate or a file in an SSH or Git folder may hold secrets, so it can't be attached and doesn't show up in file search. Your own never-send patterns can protect more files.

File search leaves out what your project excludes, such as .gitignore entries, and it never lists files that may hold secrets, like .env files and private keys.

Yes. A setting attaches the file in the active editor whenever a chat starts. It is off by default.

Before you send, it shows roughly how much of the selected model's context your message is going to use.

When needed, the oldest messages are left out, and a note under the reply says so. A single message too large for the model is stopped before it is sent, and you see why, with the option to choose a different model.

Start coding with DEVUP Code

Create your DEVUP AI account, then sign in from the editor.