feat: 添加工作区状态检查功能,优化用户体验

- 用户鼠标聚焦到输入框中就弹窗提示用户打开 优化用户体验
This commit is contained in:
Roe-xin
2025-12-30 16:02:36 +08:00
parent 0f458f6299
commit 3f0cc8ae29
4 changed files with 88 additions and 21 deletions

View File

@ -181,6 +181,26 @@ export async function showICHelperPanel(
case "abortDialog":
abortCurrentDialog();
break;
// 新增:检查工作区状态
case "checkWorkspace":
const hasWorkspace = !!(vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0);
if (!hasWorkspace) {
// 弹窗提示用户需要打开工作区
vscode.window.showWarningMessage(
"请先打开一个文件夹作为工作区,这样我就能更好地为您服务了 😊",
"打开文件夹"
).then((selection) => {
if (selection === "打开文件夹") {
vscode.commands.executeCommand("vscode.openFolder");
}
});
}
// 返回工作区状态给前端
panel.webview.postMessage({
command: "workspaceStatus",
hasWorkspace: hasWorkspace
});
break;
}
},
undefined,