提交 8e740979 编写于 作者: I isidor

variables view: Expand the first scope if it is not expensive and if there is...

variables view: Expand the first scope if it is not expensive and if there is no expansion state (all are collapsed)
上级 9ed74f37
...@@ -28,6 +28,7 @@ import { Emitter } from 'vs/base/common/event'; ...@@ -28,6 +28,7 @@ import { Emitter } from 'vs/base/common/event';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { WorkbenchAsyncDataTree, IListService } from 'vs/platform/list/browser/listService'; import { WorkbenchAsyncDataTree, IListService } from 'vs/platform/list/browser/listService';
import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IThemeService } from 'vs/platform/theme/common/themeService';
import { onUnexpectedError } from 'vs/base/common/errors';
const $ = dom.$; const $ = dom.$;
...@@ -58,7 +59,17 @@ export class VariablesView extends ViewletPanel { ...@@ -58,7 +59,17 @@ export class VariablesView extends ViewletPanel {
// Use scheduler to prevent unnecessary flashing // Use scheduler to prevent unnecessary flashing
this.onFocusStackFrameScheduler = new RunOnceScheduler(() => { this.onFocusStackFrameScheduler = new RunOnceScheduler(() => {
this.needsRefresh = false; this.needsRefresh = false;
this.tree.refresh(null); this.tree.refresh(null).then(() => {
const stackFrame = this.debugService.getViewModel().focusedStackFrame;
if (stackFrame) {
stackFrame.getScopes().then(scopes => {
// Expand the first scope if it is not expensive and if there is no expansion state (all are collapsed)
if (scopes.every(s => this.tree.getNode(s).collapsed) && scopes.length > 0 && !scopes[0].expensive) {
this.tree.expand(scopes[0]).then(undefined, onUnexpectedError);
}
});
}
}, onUnexpectedError);
}, 400); }, 400);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册