Skip to content

Commit 770013d

Browse files
authored
Enable environment variables with clang_format_path. (#2380)
* Enable environment variables with clang_format_path.
1 parent 2388fa9 commit 770013d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Extension/src/LanguageServer/client.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ const DebugProtocolNotification: NotificationType<OutputNotificationBody, void>
132132
const DebugLogNotification: NotificationType<OutputNotificationBody, void> = new NotificationType<OutputNotificationBody, void>('cpptools/debugLog');
133133
const InactiveRegionNotification: NotificationType<InactiveRegionParams, void> = new NotificationType<InactiveRegionParams, void>('cpptools/inactiveRegions');
134134
const CompileCommandsPathsNotification: NotificationType<CompileCommandsPaths, void> = new NotificationType<CompileCommandsPaths, void>('cpptools/compileCommandsPaths');
135+
const UpdateClangFormatPathNotification: NotificationType<string, void> = new NotificationType<string, void>('cpptools/updateClangFormatPath');
135136

136137
let failureMessageShown: boolean = false;
137138

@@ -336,7 +337,7 @@ class DefaultClient implements Client {
336337
},
337338
workspaceFolder: workspaceFolder,
338339
initializationOptions: {
339-
clang_format_path: settings.clangFormatPath,
340+
clang_format_path: util.resolveVariables(settings.clangFormatPath, null),
340341
clang_format_style: settings.clangFormatStyle,
341342
clang_format_fallbackStyle: settings.clangFormatFallbackStyle,
342343
clang_format_sortIncludes: settings.clangFormatSortIncludes,
@@ -402,6 +403,10 @@ class DefaultClient implements Client {
402403
if (changedSettings["commentContinuationPatterns"]) {
403404
updateLanguageConfigurations();
404405
}
406+
if (changedSettings["clang_format_path"]) {
407+
let settings: CppSettings = new CppSettings(this.RootUri);
408+
this.languageClient.sendNotification(UpdateClangFormatPathNotification, util.resolveVariables(settings.clangFormatPath, null));
409+
}
405410
this.configuration.onDidChangeSettings();
406411
telemetry.logLanguageServerEvent("CppSettingsChange", changedSettings, null);
407412
}

0 commit comments

Comments
 (0)