Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Drag File to Claude Code SessionNew to Visual Studio Code? Get it now.
Drag File to Claude Code Session

Drag File to Claude Code Session

Shawn Li

|
5 installs
| (0) | Free
Drag files from VS Code explorer directly into Claude Code chat — auto-holds Shift for @-mention inserts
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Drag File to Claude Code Session

从 VS Code 文件浏览器拖拽文件到 Claude Code 对话框,自动触发 @-mention 引用插入。

功能

Claude Code 扩展的聊天面板中,需要按住 Shift 拖拽文件,才会显示 "drop to attach as context"。本扩展在 VS Code 内检测到拖拽后自动按下 Shift,鼠标松开时自动释放。

演示

安装

Marketplace

  1. 使用 Ctrl+Shift+X 打开扩展面板。
  2. 搜索 Drag File to Claude Code Session。
  3. 点击 Install。

VSIX

code --install-extension drag-file-to-claude-code-session-1.1.3.vsix

使用

  1. 安装后,状态栏会显示 Drag-Shift。
  2. 从 VS Code Explorer 拖拽文件到 Claude Code 对话框。
  3. 扩展自动按下并释放 Shift。

点击状态栏可以开启或关闭辅助功能。也可在命令面板使用:

命令 说明
Drag-Shift: Toggle 切换开关
Drag-Shift: Enable 开启
Drag-Shift: Disable 关闭

系统要求

系统 支持 依赖
Linux (X11) ✅ Python 3、xprop、libX11、libXtst、libXi
Windows ✅ Python 3;支持 py -3、python或 python3
macOS ❌ 暂不支持
Wayland 无 X11 兼容层 ❌ 暂不支持

扩展指定为 UI 扩展,在 Remote SSH、WSL 和 Dev Container 场景下会尝试在 本地 VS Code 界面一侧运行。

配置

{
  "dragShift.enableOnStartup": true,
  "dragShift.dragThresholdPixels": 8,
  "dragShift.pollIntervalMs": 30,
  "dragShift.dragIdleMs": 2000,
  "dragShift.debug": false
}

配置修改后辅助进程会自动重启,无需重启 VS Code。

已知限制

  • 当前通过系统级鼠标状态识别拖拽,无法完全确认拖动源是 Explorer 文件。
  • 在 VS Code 内拖动选中文本、标签页或其他元素时,也可能短暂触发 Shift。
  • Linux 目前仅支持 X11。

隐私与安全

本扩展在本机轮询鼠标按键/位置状态,并在拖拽时模拟 Shift 键。 它不读取文件内容,不记录键盘输入,不上传或收集任何数据。

开发检查

npm run check

许可证

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft