Skip to content

Commit 6faac10

Browse files
authored
Fixing issues found while testing settings changes (#1865)
* Fixing issues found while testing settings changes * missed a property in the schema * additional safety around config updates
1 parent 6648c40 commit 6faac10

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

Extension/c_cpp_properties.schema.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
],
1212
"properties": {
1313
"name": {
14-
"description": "Configuration identifier. Mac, Linux, or Win32 are special identifiers for configurations that will be auto-selected on those platforms, but the identifier can be anything.",
14+
"description": "Configuration identifier. Mac, Linux, and Win32 are special identifiers for configurations that will be auto-selected on those platforms, but the identifier can be anything.",
1515
"type": "string"
1616
},
1717
"compilerPath": {
@@ -24,7 +24,8 @@
2424
"enum": [
2525
"c89",
2626
"c99",
27-
"c11"
27+
"c11",
28+
"${default}"
2829
]
2930
},
3031
"cppStandard": {
@@ -35,7 +36,8 @@
3536
"c++03",
3637
"c++11",
3738
"c++14",
38-
"c++17"
39+
"c++17",
40+
"${default}"
3941
]
4042
},
4143
"compileCommands": {
@@ -64,12 +66,13 @@
6466
}
6567
},
6668
"intelliSenseMode": {
69+
"description": "If set, it overrides the default mode used by the IntelliSense engine. Windows defaults to msvc-x64 and Linux/Mac default to clang-x64.",
6770
"type": "string",
6871
"enum": [
6972
"msvc-x64",
70-
"clang-x64"
71-
],
72-
"description": "If set, it overrides the default mode used by the IntelliSense engine. Windows defaults to msvc-x64 and Linux/Mac default to clang-x64."
73+
"clang-x64",
74+
"${default}"
75+
]
7376
},
7477
"forcedInclude": {
7578
"description": "A list of files that should be included before any include file in a translation unit.",
@@ -83,7 +86,10 @@
8386
"properties": {
8487
"limitSymbolsToIncludedHeaders": {
8588
"description": "true to process only those files directly or indirectly included as headers, false to process all files under the specified include paths.",
86-
"type": "boolean"
89+
"type": [
90+
"boolean",
91+
"string"
92+
]
8793
},
8894
"databaseFilename": {
8995
"description": "Path to the generated symbol database. If a relative path is specified, it will be made relative to the workspace's default storage location.",

Extension/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@
282282
"null"
283283
],
284284
"default": null,
285-
"description": "The value to use in a configuration if \"compileCommands\" is not specified, or the values to insert if \"${default}\" is present in \"compileCommands\".",
285+
"description": "The value to use in a configuration if \"compileCommands\" is either not specified, or set to \"${default}\".",
286286
"scope": "resource"
287287
},
288288
"C_Cpp.default.forcedInclude": {
@@ -307,7 +307,7 @@
307307
"clang-x64"
308308
],
309309
"default": null,
310-
"description": "The value to use in a configuration if \"intelliSenseMode\" is not specified, or the values to insert if \"${default}\" is present in \"intelliSenseMode\".",
310+
"description": "The value to use in a configuration if \"intelliSenseMode\" is either not specified or set to \"${default}\".",
311311
"scope": "resource"
312312
},
313313
"C_Cpp.default.compilerPath": {
@@ -316,7 +316,7 @@
316316
"null"
317317
],
318318
"default": null,
319-
"description": "The value to use in a configuration if \"compilerPath\" is not specified, or the values to insert if \"${default}\" is present in \"compilerPath\".",
319+
"description": "The value to use in a configuration if \"compilerPath\" is either not specified or set to \"${default}\".",
320320
"scope": "resource"
321321
},
322322
"C_Cpp.default.cStandard": {
@@ -330,7 +330,7 @@
330330
"c11"
331331
],
332332
"default": null,
333-
"description": "The value to use in a configuration if \"cStandard\" is not specified, or the values to insert if \"${default}\" is present in \"cStandard\".",
333+
"description": "The value to use in a configuration if \"cStandard\" is either not specified or set to \"${default}\".",
334334
"scope": "resource"
335335
},
336336
"C_Cpp.default.cppStandard": {
@@ -346,7 +346,7 @@
346346
"c++17"
347347
],
348348
"default": null,
349-
"description": "The value to use in a configuration if \"cppStandard\" is not specified, or the values to insert if \"${default}\" is present in \"cppStandard\".",
349+
"description": "The value to use in a configuration if \"cppStandard\" is either not specified or set to \"${default}\".",
350350
"scope": "resource"
351351
},
352352
"C_Cpp.default.browse.path": {
@@ -367,13 +367,13 @@
367367
"null"
368368
],
369369
"default": null,
370-
"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\".",
370+
"description": "The value to use in a configuration if \"browse.databaseFilename\" is either not specified or set to \"${default}\".",
371371
"scope": "resource"
372372
},
373373
"C_Cpp.default.browse.limitSymbolsToIncludedHeaders": {
374374
"type": "boolean",
375375
"default": true,
376-
"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\".",
376+
"description": "The value to use in a configuration if \"browse.limitSymbolsToIncludedHeaders\" is either not specified or set to \"${default}\".",
377377
"scope": "resource"
378378
},
379379
"C_Cpp.default.systemIncludePath": {

Extension/src/LanguageServer/client.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,14 +395,16 @@ class DefaultClient implements Client {
395395
tab_size: other.editorTabSize,
396396
intelliSenseEngine: settings.intelliSenseEngine,
397397
intelliSenseEngineFallback: settings.intelliSenseEngineFallback,
398-
defaultSystemIncludePath: settings.defaultSystemIncludePath,
399398
autocomplete: settings.autoComplete,
400399
errorSquiggles: settings.errorSquiggles,
401400
dimInactiveRegions: settings.dimInactiveRegions,
402401
loggingLevel: settings.loggingLevel,
403402
workspaceParsingPriority: settings.workspaceParsingPriority,
404403
exclusionPolicy: settings.exclusionPolicy,
405-
preferredPathSeparator: settings.preferredPathSeparator
404+
preferredPathSeparator: settings.preferredPathSeparator,
405+
default: {
406+
systemIncludePath: settings.defaultSystemIncludePath
407+
}
406408
},
407409
middleware: createProtocolFilter(this, allClients), // Only send messages directed at this client.
408410
errorHandler: {

Extension/src/LanguageServer/configurations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ export class CppProperties {
472472
throw { message: "Invalid configuration file. There must be at least one configuration present in the array." };
473473
}
474474
if (!this.configurationIncomplete && this.configurationJson && this.configurationJson.configurations &&
475-
this.CurrentConfiguration < this.configurationJson.configurations.length) {
475+
this.CurrentConfiguration >= 0 && this.CurrentConfiguration < this.configurationJson.configurations.length) {
476476
for (let i: number = 0; i < newJson.configurations.length; i++) {
477477
if (newJson.configurations[i].name === this.configurationJson.configurations[this.CurrentConfiguration].name) {
478478
this.currentConfigurationIndex.Value = i;
@@ -481,7 +481,7 @@ export class CppProperties {
481481
}
482482
}
483483
this.configurationJson = newJson;
484-
if (this.CurrentConfiguration >= newJson.configurations.length) {
484+
if (this.CurrentConfiguration < 0 || this.CurrentConfiguration >= newJson.configurations.length) {
485485
this.currentConfigurationIndex.Value = this.getConfigIndexForPlatform(newJson);
486486
}
487487

0 commit comments

Comments
 (0)