Skip to content

Commit

Permalink
接入在文件夹中浏览
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Jul 3, 2024
1 parent 88e0a78 commit 34eca35
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/editorTable/treeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>(async resolve => {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 34eca35

Please sign in to comment.