diff --git a/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts b/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts index f3e147e1461..8e378f115b7 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts @@ -24,11 +24,11 @@ export class MainThreadDebugService extends MainThreadDebugServiceShape { this._proxy = threadService.get(ExtHostContext.ExtHostDebugService); this._toDispose = []; - this._toDispose.push(debugService.onDidNewProcess(proc => this._proxy.$acceptDebugSessionStarted(proc.getId(), proc.configuration.type, proc.name))); - this._toDispose.push(debugService.onDidEndProcess(proc => this._proxy.$acceptDebugSessionTerminated(proc.getId(), proc.configuration.type, proc.name))); + this._toDispose.push(debugService.onDidNewProcess(proc => this._proxy.$acceptDebugSessionStarted(proc.getId(), proc.configuration.type, proc.getName(false)))); + this._toDispose.push(debugService.onDidEndProcess(proc => this._proxy.$acceptDebugSessionTerminated(proc.getId(), proc.configuration.type, proc.getName(false)))); this._toDispose.push(debugService.getViewModel().onDidFocusProcess(proc => { if (proc) { - this._proxy.$acceptDebugSessionActiveChanged(proc.getId(), proc.configuration.type, proc.name); + this._proxy.$acceptDebugSessionActiveChanged(proc.getId(), proc.configuration.type, proc.getName(false)); } else { this._proxy.$acceptDebugSessionActiveChanged(undefined); } diff --git a/src/vs/workbench/parts/debug/browser/debugActionItems.ts b/src/vs/workbench/parts/debug/browser/debugActionItems.ts index 4937e1579a9..c4fd3c05bc8 100644 --- a/src/vs/workbench/parts/debug/browser/debugActionItems.ts +++ b/src/vs/workbench/parts/debug/browser/debugActionItems.ts @@ -197,8 +197,8 @@ export class FocusProcessActionItem extends SelectActionItem { this.debugService.getViewModel().onDidFocusStackFrame(() => { const process = this.debugService.getViewModel().focusedProcess; if (process) { - const names = this.debugService.getModel().getProcesses().map(p => p.name); - this.select(names.indexOf(process.name)); + const index = this.debugService.getModel().getProcesses().indexOf(process); + this.select(index); } }); @@ -208,7 +208,9 @@ export class FocusProcessActionItem extends SelectActionItem { private update() { const process = this.debugService.getViewModel().focusedProcess; - const names = this.debugService.getModel().getProcesses().map(p => p.name); - this.setOptions(names, process ? names.indexOf(process.name) : undefined); + const processes = this.debugService.getModel().getProcesses(); + const showRootName = this.debugService.getConfigurationManager().getLaunches().length > 1; + const names = processes.map(p => p.getName(showRootName)); + this.setOptions(names, process ? processes.indexOf(process) : undefined); } } diff --git a/src/vs/workbench/parts/debug/browser/debugActions.ts b/src/vs/workbench/parts/debug/browser/debugActions.ts index 1e9473ee7ae..987594f4c1c 100644 --- a/src/vs/workbench/parts/debug/browser/debugActions.ts +++ b/src/vs/workbench/parts/debug/browser/debugActions.ts @@ -144,7 +144,7 @@ export class StartAction extends AbstractDebugAction { if (this.contextService && !this.contextService.hasWorkspace() && processes.length > 0) { return false; } - if (processes.some(p => p.name === selectedName && (!launch || p.session.root.toString() === launch.workspaceUri.toString()))) { + if (processes.some(p => p.getName(false) === selectedName && (!launch || p.session.root.toString() === launch.workspaceUri.toString()))) { return false; } @@ -777,7 +777,8 @@ export class FocusProcessAction extends AbstractDebugAction { } public run(processName: string): TPromise { - const process = this.debugService.getModel().getProcesses().filter(p => p.name === processName).pop(); + const isMultiRoot = this.debugService.getConfigurationManager().getLaunches().length > 1; + const process = this.debugService.getModel().getProcesses().filter(p => p.getName(isMultiRoot) === processName).pop(); return this.debugService.focusStackFrameAndEvaluate(null, process, true).then(() => { const stackFrame = this.debugService.getViewModel().focusedStackFrame; if (stackFrame) { diff --git a/src/vs/workbench/parts/debug/common/debug.ts b/src/vs/workbench/parts/debug/common/debug.ts index 1c4b7c7428a..d1c1f35462d 100644 --- a/src/vs/workbench/parts/debug/common/debug.ts +++ b/src/vs/workbench/parts/debug/common/debug.ts @@ -121,7 +121,7 @@ export enum ProcessState { } export interface IProcess extends ITreeElement { - name: string; + getName(includeRoot: boolean): string; configuration: IConfig; session: ISession; sources: Map; diff --git a/src/vs/workbench/parts/debug/common/debugModel.ts b/src/vs/workbench/parts/debug/common/debugModel.ts index c4f7bcea280..b5c7c4dd14c 100644 --- a/src/vs/workbench/parts/debug/common/debugModel.ts +++ b/src/vs/workbench/parts/debug/common/debugModel.ts @@ -5,6 +5,7 @@ import * as nls from 'vs/nls'; import uri from 'vs/base/common/uri'; +import * as paths from 'vs/base/common/paths'; import { TPromise } from 'vs/base/common/winjs.base'; import * as lifecycle from 'vs/base/common/lifecycle'; import Event, { Emitter } from 'vs/base/common/event'; @@ -557,8 +558,8 @@ export class Process implements IProcess { return this._session; } - public get name(): string { - return this.configuration.name; + public getName(includeRoot: boolean): string { + return includeRoot ? `${this.configuration.name} (${paths.basename(this.session.root.fsPath)})` : this.configuration.name; } public get state(): ProcessState { diff --git a/src/vs/workbench/parts/debug/electron-browser/debugViewer.ts b/src/vs/workbench/parts/debug/electron-browser/debugViewer.ts index dc3362d638f..669fccdee95 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugViewer.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugViewer.ts @@ -520,7 +520,7 @@ export class CallStackRenderer implements IRenderer { private renderProcess(process: debug.IProcess, data: IProcessTemplateData): void { data.process.title = nls.localize({ key: 'process', comment: ['Process is a noun'] }, "Process"); - data.name.textContent = process.name; + data.name.textContent = process.getName(this.contextService.hasMultiFolderWorkspace()); const stoppedThread = process.getAllThreads().filter(t => t.stopped).pop(); data.stateLabel.textContent = stoppedThread ? nls.localize('paused', "Paused")