问题: - 点击新建会话按钮时,会在 VS Code 中创建一个新的 webview panel(分屏) - 期望行为是在同一个 panel 内创建新会话,类似 Claude Code 的交互方式 解决方案: 1. 修改 extension.ts 中的 openNewChatTab 命令 - 检查是否已有 webview panel 打开 - 如果有,则在现有 panel 中创建新会话 - 如果没有,才创建新 panel 2. 在 WebViewProvider 中添加 createNewSession 方法 - 通过 agentManager 创建新会话 - 清空当前对话 UI 3. 修改 MessageHandler 中的 openNewChatTab 处理 - 直接调用 handleNewQwenSession 创建新会话 - 不再执行 VS Code 命令创建新 panel 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Qwen Code Companion
The Qwen Code Companion extension seamlessly integrates Qwen Code. This extension is compatible with both VS Code and VS Code forks.
Features
-
Open Editor File Context: Qwen Code gains awareness of the files you have open in your editor, providing it with a richer understanding of your project's structure and content.
-
Selection Context: Qwen Code can easily access your cursor's position and selected text within the editor, giving it valuable context directly from your current work.
-
Native Diffing: Seamlessly view, modify, and accept code changes suggested by Qwen Code directly within the editor.
-
Launch Qwen Code: Quickly start a new Qwen Code session from the Command Palette (Cmd+Shift+P or Ctrl+Shift+P) by running the "Qwen Code: Run" command.
Requirements
To use this extension, you'll need:
- VS Code version 1.101.0 or newer
- Qwen Code (installed separately) running within the VS Code integrated terminal
Development and Debugging
To debug and develop this extension locally:
-
Clone the repository
git clone https://github.com/QwenLM/qwen-code.git cd qwen-code -
Install dependencies
npm install # or if using pnpm pnpm install -
Start debugging
code . # Open the project root in VS Code- Open the
packages/vscode-ide-companion/src/extension.tsfile - Open Debug panel (
Ctrl+Shift+DorCmd+Shift+D) - Select "Launch Companion VS Code Extension" from the debug dropdown
- Press
F5to launch Extension Development Host
- Open the
-
Make changes and reload
- Edit the source code in the original VS Code window
- To see your changes, reload the Extension Development Host window by:
- Pressing
Ctrl+R(Windows/Linux) orCmd+R(macOS) - Or clicking the "Reload" button in the debug toolbar
- Pressing
-
View logs and debug output
- Open the Debug Console in the original VS Code window to see extension logs
- In the Extension Development Host window, open Developer Tools with
Help > Toggle Developer Toolsto see webview logs
Build for Production
To build the extension for distribution:
npm run compile
# or
pnpm run compile
To package the extension as a VSIX file:
npx vsce package
# or
pnpm vsce package
Terms of Service and Privacy Notice
By installing this extension, you agree to the Terms of Service.