fix(vscode-ide-companion): 修复新建会话按钮,在同一 view column 创建新 tab

问题:
- 之前的实现会复用现有 panel 并清空当前会话
- 期望行为是在同一 view column(不创建分屏)中创建新的 VS Code tab

解决方案:
1. 修改 qwenCode.openNewChatTab 命令
   - 总是创建新的 WebviewProvider 和 WebviewPanel
   - PanelManager 的 findExistingQwenCodeViewColumn() 确保在同一 column 打开
2. 修改 MessageHandler 中的 openNewChatTab 处理
   - 调用 VS Code 命令创建新 panel/tab
3. 移除不再需要的 createNewSession 方法

效果:
- 点击新建会话按钮会在同一 view column 中创建新的 VS Code tab
- 类似 Claude Code 的交互方式
- 不会创建新的分屏

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
yiliang114
2025-11-20 23:14:40 +08:00
parent 95b67bbebd
commit 5a9f5e3432
9 changed files with 73 additions and 47 deletions

View File

@@ -612,15 +612,9 @@ export const App: React.FC = () => {
};
const handleNewQwenSession = () => {
vscode.postMessage({ type: 'newQwenSession', data: {} });
// Send message to open a new chat tab
vscode.postMessage({ type: 'openNewChatTab', data: {} });
setShowSessionSelector(false);
setCurrentSessionId(null);
setCurrentSessionTitle('Past Conversations'); // Reset title to default
// Clear messages in UI
setMessages([]);
setCurrentStreamContent('');
setPlanEntries([]); // Clear plan entries
setToolCalls(new Map()); // Clear tool calls
};
// Time ago formatter (matching Claude Code)
@@ -1053,6 +1047,14 @@ export const App: React.FC = () => {
{getEditModeInfo().icon}
<span>{getEditModeInfo().text}</span>
</button>
{activeFileName && (
<span
className="active-file-indicator"
title={`Showing Qwen Code your current file selection: ${activeFileName}`}
>
{activeFileName}
</span>
)}
<div className="action-divider"></div>
<button
type="button"
@@ -1096,14 +1098,6 @@ export const App: React.FC = () => {
</svg>
</button>
<div className="input-actions-spacer"></div>
{activeFileName && (
<span
className="active-file-indicator"
title={`Showing Qwen Code your current file selection: ${activeFileName}`}
>
{activeFileName}
</span>
)}
<button
type="submit"
className="send-button-icon"