1.0.5 标题栏和命令简化,可打开库函数json
This commit is contained in:
44
dist/commands.js
vendored
44
dist/commands.js
vendored
@@ -117,40 +117,24 @@ function registerCommands(context, model, provider, functionExtractor, output) {
|
||||
vscode.window.showErrorMessage(`连接失败: ${error}`);
|
||||
}
|
||||
});
|
||||
// 刷新文件列表
|
||||
const refreshCommand = vscode.commands.registerCommand('squirrel.refreshFiles', async () => {
|
||||
if (!model.getIsConnected()) {
|
||||
vscode.window.showErrorMessage('请先连接到 pvfUtility API');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Notification,
|
||||
title: '正在刷新文件列表...',
|
||||
cancellable: false
|
||||
}, async (progress) => {
|
||||
const success = await model.refresh();
|
||||
if (success) {
|
||||
vscode.window.showInformationMessage('文件列表刷新成功');
|
||||
provider.refresh();
|
||||
}
|
||||
else {
|
||||
vscode.window.showErrorMessage('刷新文件列表失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
vscode.window.showErrorMessage(`刷新失败: ${error}`);
|
||||
}
|
||||
});
|
||||
// 打开文件(单击或双击文件时调用)
|
||||
const openFileCommand = vscode.commands.registerCommand('squirrel.openFile', async (entry) => {
|
||||
await openFile(model, provider, entry);
|
||||
});
|
||||
// 保存文件(通过 VS Code 的保存事件处理,这个命令主要用于显示)
|
||||
const saveFileCommand = vscode.commands.registerCommand('squirrel.saveFile', async () => {
|
||||
vscode.window.showInformationMessage('使用 VS Code 的保存功能或 Ctrl+S 保存文件');
|
||||
// 打开库函数文档文件夹
|
||||
const openApiDocsCommand = vscode.commands.registerCommand('squirrel.openApiDocs', async () => {
|
||||
// 获取扩展路径
|
||||
const extensionPath = vscode.extensions.getExtension('local.squirrel-nut-explorer')?.extensionPath;
|
||||
if (extensionPath) {
|
||||
// 构建api-functions.json文件的URI
|
||||
const apiDocsUri = vscode.Uri.file(extensionPath);
|
||||
// 在资源管理器中打开文件夹
|
||||
await vscode.env.openExternal(apiDocsUri);
|
||||
}
|
||||
else {
|
||||
vscode.window.showErrorMessage('无法找到扩展路径');
|
||||
}
|
||||
});
|
||||
context.subscriptions.push(connectCommand, refreshCommand, openFileCommand, saveFileCommand);
|
||||
context.subscriptions.push(connectCommand, openFileCommand, openApiDocsCommand);
|
||||
}
|
||||
//# sourceMappingURL=commands.js.map
|
||||
Reference in New Issue
Block a user