Skip to content

Commit

Permalink
#55879 Set cap to max 3 levels to expand
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Oct 29, 2018
1 parent b434afd commit a3549d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/vs/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6500,10 +6500,11 @@ declare module 'vscode' {
* In order to not to select, set the option `select` to `false`.
* In order to focus, set the option `focus` to `true`.
* In order to expand the revealed element, set the option `expand` to `true` or `1`. To expand recursively set `expand` to the number of levels to expand.
* **NOTE:** You can recursively expand to maximum only 3 levels.
*
* **NOTE:** [TreeDataProvider](#TreeDataProvider) is required to implement [getParent](#TreeDataProvider.getParent) method to access this API.
*/
reveal(element: T, options?: { select?: boolean, focus?: boolean, expand?: boolean | number }): Thenable<void>;
reveal(element: T, options?: { select?: boolean, focus?: boolean, expand?: boolean | 1 | 2 | 3 }): Thenable<void>;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class MainThreadTreeViews extends Disposable implements MainThreadTreeVie
options = options ? options : { select: false, focus: false };
const select = isUndefinedOrNull(options.select) ? false : options.select;
const focus = isUndefinedOrNull(options.focus) ? false : options.focus;
let expand = isNumber(options.expand) ? options.expand : options.expand === true ? 1 : 0;
let expand = Math.min(isNumber(options.expand) ? options.expand : options.expand === true ? 1 : 0, 3);

if (dataProvider.isEmpty()) {
// Refresh if empty
Expand Down

0 comments on commit a3549d4

Please sign in to comment.