Skip to content

Commit

Permalink
reveal tree on top select
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewNolte committed May 27, 2024
1 parent ca26ddb commit a78d3d1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@
"verilog",
"systemverilog"
],
"isTitleButton": true,
"icon": "$(chip)"
},
{
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -737,4 +743,4 @@
"publisherDisplayName": "AndrewNolte",
"publisherId": "fcf32c99-a624-437b-9f47-9333ea128623"
}
}
}
11 changes: 11 additions & 0 deletions src/ProjectComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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 })
}
}
)

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a78d3d1

Please sign in to comment.