From b2a69e68075eccc61eced53b404ddba231be27bb Mon Sep 17 00:00:00 2001 From: Colen Garoutte-Carson Date: Mon, 1 Jul 2024 13:01:50 -0700 Subject: [PATCH 1/3] Fix an issue with missing custom configurations --- Extension/src/LanguageServer/client.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 95e11724ea..5324b032c3 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -577,6 +577,7 @@ const DidChangeTextEditorSelectionNotification: NotificationType = new No const ChangeCompileCommandsNotification: NotificationType = new NotificationType('cpptools/didChangeCompileCommands'); const ChangeSelectedSettingNotification: NotificationType = new NotificationType('cpptools/didChangeSelectedSetting'); const IntervalTimerNotification: NotificationType = new NotificationType('cpptools/onIntervalTimer'); +const CustomConfigurationHighPriorityNotification: NotificationType = new NotificationType('cpptools/didChangeCustomConfigurationHighPriority'); const CustomConfigurationNotification: NotificationType = new NotificationType('cpptools/didChangeCustomConfiguration'); const CustomBrowseConfigurationNotification: NotificationType = new NotificationType('cpptools/didChangeCustomBrowseConfiguration'); const ClearCustomConfigurationsNotification: NotificationType = new NotificationType('cpptools/clearCustomConfigurations'); @@ -3085,6 +3086,7 @@ export class DefaultClient implements Client { workspaceFolderUri: this.RootUri?.toString() }; + void this.languageClient.sendNotification(CustomConfigurationHighPriorityNotification, params).catch(logAndReturn.undefined); void this.languageClient.sendNotification(CustomConfigurationNotification, params).catch(logAndReturn.undefined); } From c6f6b10a9365919d5fa44e00eb9b837fec9940b7 Mon Sep 17 00:00:00 2001 From: Colen Garoutte-Carson Date: Mon, 1 Jul 2024 13:58:58 -0700 Subject: [PATCH 2/3] Only use high priority custom config message if as a result of a request --- Extension/src/LanguageServer/client.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 5324b032c3..c2444474ea 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -2093,7 +2093,7 @@ export class DefaultClient implements Client { try { const configs: SourceFileConfigurationItem[] | undefined = await this.callTaskWithTimeout(provideConfigurationAsync, configProviderTimeout, tokenSource); if (configs && configs.length > 0) { - this.sendCustomConfigurations(configs, provider.version); + this.sendCustomConfigurations(configs, provider.version, requestFile != undefined); } else { result = "noConfigurations"; } @@ -3020,7 +3020,7 @@ export class DefaultClient implements Client { util.isOptionalArrayOfString(input.configuration.forcedInclude); } - private sendCustomConfigurations(configs: any, providerVersion: Version): void { + private sendCustomConfigurations(configs: any, providerVersion: Version, wasRequested: boolean): void { // configs is marked as 'any' because it is untrusted data coming from a 3rd-party. We need to sanitize it before sending it to the language server. if (!configs || !(configs instanceof Array)) { console.warn("discarding invalid SourceFileConfigurationItems[]: " + configs); @@ -3086,7 +3086,8 @@ export class DefaultClient implements Client { workspaceFolderUri: this.RootUri?.toString() }; - void this.languageClient.sendNotification(CustomConfigurationHighPriorityNotification, params).catch(logAndReturn.undefined); + if (wasRequested) + void this.languageClient.sendNotification(CustomConfigurationHighPriorityNotification, params).catch(logAndReturn.undefined); void this.languageClient.sendNotification(CustomConfigurationNotification, params).catch(logAndReturn.undefined); } From 682b8b66d9a3ef9fe49ec3d29ec5a48dd5670cec Mon Sep 17 00:00:00 2001 From: Colen Garoutte-Carson Date: Mon, 1 Jul 2024 14:00:55 -0700 Subject: [PATCH 3/3] Fix lint issues --- Extension/src/LanguageServer/client.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index c2444474ea..75f2c435cf 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -2093,7 +2093,7 @@ export class DefaultClient implements Client { try { const configs: SourceFileConfigurationItem[] | undefined = await this.callTaskWithTimeout(provideConfigurationAsync, configProviderTimeout, tokenSource); if (configs && configs.length > 0) { - this.sendCustomConfigurations(configs, provider.version, requestFile != undefined); + this.sendCustomConfigurations(configs, provider.version, requestFile !== undefined); } else { result = "noConfigurations"; } @@ -3086,8 +3086,9 @@ export class DefaultClient implements Client { workspaceFolderUri: this.RootUri?.toString() }; - if (wasRequested) + if (wasRequested) { void this.languageClient.sendNotification(CustomConfigurationHighPriorityNotification, params).catch(logAndReturn.undefined); + } void this.languageClient.sendNotification(CustomConfigurationNotification, params).catch(logAndReturn.undefined); }