From a78d3d16e40a14f8e08ebcccdeac97d6a9aac727 Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 27 May 2024 15:59:23 -0400 Subject: [PATCH] reveal tree on top select --- package.json | 8 +++++++- src/ProjectComponent.ts | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 80e510b..b71c761 100644 --- a/package.json +++ b/package.json @@ -600,6 +600,7 @@ "verilog", "systemverilog" ], + "isTitleButton": true, "icon": "$(chip)" }, { @@ -658,6 +659,11 @@ ], "menus": { "view/title": [ + { + "command": "verilog.project.setTopLevel", + "when": "view == verilog.project", + "group": "navigation" + }, { "command": "verilog.project.clearTopLevel", "when": "view == verilog.project", @@ -737,4 +743,4 @@ "publisherDisplayName": "AndrewNolte", "publisherId": "fcf32c99-a624-437b-9f47-9333ea128623" } -} +} \ No newline at end of file diff --git a/src/ProjectComponent.ts b/src/ProjectComponent.ts index 29998ed..584ffbc 100644 --- a/src/ProjectComponent.ts +++ b/src/ProjectComponent.ts @@ -101,6 +101,7 @@ export class ProjectComponent extends ViewComponent implements TreeDataProvider< title: 'Verilog: Set Top Level', shortTitle: 'Set Top', languages: ['verilog', 'systemverilog'], + isTitleButton: true, icon: '$(chip)', }, async () => { @@ -111,6 +112,11 @@ export class ProjectComponent extends ViewComponent implements TreeDataProvider< } this.top = await selectModule(doc) this._onDidChangeTreeData.fire() + // show view + if (this.top !== undefined && this.treeView !== undefined) { + // this.treeView.reveal(new RootItem(), { select: true, focus: true }) + this.treeView.reveal(new RootItem(this.top), { select: true, focus: true }) + } } ) @@ -184,6 +190,11 @@ export class ProjectComponent extends ViewComponent implements TreeDataProvider< return await element.getChildren() } + getParent(): ScopeItem | undefined { + // we want to be able to reveal the root item + return undefined + } + async resolveTreeItem( item: TreeItem, element: ScopeItem,