Skip to content

Commit

Permalink
Merge pull request #49970 from Microsoft/sandy081/treeViewApi
Browse files Browse the repository at this point in the history
Add following to TreeView
  • Loading branch information
sandy081 authored May 17, 2018
2 parents 3fbd21a + 5806459 commit fbf1fef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/vs/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5870,6 +5870,21 @@ declare module 'vscode' {
*/
export interface TreeView<T> extends Disposable {

/**
* Event that is fired when an element is expanded
*/
readonly onDidExpandElement: Event<T>;

/**
* Event that is fired when an element is collapsed
*/
readonly onDidCollapseElement: Event<T>;

/**
* Currently selected elements.
*/
readonly selection: ReadonlyArray<T>;

/**
* Reveal an element. By default revealed element is selected.
*
Expand Down
3 changes: 3 additions & 0 deletions src/vs/workbench/api/node/extHostTreeViews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ export class ExtHostTreeViews implements ExtHostTreeViewsShape {
}
const treeView = this.createExtHostTreeViewer(viewId, options.treeDataProvider);
return {
get onDidCollapseElement() { return treeView.onDidCollapseElement; },
get onDidExpandElement() { return treeView.onDidExpandElement; },
get selection() { return treeView.selectedElements; },
reveal: (element: T, options?: { select?: boolean }): Thenable<void> => {
return treeView.reveal(element, options);
},
Expand Down

0 comments on commit fbf1fef

Please sign in to comment.