Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an issue with missing custom configurations #12427

Merged
merged 3 commits into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ const DidChangeTextEditorSelectionNotification: NotificationType<Range> = new No
const ChangeCompileCommandsNotification: NotificationType<FileChangedParams> = new NotificationType<FileChangedParams>('cpptools/didChangeCompileCommands');
const ChangeSelectedSettingNotification: NotificationType<FolderSelectedSettingParams> = new NotificationType<FolderSelectedSettingParams>('cpptools/didChangeSelectedSetting');
const IntervalTimerNotification: NotificationType<void> = new NotificationType<void>('cpptools/onIntervalTimer');
const CustomConfigurationHighPriorityNotification: NotificationType<CustomConfigurationParams> = new NotificationType<CustomConfigurationParams>('cpptools/didChangeCustomConfigurationHighPriority');
const CustomConfigurationNotification: NotificationType<CustomConfigurationParams> = new NotificationType<CustomConfigurationParams>('cpptools/didChangeCustomConfiguration');
const CustomBrowseConfigurationNotification: NotificationType<CustomBrowseConfigurationParams> = new NotificationType<CustomBrowseConfigurationParams>('cpptools/didChangeCustomBrowseConfiguration');
const ClearCustomConfigurationsNotification: NotificationType<WorkspaceFolderParams> = new NotificationType<WorkspaceFolderParams>('cpptools/clearCustomConfigurations');
Expand Down Expand Up @@ -2092,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";
}
Expand Down Expand Up @@ -3019,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);
Expand Down Expand Up @@ -3085,6 +3086,9 @@ export class DefaultClient implements Client {
workspaceFolderUri: this.RootUri?.toString()
};

if (wasRequested) {
void this.languageClient.sendNotification(CustomConfigurationHighPriorityNotification, params).catch(logAndReturn.undefined);
}
void this.languageClient.sendNotification(CustomConfigurationNotification, params).catch(logAndReturn.undefined);
}

Expand Down
Loading