From d8743b53e8f24ab37f6807499ee5035a9c6fc0c7 Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 25 Oct 2016 16:43:20 +0200 Subject: [PATCH] debug: always use the first configuration even if none is chosen fixes #14403 --- src/vs/workbench/parts/debug/common/debug.ts | 15 +++++++++++++++ .../parts/debug/electron-browser/debugService.ts | 2 +- .../parts/debug/node/debugConfigurationManager.ts | 5 +++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/parts/debug/common/debug.ts b/src/vs/workbench/parts/debug/common/debug.ts index 5f6b557f15a..5d3a43932da 100644 --- a/src/vs/workbench/parts/debug/common/debug.ts +++ b/src/vs/workbench/parts/debug/common/debug.ts @@ -338,9 +338,24 @@ export interface IRawBreakpointContribution { } export interface IConfigurationManager { + + /** + * Returns a resolved debug configuration. + * If nameOrConfig is null resolves the first configuration and returns it. + */ getConfiguration(nameOrConfig: string | IConfig): TPromise; + + /** + * Opens the launch.json file + */ openConfigFile(sideBySide: boolean): TPromise; + + // TODO@Isidor remove this from the interface loadLaunchConfig(): TPromise; + + /** + * Returns true if breakpoints can be set for a given editor model. Depends on mode. + */ canSetBreakpointsIn(model: editor.IModel): boolean; } diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index 57ebf85efcd..0bc8171f468 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -111,7 +111,7 @@ export class DebugService implements debug.IDebugService { this.model = new model.Model(this.loadBreakpoints(), this.storageService.getBoolean(DEBUG_BREAKPOINTS_ACTIVATED_KEY, StorageScope.WORKSPACE, true), this.loadFunctionBreakpoints(), this.loadExceptionBreakpoints(), this.loadWatchExpressions()); this.toDispose.push(this.model); - this.viewModel = new viewmodel.ViewModel(this.storageService.get(DEBUG_SELECTED_CONFIG_NAME_KEY, StorageScope.WORKSPACE, 'null')); + this.viewModel = new viewmodel.ViewModel(this.storageService.get(DEBUG_SELECTED_CONFIG_NAME_KEY, StorageScope.WORKSPACE, null)); this.registerListeners(eventService, lifecycleService); } diff --git a/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts b/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts index 527ff5e75b6..e4d0b451d4f 100644 --- a/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts +++ b/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts @@ -261,9 +261,10 @@ export class ConfigurationManager implements debug.IConfigurationManager { return result; } // if the configuration name is not set yet, take the first launch config (can happen if debug viewlet has not been opened yet). - const filtered = nameOrConfig ? config.configurations.filter(cfg => cfg.name === nameOrConfig) : [config.configurations[0]]; + const filtered = config.configurations.filter(cfg => cfg.name === nameOrConfig); - result = filtered.length === 1 ? objects.deepClone(filtered[0]) : null; + result = filtered.length === 1 ? filtered[0] : config.configurations[0]; + result = objects.deepClone(result); if (config && result) { result.debugServer = config.debugServer; } -- GitLab