From 34eca35f53d4fc141777752c1a2af443455c6292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 3 Jul 2024 15:53:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=85=A5=E5=9C=A8=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9=E4=B8=AD=E6=B5=8F=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/editorTable/treeView.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/editorTable/treeView.ts b/src/editorTable/treeView.ts index 1406080..4d6f52c 100644 --- a/src/editorTable/treeView.ts +++ b/src/editorTable/treeView.ts @@ -21,6 +21,11 @@ class FileNode extends vscode.TreeItem { if (object) { this.label = `${object.name}(${this.key})`; this.resourceUri = object.uri; + this.command = { + command: 'vscode.open', + title: '打开文件', + arguments: [object.uri], + }; return; } else if (object === undefined) { return new Promise(async resolve => { @@ -126,16 +131,24 @@ class TreeView extends vscode.Disposable { env.onDidChange(() => this.refresh()); + // 刷新按钮 this.disposables.push(vscode.commands.registerCommand('y3-helper.refreshTableViewer', () => this.provider.refresh())); + // 内置的刷新命令 this.disposables.push(vscode.commands.registerCommand('y3-helper.editorTableView.refresh', () => this.provider.refresh())); + // 打开文件 this.disposables.push(vscode.commands.registerCommand('y3-helper.openFile', async (fileNode: FileNode) => { if (!fileNode.resourceUri) { return; } vscode.commands.executeCommand('vscode.open', fileNode.resourceUri); })); + + // 在Windows中浏览 + vscode.commands.registerCommand("y3-helper.revealInFileExplorer", (fileNode: FileNode) => { + vscode.commands.executeCommand('revealFileInOS', fileNode.resourceUri); + }); } async refresh() { @@ -173,11 +186,6 @@ export async function init() { // //editorTableDataProvider.refresh(); // }); - // vscode.commands.registerCommand("y3-helper.revealInFileExplorer", (fileNode: FileNode) => { - // // vscode自带的从系统文件浏览器中打开某一文件的命令 - // vscode.commands.executeCommand('revealFileInOS', fileNode.resourceUri); - // }); - // vscode.commands.registerCommand("y3-helper.copyTableItemUID", (fileNode: FileNode) => { // if (fileNode.uid) { // vscode.env.clipboard.writeText(String(fileNode.uid));