[BUG] Drag and drop not working in VS Code extension chat panel (works in terminal CLI)
Bug Description
Drag and drop functionality is fully operational in the terminal/CLI mode but completely non-functional in the VS Code extension chat panel. This is a regression introduced around v2.1.6 and remains unresolved as of v2.1.39 (latest tested).
This issue consolidates multiple fragmented reports into a single tracking issue, as the root cause appears to be the same across all of them.
Environment
- Claude Code: v2.1.39
- VS Code: 1.109.2 (Universal)
- Commit: 591199df409fbf59b4b52d5ad4ee0470152a9b31
- Date: 2026-02-10
- Electron: 39.3.0 / Chromium: 142.0.7444.265 / Node.js: 22.21.1
- OS: macOS (Darwin arm64 25.3.0)
- Scope: Affects sidebar view, partially affects tab view
Steps to Reproduce
- Open Claude Code in VS Code extension (sidebar or tab view)
- Drag a file from Finder / VS Code file explorer / desktop into the chat input area
- Observe: the drop event is silently ignored — no file attachment, no path insertion, no visual feedback
Expected Behavior
Files dragged into the chat panel should be attached as context, consistent with the terminal CLI behavior where file paths are inserted into the prompt on drop.
Actual Behavior
The drop action is completely ignored. No error, no visual feedback, no file reference added.
Root Cause Analysis
Based on investigation across related issues, the likely root cause is:
- Missing or broken
dropevent handlers in the VS Code webview: The extension's chat panel runs inside a VS Code webview. Webviews require explicitdrop/dragoverevent listeners andevent.preventDefault()ondragoverto enable drop. If these were removed or broken during the v2.1.6 refactor, drops would be silently ignored — which is exactly the observed behavior.
- Layout-dependent behavior (#18037): Drop works in tab view but not sidebar view, suggesting the webview's drop zone dimensions or event propagation differ between layouts. This points to a CSS/DOM issue where the drop target element doesn't cover the full input area in sidebar mode.
- VS Code API limitation: VS Code's
WebviewView(sidebar) has different capabilities thanWebviewPanel(tab). The sidebar webview may have additional restrictions on drag events that need explicit handling viavscode.DataTransfer.
Impact
This is a high-impact workflow regression affecting daily productivity:
- Users must fall back to manual
@mentions or/addcommands - Breaks muscle memory and slows down file-heavy workflows
- Multiple users in related issues report considering alternatives to Claude Code
Related Issues (Consolidation)
This issue consolidates the following fragmented reports — all appear to share the same root cause:
| Issue | Description | Reactions |
|-------|-------------|-----------|
| #18037 | Shift+drag file to chat not working in VS Code UI (works in CLI) | 7 👍 |
| #17906 | Drag-and-drop from file explorer not working in Cursor (regression since v2.1.6) | 8 👍 |
| #21044 | Drag & drop attachment does nothing in Remote-SSH (Windows → Debian) | Open |
| #17897 | Cowork sidebar: items appear draggable but drop into Chat does nothing | Open |
| #16221 | Drag and drop file/image affects all Claude Code tabs in window | Open |
| #17703 | Add drag and drop file upload to Document Upload dialog | Open |
| #16532 | /add-dir doesn't handle backslash-escaped spaces from terminal drag-and-drop | Open |
| #21863 | Drag and drop file path insertion broken in v2.1.25 (Kitty terminal) | Open |
Workarounds
- Tab view: Open extension as a tab instead of sidebar (partial fix per #18037)
- @ mentions: Use
@filenameto reference files in chat /addcommand: Use/add <path>to manually add files to context- Downgrade: Roll back to v2.1.5 where drag & drop reportedly worked
28 Comments
Adding a +1 in the hope this gets fixed asap
Absolutely needed. +1
I dont want to pay 200$ for DX like this. Cursor has this from day 0, why you just cant vibe code this as all other CC parts?
Any update on this issue?
+1.
+1 it is strange not having such basic feature this late into the game
+1
Other solution : i use Claude in IDE "BLACKBOX AI" it's working with this
any update?
Why the hell this bug even happened!
+1 please fix
+1 — repro on macOS, drag-drop in the sidebar is unreliable: sometimes no overlay appears, sometimes the overlay appears but drop does nothing.
Specific use case: working with Office files (
.xlsx/.docx/.pptx) referenced in chat via a custom MCP extractor. Path-typing workaround works, but sidebar drag-drop is the natural UX.Note: Anthropic's recently-released Claude for Excel / Word / PowerPoint add-ins are a separate product and do not address this — they put Claude inside Office apps rather than letting Office files into Claude Code.
Totally this is the most frustrating part of moving from cursor, really miss that
Please fix
Drag the file, press SHIFT before drop - works.
Nope
Watch
https://github.com/user-attachments/assets/960e8272-0ec7-44bd-9f4b-492b5d28f585
@vishnyo what VS Code version and OS is it?
<img width="1716" height="1012" alt="Image" src="https://github.com/user-attachments/assets/479d33fa-bc11-4014-8c5e-a3771a5d425c" />
<img width="354" height="482" alt="Image" src="https://github.com/user-attachments/assets/2d2a8171-d910-4f30-a9dd-8c7066a94ee1" />
<img width="724" height="1148" alt="Image" src="https://github.com/user-attachments/assets/9be10696-6d57-48e0-86cc-eccf4b8b4b09" />
Must only work on MacOS. Because it's 100% not working in Windows / WSL 2. I can see the chat interface reacting to the SHIFT + DRAG UX, but on drop no files are added to the chat interface. RIP.
I confirmed that on Mac, file paths can be pasted by drag & drop.
It works from both the sidebar and the tabs.
There is a trick to it:
https://github.com/user-attachments/assets/49765c68-6d32-40be-a13c-e4564a36443e
I've found that the drag-and-drop feature specifically doesn't work when using the Remote SSH extension, and working with a codebase which is on the remote machine.
So if I am using a codebase which is on the remote machine, drag-and-drop doesn't work. I have to manually
@to add context.If I'm using a codebase which is local, drag-and-drop works perfectly.
I think I've found the root cause in the extension bundle and verified a fix locally.
Root cause
In the webview bundle (
webview/index.js, v2.1.199), dropped files arrive via the drag'sdataTransferas URI strings under theresourceurlsandcodeeditorstypes. Both branchesfunnel each URI through the same converter function (minified as
uQe):It only accepts
file://URIs and silently returnsnullfor anything else. In a Remote SSHwindow, resources dragged from the VS Code explorer carry
vscode-remote://ssh-remote+<host>/pathURIs, not
file://URIs — so every drop is discarded with no error and no visual feedback,which matches the reported behavior exactly. Local workspaces produce
file://URIs, which iswhy drag-and-drop works there.
This likely explains at least #21044 (Remote-SSH) among the issues consolidated here.
Note that
@mentions are unaffected because they resolve through the extension host (runningon the remote), which reads files via the VS Code API directly — the drop path is the only place
where resource URIs cross into the webview as strings.
Verified fix
I patched the installed bundle on my remote machine
(
~/.vscode-server/extensions/anthropic.claude-code-2.1.199-linux-x64/webview/index.js) to stripthe
vscode-remote://<authority>prefix and fall through to the existingfile://logic:After Developer: Reload Window, drag-and-drop from the explorer into the chat works over
Remote SSH — the dropped file is added as context, same as in a local workspace. The existing
workspace-root relativization and URL-decoding continue to apply since the converted URI reuses
the original code path. In the real source this is probably better expressed by parsing with
vscode.Uriand accepting thevscode-remotescheme rather than string-prefix matching.Environment: Claude Code extension 2.1.199 (linux-x64 remote), Remote-SSH 0.124.0,
VS Code 1.126.0 on macOS (arm64) → Ubuntu remote.
I developed a vscode extension plugin [Drag File to Claude Code Session], which is currently available for testing.
Installation Method 1: Install from VS Code Marketplace. Press Ctrl+Shift+X to open the extension panel, search for "Drag File to Claude Code Session", and click Install.
**Another root cause, affecting local (non-remote) drops: the handler reads
dataTransferpath data after anawait, when the drag data store is already cleared**This is independent of the Remote-SSH
vscode-remote://scheme issue reported above — both discard drops silently.In
webview/index.js, the chat drop handler processes attachments first and only then reads the path data used for@pathmention insertion (minified names from 2.1.185; 2.1.207 from the marketplace is structurally identical):Per the HTML drag-and-drop spec, the drag data store is only readable synchronously during drop event dispatch. Once the handler yields at
await bR(De),dataTransfer.itemsis empty andgetData()returns"". So whenever a drag carries file content (.filesnon-empty), the@pathinsertion branch (OTt, which reads theresourceurls/codeeditorsstring items) is guaranteed to run against an empty item list and silently does nothing.Observable symptoms this explains:
.zip): "Unsupported file type" toast, and no@pathis ever inserted even though the drag carried the path..filesis empty (plain DOM drags on some platforms) skip theawait, reachitemssynchronously, and work — which is why behavior looks inconsistent across platforms/drag sources in this thread.Fix: snapshot the string data synchronously at the top of the handler — e.g.
const ru = $.dataTransfer.getData("resourceurls"), ce = $.dataTransfer.getData("codeeditors")(orgetAsStringcallbacks registered before anyawait) — then process attachments.Verified fix: I patched my installed bundle to snapshot
resourceurls/codeeditorsviagetData()before theawaitand insert the mentions from the snapshot; after Reload Window, Shift+drag from the Explorer sidebar now inserts@pathcorrectly, including for.zipfiles that previously only produced the error toast.Environment: anthropic.claude-code 2.1.185 (running in Cursor, macOS arm64); same handler code confirmed present in the 2.1.207 VSIX from the marketplace.
In my windows i have noticed drag drop fails when connected to a remote ssh, but not when i use it locally.
EVEN THE DRAG DROP EXTENSION BY @shawnli1024 dosent seem to work in remote sshs
Could you check the Output panel in VS Code? Open it with Ctrl+Shift+U, then select "Drag File to Claude Code" from the dropdown at the top-right. Look for a line like [DragCC] Starting ... with python. — this tells us which helper script is being used. If you see [DragCC] Unsupported environment or No X11 DISPLAY is available, it means the extension is running on the remote Linux side instead of your local Windows machine.
<img width="855" height="138" alt="Image" src="https://github.com/user-attachments/assets/d0efe3df-f954-42ea-bf9b-82dfcd1b3863" />
I can't get the reason by the message of image. Then there 2 ways , 1-you can fix this bug by yourself and the repo is https://github.com/shawnli1024/drag_file_to_claude_code_session; 2-Just wait, I need to set up the environment and reproduce this bug. Angway, I hope you can chosse 1 and contribute your strength for this tool.