From 4d3cfdc472b95011e7f61bfa1e1d420e8415d39a Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 8 Mar 2017 16:24:05 +0100 Subject: [PATCH] debug: open deemphesize sources. Also keep track of the same instance of a source object in the map fixes #21941 --- src/vs/workbench/parts/debug/common/debugModel.ts | 10 +++++++--- src/vs/workbench/parts/debug/common/debugSource.ts | 6 +----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/parts/debug/common/debugModel.ts b/src/vs/workbench/parts/debug/common/debugModel.ts index d851bfb9f93..212ba1b34b4 100644 --- a/src/vs/workbench/parts/debug/common/debugModel.ts +++ b/src/vs/workbench/parts/debug/common/debugModel.ts @@ -367,7 +367,7 @@ export class StackFrame implements debug.IStackFrame { } public openInEditor(editorService: IWorkbenchEditorService, preserveFocus?: boolean, sideBySide?: boolean): TPromise { - return this.source.deemphasize ? TPromise.as(true) : editorService.openEditor({ + return editorService.openEditor({ resource: this.source.uri, description: this.source.origin, options: { @@ -448,8 +448,12 @@ export class Thread implements debug.IThread { if (!rsf) { return new StackFrame(this, 0, new Source({ name: UNKNOWN_SOURCE_LABEL }, true), nls.localize('unknownStack', "Unknown stack location"), null, null); } - const source = rsf.source ? new Source(rsf.source, rsf.source.presentationHint === 'deemphasize') : new Source({ name: UNKNOWN_SOURCE_LABEL }, true); - this.process.sources.set(source.uri.toString(), source); + let source = rsf.source ? new Source(rsf.source, rsf.source.presentationHint === 'deemphasize') : new Source({ name: UNKNOWN_SOURCE_LABEL }, true); + if (this.process.sources.has(source.uri.toString())) { + source = this.process.sources.get(source.uri.toString()); + } else { + this.process.sources.set(source.uri.toString(), source); + } return new StackFrame(this, rsf.id, source, rsf.name, rsf.line, rsf.column); }); diff --git a/src/vs/workbench/parts/debug/common/debugSource.ts b/src/vs/workbench/parts/debug/common/debugSource.ts index 1c4bd448942..e52d3cee836 100644 --- a/src/vs/workbench/parts/debug/common/debugSource.ts +++ b/src/vs/workbench/parts/debug/common/debugSource.ts @@ -28,10 +28,6 @@ export class Source { } public get inMemory() { - return Source.isInMemory(this.uri); - } - - public static isInMemory(uri: uri): boolean { - return uri.toString().indexOf(`${DEBUG_SCHEME}:`) === 0; + return this.uri.toString().indexOf(`${DEBUG_SCHEME}:`) === 0; } }