Skip to content

Commit

Permalink
Fix getting initial configs from debug adapter (#156947)
Browse files Browse the repository at this point in the history
Fixes #156943
  • Loading branch information
roblourens authored Aug 3, 2022
1 parent e9bda7a commit da76f93
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export class ConfigurationManager implements IConfigurationManager {
disposables.add(input.onDidTriggerItemButton(async (context) => {
resolve(undefined);
const { launch, config } = context.item;
await launch.openConfigFile({ preserveFocus: false, type: config.type });
await launch.openConfigFile({ preserveFocus: false, type: config.type, suppressInitialConfigs: true });
// Only Launch have a pin trigger button
await (launch as Launch).writeConfiguration(config);
await this.selectConfiguration(launch, config.name);
Expand Down Expand Up @@ -564,7 +564,7 @@ class Launch extends AbstractLaunch implements ILaunch {
return this.configurationService.inspect<IGlobalConfig>('launch', { resource: this.workspace.uri }).workspaceFolderValue;
}

async openConfigFile({ preserveFocus, type, useInitialConfigs }: { preserveFocus: boolean; type?: string; useInitialConfigs?: boolean }, token?: CancellationToken): Promise<{ editor: IEditorPane | null; created: boolean }> {
async openConfigFile({ preserveFocus, type, suppressInitialConfigs }: { preserveFocus: boolean; type?: string; suppressInitialConfigs?: boolean }, token?: CancellationToken): Promise<{ editor: IEditorPane | null; created: boolean }> {
const resource = this.uri;
let created = false;
let content = '';
Expand All @@ -573,7 +573,7 @@ class Launch extends AbstractLaunch implements ILaunch {
content = fileContent.value.toString();
} catch {
// launch.json not found: create one by collecting launch configs from debugConfigProviders
content = await this.getInitialConfigurationContent(this.workspace.uri, type, useInitialConfigs, token);
content = await this.getInitialConfigurationContent(this.workspace.uri, type, !suppressInitialConfigs, token);
if (!content) {
// Cancelled
return { editor: null, created: false };
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class StartDebugQuickAccessProvider extends PickerQuickAccessProvider<IPi
tooltip: localize('customizeLaunchConfig', "Configure Launch Configuration")
}],
trigger: () => {
config.launch.openConfigFile({ preserveFocus: false, useInitialConfigs: false });
config.launch.openConfigFile({ preserveFocus: false });

return TriggerAction.CLOSE_PICKER;
},
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ export interface ILaunch {
/**
* Opens the launch.json file. Creates if it does not exist.
*/
openConfigFile(options: { preserveFocus: boolean; type?: string; useInitialConfigs?: boolean }, token?: CancellationToken): Promise<{ editor: IEditorPane | null; created: boolean }>;
openConfigFile(options: { preserveFocus: boolean; type?: string; suppressInitialConfigs?: boolean }, token?: CancellationToken): Promise<{ editor: IEditorPane | null; created: boolean }>;
}

// Debug service interfaces
Expand Down

0 comments on commit da76f93

Please sign in to comment.