debug: reduce call stack flickering if bottom of call stack did not change

This commit is contained in:
isidor 2019-09-06 16:51:05 +02:00
parent a735b5c9b1
commit 4d2b972e11
2 changed files with 15 additions and 1 deletions

View file

@ -310,6 +310,7 @@ export interface IStackFrame extends ITreeElement {
restart(): Promise<any>;
toString(): string;
openInEditor(editorService: IEditorService, preserveFocus?: boolean, sideBySide?: boolean): Promise<ITextEditor | null>;
equals(other: IStackFrame): boolean;
}
export interface IEnablement extends ITreeElement {

View file

@ -395,6 +395,10 @@ export class StackFrame implements IStackFrame {
return !this.source.available ? Promise.resolve(null) :
this.source.openInEditor(editorService, this.range, preserveFocus, sideBySide, pinned);
}
equals(other: IStackFrame): boolean {
return (this.name === other.name) && (other.thread === this.thread) && (other.source === this.source) && (Range.equalsRange(this.range, other.range));
}
}
export class Thread implements IThread {
@ -901,7 +905,16 @@ export class DebugModel implements IDebugModel {
if (!this.schedulers.has(thread.getId())) {
this.schedulers.set(thread.getId(), new RunOnceScheduler(() => {
thread.fetchCallStack(19).then(() => {
this._onDidChangeCallStack.fire();
const stale = thread.getStaleCallStack();
const current = thread.getCallStack();
let bottomOfCallStackChanged = stale.length !== current.length;
for (let i = 1; i < stale.length && !bottomOfCallStackChanged; i++) {
bottomOfCallStackChanged = !stale[i].equals(current[i]);
}
if (bottomOfCallStackChanged) {
this._onDidChangeCallStack.fire();
}
c();
});
}, 420));