[FEATURE] VS Code extension: add a command to add a file or folder to the chat (like Codex's chatgpt.addFileToThread)

Status Open
Reported on v2.1.283
Maintainer reply None cached
Activity 0 comments · opened Sep 26, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

The Claude Code extension has no command that adds a given file or folder to the chat.

The only context commands it has are claude-vscode.insertAtMention and claude-code.insertAtMentioned. Both work on the current editor selection: they ignore their arguments and read vscode.window.activeTextEditor (checked in anthropic.claude-code 2.1.283). So you can send the lines you have selected, but a file that isn't open, or a folder, can only be added by typing @path or Shift+dragging it into the chat.

The Codex extension (openai.chatgpt) has chatgpt.addFileToThread for this. It takes the vscode.Uri of a file or folder and adds it to the current thread. Because it's a regular command, it can be bound to a key, put in the Explorer context menu, or called by another extension.

Proposed Solution

Add a command, for example claude-vscode.addFileToChat, that takes the vscode.Uri of a file or folder and adds it to the active conversation. The result would be the same @path mention you get today by typing @ or Shift+dragging from the Explorer:

await vscode.commands.executeCommand("claude-vscode.addFileToChat", uri);

When it's run from the Explorer context menu, VS Code passes the clicked URI automatically. When it's run with no argument, it could fall back to the active editor's file.

Alternative Solutions

None that can be put behind a command:

  • Opening the file and calling insertAtMention only works for files, steals focus, and sends a line reference instead of the whole file. It can't work for folders.
  • Writing into the chat input directly isn't possible, because the webview belongs to Claude Code (see also #91030).
  • Typing @path by hand works for users, but it's manual. An extension can't type into Claude's input.

Priority

Medium - Would be very helpful

Feature Category

Developer tools/SDK

Use Case Example

I maintain Add to Agent Context (source). It gives you one set of keybindings and pickers to send context to whichever coding agent you use, Claude Code or Codex.

  1. Select one or more files or folders in the Explorer.
  2. Run "Add to agent context" (a keybinding or context menu entry).
  3. Pick the agent.

For Codex, the extension calls chatgpt.addFileToThread(uri) once per selected item. For Claude Code, the explorer option has to be disabled, because there's no command to call.

Additional Context

I couldn't find out whether the VS Code extension's source is public anywhere. As far as I can tell it isn't in this repo. If it is public, or if you accept outside contributions for it, I'd be happy to help implement this.

View original on GitHub ↗