Skip to content

Commit 9d321ce

Browse files
authored
Fix an issue with missing custom configurations (#12427)
1 parent 7a1785d commit 9d321ce

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Extension/src/LanguageServer/client.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ const DidChangeTextEditorSelectionNotification: NotificationType<Range> = new No
577577
const ChangeCompileCommandsNotification: NotificationType<FileChangedParams> = new NotificationType<FileChangedParams>('cpptools/didChangeCompileCommands');
578578
const ChangeSelectedSettingNotification: NotificationType<FolderSelectedSettingParams> = new NotificationType<FolderSelectedSettingParams>('cpptools/didChangeSelectedSetting');
579579
const IntervalTimerNotification: NotificationType<void> = new NotificationType<void>('cpptools/onIntervalTimer');
580+
const CustomConfigurationHighPriorityNotification: NotificationType<CustomConfigurationParams> = new NotificationType<CustomConfigurationParams>('cpptools/didChangeCustomConfigurationHighPriority');
580581
const CustomConfigurationNotification: NotificationType<CustomConfigurationParams> = new NotificationType<CustomConfigurationParams>('cpptools/didChangeCustomConfiguration');
581582
const CustomBrowseConfigurationNotification: NotificationType<CustomBrowseConfigurationParams> = new NotificationType<CustomBrowseConfigurationParams>('cpptools/didChangeCustomBrowseConfiguration');
582583
const ClearCustomConfigurationsNotification: NotificationType<WorkspaceFolderParams> = new NotificationType<WorkspaceFolderParams>('cpptools/clearCustomConfigurations');
@@ -2092,7 +2093,7 @@ export class DefaultClient implements Client {
20922093
try {
20932094
const configs: SourceFileConfigurationItem[] | undefined = await this.callTaskWithTimeout(provideConfigurationAsync, configProviderTimeout, tokenSource);
20942095
if (configs && configs.length > 0) {
2095-
this.sendCustomConfigurations(configs, provider.version);
2096+
this.sendCustomConfigurations(configs, provider.version, requestFile !== undefined);
20962097
} else {
20972098
result = "noConfigurations";
20982099
}
@@ -3019,7 +3020,7 @@ export class DefaultClient implements Client {
30193020
util.isOptionalArrayOfString(input.configuration.forcedInclude);
30203021
}
30213022

3022-
private sendCustomConfigurations(configs: any, providerVersion: Version): void {
3023+
private sendCustomConfigurations(configs: any, providerVersion: Version, wasRequested: boolean): void {
30233024
// 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.
30243025
if (!configs || !(configs instanceof Array)) {
30253026
console.warn("discarding invalid SourceFileConfigurationItems[]: " + configs);
@@ -3085,6 +3086,9 @@ export class DefaultClient implements Client {
30853086
workspaceFolderUri: this.RootUri?.toString()
30863087
};
30873088

3089+
if (wasRequested) {
3090+
void this.languageClient.sendNotification(CustomConfigurationHighPriorityNotification, params).catch(logAndReturn.undefined);
3091+
}
30883092
void this.languageClient.sendNotification(CustomConfigurationNotification, params).catch(logAndReturn.undefined);
30893093
}
30903094

0 commit comments

Comments
 (0)