From f373f2d1dcb01e7835384dbabec6d2659990e80a Mon Sep 17 00:00:00 2001 From: adrianstephens Date: Sat, 23 Nov 2024 13:58:40 -0800 Subject: [PATCH] pass optional parameter to C_Cpp.ConfigurationSelect --- Extension/src/LanguageServer/client.ts | 6 +++--- Extension/src/LanguageServer/extension.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 6dd00d741..bffb429e6 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -762,7 +762,7 @@ export interface Client { PauseCodeAnalysis(): void; ResumeCodeAnalysis(): void; CancelCodeAnalysis(): void; - handleConfigurationSelectCommand(): Promise; + handleConfigurationSelectCommand(config?: string): Promise; handleConfigurationProviderSelectCommand(): Promise; handleShowActiveCodeAnalysisCommands(): Promise; handleShowIdleCodeAnalysisCommands(): Promise; @@ -3248,11 +3248,11 @@ export class DefaultClient implements Client { /** * command handlers */ - public async handleConfigurationSelectCommand(): Promise { + public async handleConfigurationSelectCommand(config?: string): Promise { await this.ready; const configNames: string[] | undefined = this.configuration.ConfigurationNames; if (configNames) { - const index: number = await ui.showConfigurations(configNames); + const index: number = config ? configNames.indexOf(config) : await ui.showConfigurations(configNames); if (index < 0) { return; } diff --git a/Extension/src/LanguageServer/extension.ts b/Extension/src/LanguageServer/extension.ts index 02dd3e886..8bc64f82f 100644 --- a/Extension/src/LanguageServer/extension.ts +++ b/Extension/src/LanguageServer/extension.ts @@ -584,13 +584,13 @@ async function installCompiler(sender?: any): Promise { telemetry.logLanguageServerEvent('installCompiler', telemetryProperties); } -async function onSelectConfiguration(): Promise { +async function onSelectConfiguration(config?: string): Promise { if (!isFolderOpen()) { void vscode.window.showInformationMessage(localize("configuration.select.first", 'Open a folder first to select a configuration.')); } else { // This only applies to the active client. You cannot change the configuration for // a client that is not active since that client's UI will not be visible. - return clients.ActiveClient.handleConfigurationSelectCommand(); + return clients.ActiveClient.handleConfigurationSelectCommand(config); } }