Skip to content

Commit 8f21515

Browse files
authored
Add VS Code settings for configuration properties (#1848)
* Add VS Code settings for configuration properties
1 parent 313ce19 commit 8f21515

File tree

8 files changed

+399
-122
lines changed

8 files changed

+399
-122
lines changed

Extension/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# C/C++ for Visual Studio Code Change Log
22

3+
## Version 0.17.0: May 7, 2018
4+
* Auto-complete for headers after typing `#include`. [#802](https://github.com/Microsoft/vscode-cpptools/issues/802)
5+
* Configuration improvements. [#1338](https://github.com/Microsoft/vscode-cpptools/issues/1338)
6+
* potentially addresses: [#368](https://github.com/Microsoft/vscode-cpptools/issues/368), [#410](https://github.com/Microsoft/vscode-cpptools/issues/410), [#1229](https://github.com/Microsoft/vscode-cpptools/issues/1229), [#1270](https://github.com/Microsoft/vscode-cpptools/issues/)
7+
* Add support for querying system includes/defines from compilers in WSL environment.
8+
39
## Version 0.16.1: March 30, 2018
410
* Fix random deadlock caused by logging code on Linux/Mac. [#1759](https://github.com/Microsoft/vscode-cpptools/issues/1759)
511
* Fix compiler from `compileCommands` not being queried for includes/defines if `compilerPath` isn't set on Windows. [#1754](https://github.com/Microsoft/vscode-cpptools/issues/1754)

Extension/package.json

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,154 @@
229229
},
230230
"description": "Defines the editor behavior for when the Enter key is pressed inside a multiline or single line comment block.",
231231
"scope": "resource"
232+
},
233+
"C_Cpp.default.includePath": {
234+
"type": [
235+
"array",
236+
"null"
237+
],
238+
"items": {
239+
"type": "string"
240+
},
241+
"default": null,
242+
"description": "The value to use in a configuration if \"includePath\" is not specified, or the values to insert if \"${default}\" is present in \"includePath\".",
243+
"scope": "resource"
244+
},
245+
"C_Cpp.default.defines": {
246+
"type": [
247+
"array",
248+
"null"
249+
],
250+
"items": {
251+
"type": "string"
252+
},
253+
"default": null,
254+
"description": "The value to use in a configuration if \"defines\" is not specified, or the values to insert if \"${default}\" is present in \"defines\".",
255+
"scope": "resource"
256+
},
257+
"C_Cpp.default.macFrameworkPath": {
258+
"type": [
259+
"array",
260+
"null"
261+
],
262+
"items": {
263+
"type": "string"
264+
},
265+
"default": null,
266+
"description": "The value to use in a configuration if \"macFrameworkPath\" is not specified, or the values to insert if \"${default}\" is present in \"macFrameworkPath\".",
267+
"scope": "resource"
268+
},
269+
"C_Cpp.default.compileCommands": {
270+
"type": [
271+
"string",
272+
"null"
273+
],
274+
"default": null,
275+
"description": "The value to use in a configuration if \"compileCommands\" is not specified, or the values to insert if \"${default}\" is present in \"compileCommands\".",
276+
"scope": "resource"
277+
},
278+
"C_Cpp.default.forcedInclude": {
279+
"type": [
280+
"array",
281+
"null"
282+
],
283+
"items": {
284+
"type": "string"
285+
},
286+
"default": null,
287+
"description": "The value to use in a configuration if \"forcedInclude\" is not specified, or the values to insert if \"${default}\" is present in \"forcedInclude\".",
288+
"scope": "resource"
289+
},
290+
"C_Cpp.default.intelliSenseMode": {
291+
"type": [
292+
"string",
293+
"null"
294+
],
295+
"enum": [
296+
"msvc-x64",
297+
"clang-x64"
298+
],
299+
"default": null,
300+
"description": "The value to use in a configuration if \"intelliSenseMode\" is not specified, or the values to insert if \"${default}\" is present in \"intelliSenseMode\".",
301+
"scope": "resource"
302+
},
303+
"C_Cpp.default.compilerPath": {
304+
"type": [
305+
"string",
306+
"null"
307+
],
308+
"default": null,
309+
"description": "The value to use in a configuration if \"compilerPath\" is not specified, or the values to insert if \"${default}\" is present in \"compilerPath\".",
310+
"scope": "resource"
311+
},
312+
"C_Cpp.default.cStandard": {
313+
"type": [
314+
"string",
315+
"null"
316+
],
317+
"enum": [
318+
"c89",
319+
"c99",
320+
"c11"
321+
],
322+
"default": null,
323+
"description": "The value to use in a configuration if \"cStandard\" is not specified, or the values to insert if \"${default}\" is present in \"cStandard\".",
324+
"scope": "resource"
325+
},
326+
"C_Cpp.default.cppStandard": {
327+
"type": [
328+
"string",
329+
"null"
330+
],
331+
"enum": [
332+
"c++98",
333+
"c++03",
334+
"c++11",
335+
"c++14",
336+
"c++17"
337+
],
338+
"default": null,
339+
"description": "The value to use in a configuration if \"cppStandard\" is not specified, or the values to insert if \"${default}\" is present in \"cppStandard\".",
340+
"scope": "resource"
341+
},
342+
"C_Cpp.default.browse.path": {
343+
"type": [
344+
"array",
345+
"null"
346+
],
347+
"items": {
348+
"type": "string"
349+
},
350+
"default": null,
351+
"description": "The value to use in a configuration if \"browse.path\" is not specified, or the values to insert if \"${default}\" is present in \"browse.path\".",
352+
"scope": "resource"
353+
},
354+
"C_Cpp.default.browse.databaseFilename": {
355+
"type": [
356+
"string",
357+
"null"
358+
],
359+
"default": null,
360+
"description": "The value to use in a configuration if \"browse.databaseFilename\" is not specified, or the values to insert if \"${default}\" is present in \"browse.databaseFilename\".",
361+
"scope": "resource"
362+
},
363+
"C_Cpp.default.browse.limitSymbolsToIncludedHeaders": {
364+
"type": "boolean",
365+
"default": true,
366+
"description": "The value to use in a configuration if \"browse.limitSymbolsToIncludedHeaders\" is not specified, or the values to insert if \"${default}\" is present in \"browse.limitSymbolsToIncludedHeaders\".",
367+
"scope": "resource"
368+
},
369+
"C_Cpp.default.systemIncludePath": {
370+
"type": [
371+
"array",
372+
"null"
373+
],
374+
"items": {
375+
"type": "string"
376+
},
377+
"default": null,
378+
"description": "The value to use for the system include path. If set, it overrides the system include path acquired via \"compilerPath\" and \"compileCommands\" settings.",
379+
"scope": "resource"
232380
}
233381
}
234382
},

Extension/src/LanguageServer/client.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,13 @@ function collectSettingsForTelemetry(filter: (key: string, val: string, settings
145145

146146
if (filter(key, val, settings)) {
147147
previousCppSettings[key] = val;
148-
switch (String(key).toLowerCase()) {
148+
switch (key.toLowerCase()) {
149149
case "clang_format_path": {
150150
continue;
151151
}
152152
case "clang_format_style":
153153
case "clang_format_fallbackstyle": {
154-
let newKey: string = String(key) + "2";
154+
let newKey: string = key + "2";
155155
if (val) {
156156
switch (String(val).toLowerCase()) {
157157
case "visual studio":
@@ -177,6 +177,9 @@ function collectSettingsForTelemetry(filter: (key: string, val: string, settings
177177
break;
178178
}
179179
default: {
180+
if (key.startsWith("default.")) {
181+
continue; // Don't log c_cpp_properties.json defaults since they may contain PII.
182+
}
180183
result[key] = String(previousCppSettings[key]);
181184
break;
182185
}
@@ -317,7 +320,7 @@ class DefaultClient implements Client {
317320
ui.bind(this);
318321

319322
this.onReadyPromise = languageClient.onReady().then(() => {
320-
this.configuration = new configs.CppProperties(this.RootPath);
323+
this.configuration = new configs.CppProperties(this.RootUri);
321324
this.configuration.ConfigurationsChanged((e) => this.onConfigurationsChanged(e));
322325
this.configuration.SelectionChanged((e) => this.onSelectedConfigurationChanged(e));
323326
this.configuration.CompileCommandsChanged((e) => this.onCompileCommandsChanged(e));
@@ -392,6 +395,7 @@ class DefaultClient implements Client {
392395
tab_size: other.editorTabSize,
393396
intelliSenseEngine: settings.intelliSenseEngine,
394397
intelliSenseEngineFallback: settings.intelliSenseEngineFallback,
398+
defaultSystemIncludePath: settings.defaultSystemIncludePath,
395399
autocomplete: settings.autoComplete,
396400
errorSquiggles: settings.errorSquiggles,
397401
dimInactiveRegions: settings.dimInactiveRegions,
@@ -446,6 +450,7 @@ class DefaultClient implements Client {
446450
if (changedSettings["commentContinuationPatterns"]) {
447451
updateLanguageConfigurations();
448452
}
453+
this.configuration.onDidChangeSettings();
449454
telemetry.logLanguageServerEvent("CppSettingsChange", changedSettings, null);
450455
}
451456
}

0 commit comments

Comments
 (0)