Skip to content

Commit

Permalink
variables: always expand brand new scope on top of list, even if othe…
Browse files Browse the repository at this point in the history
…rs are expanded

#93230
  • Loading branch information
isidorn committed Jun 11, 2020
1 parent 7502656 commit 6f02589
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/vs/workbench/contrib/debug/browser/variablesView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class VariablesView extends ViewPane {
private needsRefresh = false;
private tree!: WorkbenchAsyncDataTree<IStackFrame | null, IExpression | IScope, FuzzyScore>;
private savedViewState = new Map<string, IAsyncDataTreeViewState>();
private autoExpandedScopes = new Set<string>();

constructor(
options: IViewletViewOptions,
Expand Down Expand Up @@ -84,7 +85,8 @@ export class VariablesView extends ViewPane {
// Automatically expand the first scope if it is not expensive and if all scopes are collapsed
const scopes = await stackFrame.getScopes();
const toExpand = scopes.find(s => !s.expensive);
if (toExpand && scopes.every(s => this.tree.isCollapsed(s))) {
if (toExpand && (scopes.every(s => this.tree.isCollapsed(s)) || !this.autoExpandedScopes.has(toExpand.getId()))) {
this.autoExpandedScopes.add(toExpand.getId());
await this.tree.expand(toExpand);
}
}, 400);
Expand Down Expand Up @@ -144,7 +146,10 @@ export class VariablesView extends ViewPane {
this.tree.rerender(e);
}
}));
this._register(this.debugService.onDidEndSession(() => this.savedViewState.clear()));
this._register(this.debugService.onDidEndSession(() => {
this.savedViewState.clear();
this.autoExpandedScopes.clear();
}));
}

getActions(): IAction[] {
Expand Down

0 comments on commit 6f02589

Please sign in to comment.