Skip to content

Commit e52fdd5

Browse files
authored
Fix C_Cpp.default.configurationProvider changes not taking effect. (#5043)
* Fix C_Cpp.default.configurationProvider changes not taking effect.
1 parent dfe7ff3 commit e52fdd5

File tree

5 files changed

+20
-18
lines changed

5 files changed

+20
-18
lines changed

Extension/.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ module.exports = {
127127
"typedef": [
128128
true,
129129
"variable-declaration",
130-
"call-signature"
130+
"call-signature",
131+
"variable-declaration-ignore-function"
131132
],
132133
"whitespace": [
133134
true,

Extension/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@
459459
* Don't show `includePath` code actions if compile commands or custom configuration providers are used. [#2334](https://github.com/Microsoft/vscode-cpptools/issues/2334)
460460
* Fix `C_Cpp.clang_format_path` not accepting environment variables. [#2344](https://github.com/Microsoft/vscode-cpptools/issues/2344)
461461
* Fix IntelliSense not working with non-ASCII characters in the WSL install path. [#2351](https://github.com/Microsoft/vscode-cpptools/issues/2351)
462-
* Filter out buggy IntelliSense error `"= delete" can only appear on the first declaration of a function`. [#2352](https://github.com/Microsoft/vscode-cpptools/issues/2352)
462+
* Filter out incorrect IntelliSense error `"= delete" can only appear on the first declaration of a function`. [#2352](https://github.com/Microsoft/vscode-cpptools/issues/2352)
463463
* Fix IntelliSense failing with WSL if gcc is installed bug g++ isn't. [#2360](https://github.com/Microsoft/vscode-cpptools/issues/2360)
464464
* Fix WSL paths starting with `/mnt/` failing to get symbols parsed. [#2361](https://github.com/Microsoft/vscode-cpptools/issues/2361)
465465
* Fix IntelliSense process crash when hovering over a designated initializer list with an anonymous struct. [#2370](https://github.com/Microsoft/vscode-cpptools/issues/2370)

Extension/src/LanguageServer/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ function onDidChangeTextEditorSelection(event: vscode.TextEditorSelectionChangeE
536536
}
537537

538538
if (activeDocument !== event.textEditor.document.uri.toString()) {
539-
// For some strange (buggy?) reason we don't reliably get onDidChangeActiveTextEditor callbacks.
539+
// For some unknown reason we don't reliably get onDidChangeActiveTextEditor callbacks.
540540
activeDocument = event.textEditor.document.uri.toString();
541541
clients.activeDocumentChanged(event.textEditor.document);
542542
ui.activeDocumentChanged();

Extension/src/LanguageServer/persistentState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class PersistentWorkspaceState<T> extends PersistentStateBase<T> {
5252

5353
export class PersistentFolderState<T> extends PersistentWorkspaceState<T> {
5454
constructor(key: string, defaultValue: T, folder: vscode.WorkspaceFolder) {
55-
// Check for the old (buggy) key. If found, remove it and update the new key with the old value.
55+
// Check for the old key. If found, remove it and update the new key with the old value.
5656
let old_key: string = key + (folder ? `-${path.basename(folder.uri.fsPath)}` : "-untitled");
5757
let old_val: T;
5858
if (util.extensionContext) {

Extension/src/LanguageServer/settingsTracker.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,36 +36,37 @@ export class SettingsTracker {
3636
}
3737

3838
private collectSettings(filter: FilterFunction): { [key: string]: string } {
39-
let settingsResourceScope: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp", this.resource);
40-
let settingsNonScoped: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp");
39+
const settingsResourceScope: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp", this.resource);
40+
const settingsNonScoped: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp");
41+
const selectCorrectlyScopedSettings = (rawSetting: any): vscode.WorkspaceConfiguration =>
42+
(!rawSetting || rawSetting.scope === "resource" || rawSetting.scope === "machine-overridable") ? settingsResourceScope : settingsNonScoped;
4143
let result: { [key: string]: string } = {};
4244

43-
for (let key in settingsResourceScope) {
44-
let curSetting: any = util.packageJson.contributes.configuration.properties["C_Cpp." + key];
45-
if (curSetting === undefined) {
46-
continue;
47-
}
48-
let settings: vscode.WorkspaceConfiguration = (curSetting.scope === "resource" || curSetting.scope === "machine-overridable") ? settingsResourceScope : settingsNonScoped;
49-
let val: any = this.getSetting(settings, key);
45+
for (const key in settingsResourceScope) {
46+
const rawSetting: any = util.packageJson.contributes.configuration.properties["C_Cpp." + key];
47+
const correctlyScopedSettings: vscode.WorkspaceConfiguration = selectCorrectlyScopedSettings(rawSetting);
48+
const val: any = this.getSetting(correctlyScopedSettings, key);
5049
if (val === undefined) {
5150
continue;
5251
}
5352
if (val instanceof Object && !(val instanceof Array)) {
54-
for (let subKey in val) {
55-
let newKey: string = key + "." + subKey;
56-
let subVal: any = this.getSetting(settings, newKey);
53+
for (const subKey in val) {
54+
const newKey: string = key + "." + subKey;
55+
const newRawSetting: any = util.packageJson.contributes.configuration.properties["C_Cpp." + newKey];
56+
const correctlyScopedSubSettings: vscode.WorkspaceConfiguration = selectCorrectlyScopedSettings(newRawSetting);
57+
const subVal: any = this.getSetting(correctlyScopedSubSettings, newKey);
5758
if (subVal === undefined) {
5859
continue;
5960
}
60-
let entry: KeyValuePair = this.filterAndSanitize(newKey, subVal, settings, filter);
61+
const entry: KeyValuePair = this.filterAndSanitize(newKey, subVal, correctlyScopedSubSettings, filter);
6162
if (entry && entry.key && entry.value) {
6263
result[entry.key] = entry.value;
6364
}
6465
}
6566
continue;
6667
}
6768

68-
let entry: KeyValuePair = this.filterAndSanitize(key, val, settings, filter);
69+
const entry: KeyValuePair = this.filterAndSanitize(key, val, correctlyScopedSettings, filter);
6970
if (entry && entry.key && entry.value) {
7071
result[entry.key] = entry.value;
7172
}

0 commit comments

Comments
 (0)