Skip to content

Commit

Permalink
隐藏部分指令
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Apr 2, 2024
1 parent cc9df2d commit a30c73e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
{
"command": "y3-helper.revealInFileExplorer",
"title": "Y3:在系统文件浏览器中打开",
"enablement": "view == y3-helper.editorTableView && viewItem == json"
"enablement": "view == y3-helper.editorTableView"
}
],
"configuration": {
Expand Down
8 changes: 6 additions & 2 deletions src/editorTable/editorTableProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ export class EditorTableDataProvider implements vscode.TreeDataProvider<FileNode
return success;
}
refresh(): void {

// 重新读取language.json以刷新
env.refreshlanguageJson();
this.languageJson = env.languageJson;
this._onDidChangeTreeData.fire(undefined);
}

getParent(element: FileNode): vscode.ProviderResult<FileNode> {
return Promise.resolve(element.parent);
}

getTreeItem(element: FileNode): vscode.TreeItem {
return element;
Expand Down Expand Up @@ -107,6 +108,7 @@ export class EditorTableDataProvider implements vscode.TreeDataProvider<FileNode
}

const fileNode = new FileNode(
element,
label,
stat.isDirectory() ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.None,
stat.isDirectory() ? vscode.Uri.file(filePath) : vscode.Uri.file(filePath),
Expand All @@ -120,6 +122,7 @@ export class EditorTableDataProvider implements vscode.TreeDataProvider<FileNode
if (label in this.englishPathToChinese) {
label = this.englishPathToChinese[label];
const fileNode = new FileNode(
element,
label,
stat.isDirectory() ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.None,
stat.isDirectory() ? vscode.Uri.file(filePath) : vscode.Uri.file(filePath),
Expand All @@ -140,6 +143,7 @@ export class EditorTableDataProvider implements vscode.TreeDataProvider<FileNode

export class FileNode extends vscode.TreeItem {
constructor(
public readonly parent:FileNode|undefined,
public readonly label: string,
public readonly collapsibleState: vscode.TreeItemCollapsibleState,
public readonly resourceUri: vscode.Uri,
Expand Down
5 changes: 3 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,15 +531,16 @@ class Helper {
* EditorTableTreeView相关的命令注册
*/
private registerEditorTableView() {
const editorTableDataProvider=new EditorTableDataProvider();
const editorTableDataProvider = new EditorTableDataProvider();

vscode.window.registerTreeDataProvider(
'y3-helper.editorTableView',
editorTableDataProvider
);

vscode.commands.registerCommand('y3-helper.refreshTableViewer', () => {
editorTableDataProvider.refresh();
});


vscode.commands.registerCommand('y3-helper.editorTableView.refresh', () => editorTableDataProvider.refresh());

Expand Down

0 comments on commit a30c73e

Please sign in to comment.