Skip to content

Commit

Permalink
refresh button in tree view
Browse files Browse the repository at this point in the history
  • Loading branch information
tinahollygb committed Nov 4, 2022
1 parent c32adae commit 607a915
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,19 @@
],
"activationEvents": [
"onView:featuresList",
"onCommand:growthbook.helloWorld",
"onCommand:growthbook.refreshFeatures"
],
"main": "./out/extension.js",
"contributes": {
"menus": {
"view/title": [
{
"command": "growthbook.refreshFeatures",
"when": "true",
"group": "navigation"
}
]
},
"viewsWelcome": [
{
"view": "featuresList",
Expand All @@ -34,7 +42,11 @@
"commands": [
{
"command": "growthbook.refreshFeatures",
"title": "GrowthBook: Refresh Features"
"title": "GrowthBook: Refresh Features",
"icon": {
"light": "resources/ic_refresh.png",
"dark": "resources/ic_refresh.png"
}
},
{
"command": "growthbook.createConfig",
Expand Down
Binary file added resources/ic_refresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/features/FeatureListTreeDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
TreeDataProvider,
TreeItem,
TreeItemCollapsibleState,
EventEmitter,
} from "vscode";
import { FeatureDefinition } from "./types";

Expand All @@ -20,12 +21,19 @@ export class FeatureListTreeDataProvider
private features: FeatureDefinition[]
) {}

private _onDidChangeTreeData: EventEmitter<undefined | null | void> =
new EventEmitter<undefined | null | void>();

onDidChangeTreeData?:
| Event<
void | FeatureListTreeItem | FeatureListTreeItem[] | null | undefined
>
| undefined;

refresh(): void {
this._onDidChangeTreeData.fire();
}

getTreeItem(element: FeatureListTreeItem): TreeItem | Thenable<TreeItem> {
return element;
}
Expand Down

0 comments on commit 607a915

Please sign in to comment.