feat: 添加上下文项点击功能

- 文件类型可点击打开文件
   - 代码片段可点击打开文件并选中对应代码
   - 文件夹类型不可点击
This commit is contained in:
Roe-xin
2026-03-06 10:13:27 +08:00
parent 4384ee53c5
commit 45934baf0a
2 changed files with 52 additions and 3 deletions

View File

@ -494,6 +494,27 @@ export async function showICHelperPanel(
// 退出登录
vscode.commands.executeCommand("ic-coder.logout");
break;
case "openFile":
// 打开文件
if (message.filePath) {
vscode.workspace.openTextDocument(message.filePath).then(doc => {
vscode.window.showTextDocument(doc);
});
}
break;
case "openFileWithSelection":
// 打开文件并选中代码
if (message.filePath) {
vscode.workspace.openTextDocument(message.filePath).then(doc => {
vscode.window.showTextDocument(doc).then(editor => {
const start = new vscode.Position(message.startLine - 1, 0);
const end = new vscode.Position(message.endLine - 1, doc.lineAt(message.endLine - 1).text.length);
editor.selection = new vscode.Selection(start, end);
editor.revealRange(new vscode.Range(start, end));
});
});
}
break;
case "acceptChange":
// 采纳变更
if (message.changeId) {