Skip to content

Commit 98a9b0c

Browse files
authored
add ChangeCppPropertiesRequest and remove Notification. (#10420)
1 parent dc0a7af commit 98a9b0c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Extension/src/LanguageServer/client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ export const FormatOnTypeRequest: RequestType<FormatParams, TextEdit[], void> =
541541
const CreateDeclarationOrDefinitionRequest: RequestType<CreateDeclarationOrDefinitionParams, CreateDeclarationOrDefinitionResult, void> = new RequestType<CreateDeclarationOrDefinitionParams, CreateDeclarationOrDefinitionResult, void>('cpptools/createDeclDef');
542542
const GoToDirectiveInGroupRequest: RequestType<GoToDirectiveInGroupParams, Position | undefined, void> = new RequestType<GoToDirectiveInGroupParams, Position | undefined, void>('cpptools/goToDirectiveInGroup');
543543
const GenerateDoxygenCommentRequest: RequestType<GenerateDoxygenCommentParams, GenerateDoxygenCommentResult | undefined, void> = new RequestType<GenerateDoxygenCommentParams, GenerateDoxygenCommentResult, void>('cpptools/generateDoxygenComment');
544+
const ChangeCppPropertiesRequest: RequestType<CppPropertiesParams, void, void> = new RequestType<CppPropertiesParams, void, void>('cpptools/didChangeCppProperties');
544545

545546
// Notifications to the server
546547
const DidOpenNotification: NotificationType<DidOpenTextDocumentParams> = new NotificationType<DidOpenTextDocumentParams>('textDocument/didOpen');
@@ -553,7 +554,6 @@ const ResumeParsingNotification: NotificationType<void> = new NotificationType<v
553554
const ActiveDocumentChangeNotification: NotificationType<TextDocumentIdentifier> = new NotificationType<TextDocumentIdentifier>('cpptools/activeDocumentChange');
554555
const RestartIntelliSenseForFileNotification: NotificationType<TextDocumentIdentifier> = new NotificationType<TextDocumentIdentifier>('cpptools/restartIntelliSenseForFile');
555556
const TextEditorSelectionChangeNotification: NotificationType<Range> = new NotificationType<Range>('cpptools/textEditorSelectionChange');
556-
const ChangeCppPropertiesNotification: NotificationType<CppPropertiesParams> = new NotificationType<CppPropertiesParams>('cpptools/didChangeCppProperties');
557557
const ChangeCompileCommandsNotification: NotificationType<FileChangedParams> = new NotificationType<FileChangedParams>('cpptools/didChangeCompileCommands');
558558
const ChangeSelectedSettingNotification: NotificationType<FolderSelectedSettingParams> = new NotificationType<FolderSelectedSettingParams>('cpptools/didChangeSelectedSetting');
559559
const IntervalTimerNotification: NotificationType<IntervalTimerParams> = new NotificationType<IntervalTimerParams>('cpptools/onIntervalTimer');
@@ -2584,7 +2584,7 @@ export class DefaultClient implements Client {
25842584

25852585
private doneInitialCustomBrowseConfigurationCheck: boolean = false;
25862586

2587-
private onConfigurationsChanged(cppProperties: configs.CppProperties): void {
2587+
private async onConfigurationsChanged(cppProperties: configs.CppProperties): Promise<void> {
25882588
if (!cppProperties.Configurations) {
25892589
return;
25902590
}
@@ -2614,7 +2614,7 @@ export class DefaultClient implements Client {
26142614
params.configurations.push(modifiedConfig);
26152615
});
26162616

2617-
this.languageClient.sendNotification(ChangeCppPropertiesNotification, params);
2617+
await this.languageClient.sendRequest(ChangeCppPropertiesRequest, params);
26182618
const lastCustomBrowseConfigurationProviderId: PersistentFolderState<string | undefined> | undefined = cppProperties.LastCustomBrowseConfigurationProviderId;
26192619
const lastCustomBrowseConfigurationProviderVersion: PersistentFolderState<Version> | undefined = cppProperties.LastCustomBrowseConfigurationProviderVersion;
26202620
const lastCustomBrowseConfiguration: PersistentFolderState<WorkspaceBrowseConfiguration | undefined> | undefined = cppProperties.LastCustomBrowseConfiguration;

Extension/src/LanguageServer/configurations.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,9 @@ export class CppProperties {
893893
}
894894
} else {
895895
// add compiler to list of trusted compilers
896-
util.addTrustedCompiler(compilerPaths, configuration.compilerPath);
896+
if (i === this.CurrentConfigurationIndex) {
897+
util.addTrustedCompiler(compilerPaths, configuration.compilerPath);
898+
}
897899
}
898900
} else {
899901
// However, if compileCommands are used and compilerPath is explicitly set, it's still necessary to resolve variables in it.

0 commit comments

Comments
 (0)