Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed Jun 18, 2019
1 parent b759cc6 commit d6b3a85
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/vs/workbench/contrib/debug/browser/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import { RunOnceScheduler } from 'vs/base/common/async';
import { FuzzyScore, createMatches } from 'vs/base/common/filters';
import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { VariablesRenderer } from 'vs/workbench/contrib/debug/browser/variablesView';
import { VariablesRenderer, variableSetEmitter } from 'vs/workbench/contrib/debug/browser/variablesView';

const $ = dom.$;

Expand Down Expand Up @@ -274,6 +274,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
revealLastElement(this.tree);
this.history.add(this.replInput.getValue());
this.replInput.setValue('');
variableSetEmitter.fire();
const shouldRelayout = this.replInputHeight > Repl.REPL_INPUT_INITIAL_HEIGHT;
this.replInputHeight = Repl.REPL_INPUT_INITIAL_HEIGHT;
if (shouldRelayout) {
Expand Down
16 changes: 14 additions & 2 deletions src/vs/workbench/contrib/debug/browser/variablesView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { HighlightedLabel, IHighlight } from 'vs/base/browser/ui/highlightedlabe
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';

const $ = dom.$;
let forgetScopes = true;

export const variableSetEmitter = new Emitter<void>();

Expand Down Expand Up @@ -99,7 +100,14 @@ export class VariablesView extends ViewletPanel {
const timeout = sf.explicit ? 0 : undefined;
this.onFocusStackFrameScheduler.schedule(timeout);
}));
this._register(variableSetEmitter.event(() => this.tree.updateChildren()));
this._register(variableSetEmitter.event(() => {
const stackFrame = this.debugService.getViewModel().focusedStackFrame;
if (stackFrame && forgetScopes) {
stackFrame.forgetScopes();
}
forgetScopes = true;
this.tree.updateChildren();
}));
this._register(this.tree.onMouseDblClick(e => this.onMouseDblClick(e)));
this._register(this.tree.onContextMenu(e => this.onContextMenu(e)));

Expand Down Expand Up @@ -256,7 +264,11 @@ export class VariablesRenderer extends AbstractExpressionsRenderer {
if (success && variable.value !== value) {
variable.setVariable(value)
// Need to force watch expressions and variables to update since a variable change can have an effect on both
.then(() => variableSetEmitter.fire());
.then(() => {
// Do not refresh scopes due to a node limitation #15520
forgetScopes = false;
variableSetEmitter.fire();
});
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export class WatchExpressionsRenderer extends AbstractExpressionsRenderer {
onFinish: (value: string, success: boolean) => {
if (success && value) {
this.debugService.renameWatchExpression(expression.getId(), value);
variableSetEmitter.fire();
} else if (!expression.name) {
this.debugService.removeWatchExpressions(expression.getId());
}
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/contrib/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ export interface IStackFrame extends ITreeElement {
getScopes(): Promise<IScope[]>;
getMostSpecificScopes(range: IRange): Promise<ReadonlyArray<IScope>>;
getSpecificSourceName(): string;
forgetScopes(): void;
restart(): Promise<any>;
toString(): string;
openInEditor(editorService: IEditorService, preserveFocus?: boolean, sideBySide?: boolean): Promise<ITextEditor | null>;
Expand Down
10 changes: 6 additions & 4 deletions src/vs/workbench/contrib/debug/common/debugModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export class Scope extends ExpressionContainer implements IScope {

export class StackFrame implements IStackFrame {

private scopes: Promise<Scope[]> | null;
private scopes: Promise<Scope[]> | undefined;

constructor(
public thread: IThread,
Expand All @@ -324,9 +324,7 @@ export class StackFrame implements IStackFrame {
public presentationHint: string | undefined,
public range: IRange,
private index: number
) {
this.scopes = null;
}
) { }

getId(): string {
return `stackframe:${this.thread.getId()}:${this.frameId}:${this.index}`;
Expand Down Expand Up @@ -382,6 +380,10 @@ export class StackFrame implements IStackFrame {
return this.thread.session.restartFrame(this.frameId, this.thread.threadId);
}

forgetScopes(): void {
this.scopes = undefined;
}

toString(): string {
const lineNumberToString = typeof this.range.startLineNumber === 'number' ? `:${this.range.startLineNumber}` : '';
const sourceToString = `${this.source.inMemory ? this.source.name : this.source.uri.fsPath}${lineNumberToString}`;
Expand Down

0 comments on commit d6b3a85

Please sign in to comment.