diff --git a/packages/vscode-ide-companion/src/extension.ts b/packages/vscode-ide-companion/src/extension.ts index 224613c1..69dd2c09 100644 --- a/packages/vscode-ide-companion/src/extension.ts +++ b/packages/vscode-ide-companion/src/extension.ts @@ -5,7 +5,7 @@ */ import * as vscode from 'vscode'; -import * as path from 'node:path'; +// import * as path from 'node:path'; // TODO: 没有生效 - temporarily disabled due to commented out usage import { IDEServer } from './ide-server.js'; import semver from 'semver'; import { DiffContentProvider, DiffManager } from './diff-manager.js'; @@ -167,44 +167,45 @@ export async function activate(context: vscode.ExtensionContext) { createWebViewProvider, ); + // TODO: 没有生效 // Relay diff accept/cancel events to the chat webview as assistant notices // so the user sees immediate feedback in the chat thread (Claude Code style). - context.subscriptions.push( - diffManager.onDidChange((notification) => { - try { - const method = (notification as { method?: string }).method; - if (method !== 'ide/diffAccepted' && method !== 'ide/diffClosed') { - return; - } + // context.subscriptions.push( + // diffManager.onDidChange((notification) => { + // try { + // const method = (notification as { method?: string }).method; + // if (method !== 'ide/diffAccepted' && method !== 'ide/diffClosed') { + // return; + // } - const params = ( - notification as unknown as { - params?: { filePath?: string }; - } - ).params; - const filePath = params?.filePath ?? ''; - const fileBase = filePath ? path.basename(filePath) : ''; - const text = - method === 'ide/diffAccepted' - ? `Accepted changes${fileBase ? ` to ${fileBase}` : ''}.` - : `Cancelled changes${fileBase ? ` to ${fileBase}` : ''}.`; + // const params = ( + // notification as unknown as { + // params?: { filePath?: string }; + // } + // ).params; + // const filePath = params?.filePath ?? ''; + // const fileBase = filePath ? path.basename(filePath) : ''; + // const text = + // method === 'ide/diffAccepted' + // ? `Accepted changes${fileBase ? ` to ${fileBase}` : ''}.` + // : `Cancelled changes${fileBase ? ` to ${fileBase}` : ''}.`; - for (const provider of webViewProviders) { - const panel = provider.getPanel(); - panel?.webview.postMessage({ - type: 'message', - data: { - role: 'assistant', - content: text, - timestamp: Date.now(), - }, - }); - } - } catch (e) { - console.warn('[Extension] Failed to relay diff event to chat:', e); - } - }), - ); + // for (const provider of webViewProviders) { + // const panel = provider.getPanel(); + // panel?.webview.postMessage({ + // type: 'message', + // data: { + // role: 'assistant', + // content: text, + // timestamp: Date.now(), + // }, + // }); + // } + // } catch (e) { + // console.warn('[Extension] Failed to relay diff event to chat:', e); + // } + // }), + // ); context.subscriptions.push( vscode.workspace.onDidCloseTextDocument((doc) => {