Skip to content

Commit

Permalink
fixes around mr compound debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed Jan 23, 2018
1 parent fb20841 commit 3ecae53
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/vs/workbench/parts/debug/browser/debugActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class StartAction extends AbstractDebugAction {
if (contextService && contextService.getWorkbenchState() === WorkbenchState.EMPTY && processes.length > 0) {
return false;
}
if (processes.some(p => p.getName(false) === configName && (!launch || p.session.root.uri.toString() === launch.uri.toString()))) {
if (processes.some(p => p.getName(false) === configName && (!launch || !launch.workspace || !p.session.root || p.session.root.uri.toString() === launch.workspace.uri.toString()))) {
return false;
}
const compound = launch && launch.getCompound(configName);
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/parts/debug/common/debugModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ export class Process implements IProcess {
}

public getName(includeRoot: boolean): string {
return includeRoot ? `${this.configuration.name} (${resources.basenameOrAuthority(this.session.root.uri)})` : this.configuration.name;
return includeRoot && this.session.root ? `${this.configuration.name} (${resources.basenameOrAuthority(this.session.root.uri)})` : this.configuration.name;
}

public get state(): ProcessState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ export function registerCommands(): void {
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: undefined,
primary: undefined,
handler: (accessor, workspaceUri: string) => {
handler: (accessor, launchUri: string) => {
const manager = accessor.get(IDebugService).getConfigurationManager();
if (accessor.get(IWorkspaceContextService).getWorkbenchState() === WorkbenchState.EMPTY) {
accessor.get(IMessageService).show(severity.Info, nls.localize('noFolderDebugConfig', "Please first open a folder in order to do advanced debug configuration."));
return TPromise.as(null);
}
const launch = manager.getLaunches().filter(l => l.uri.toString() === workspaceUri).pop() || manager.selectedLaunch;
const launch = manager.getLaunches().filter(l => l.uri.toString() === launchUri).pop() || manager.selectedLaunch;

return launch.openConfigFile(false).done(editor => {
if (editor) {
Expand Down
9 changes: 5 additions & 4 deletions src/vs/workbench/parts/debug/electron-browser/debugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import { IBroadcastService, IBroadcast } from 'vs/platform/broadcast/electron-br
import { IRemoteConsoleLog, parse, getFirstFrame } from 'vs/base/node/console';
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
import { TaskEvent, TaskEventKind } from 'vs/workbench/parts/tasks/common/tasks';
import { sequence } from 'vs/base/common/async';

const DEBUG_BREAKPOINTS_KEY = 'debug.breakpoint';
const DEBUG_BREAKPOINTS_ACTIVATED_KEY = 'debug.breakpointactivated';
Expand Down Expand Up @@ -668,7 +669,7 @@ export class DebugService implements debug.IDebugService {
this.model.getBreakpoints().forEach(bp => bp.verified = false);
}
this.launchJsonChanged = false;
const launch = root ? this.configurationManager.getLaunches().filter(l => l.uri.toString() === root.uri.toString()).pop()
const launch = root ? this.configurationManager.getLaunches().filter(l => l.workspace && l.workspace.uri.toString() === root.uri.toString()).pop()
: this.configurationManager.getWorkspaceLaunch();

let config: debug.IConfig, compound: debug.ICompound;
Expand All @@ -692,7 +693,7 @@ export class DebugService implements debug.IDebugService {
"Compound must have \"configurations\" attribute set in order to start multiple configurations.")));
}

return TPromise.join(compound.configurations.map(name => {
return sequence(compound.configurations.map(name => () => {
if (name === compound.name) {
return TPromise.as(null);
}
Expand Down Expand Up @@ -738,7 +739,7 @@ export class DebugService implements debug.IDebugService {

return (type ? TPromise.as(null) : this.configurationManager.guessAdapter().then(a => type = a && a.type)).then(() =>
(type ? this.extensionService.activateByEvent(`onDebugResolve:${type}`) : TPromise.as(null)).then(() =>
this.configurationManager.resolveConfigurationByProviders(launch ? launch.uri : undefined, type, config).then(config => {
this.configurationManager.resolveConfigurationByProviders(launch && launch.workspace ? launch.workspace.uri : undefined, type, config).then(config => {
// a falsy config indicates an aborted launch
if (config && config.type) {
return this.createProcess(root, config, sessionId);
Expand Down Expand Up @@ -1035,7 +1036,7 @@ export class DebugService implements debug.IDebugService {
const preserveFocus = focusedProcess && process.getId() === focusedProcess.getId();

return process.session.disconnect(true).then(() => {
if (strings.equalsIgnoreCase(process.configuration.type, 'extensionHost')) {
if (strings.equalsIgnoreCase(process.configuration.type, 'extensionHost') && process.session.root) {
return this.broadcastService.broadcast({
channel: EXTENSION_RELOAD_BROADCAST_CHANNEL,
payload: [process.session.root.uri.fsPath]
Expand Down

0 comments on commit 3ecae53

Please sign in to comment.