diff --git a/Extension/src/LanguageServer/settingsTracker.ts b/Extension/src/LanguageServer/settingsTracker.ts index 50e21a296f..765c39fbad 100644 --- a/Extension/src/LanguageServer/settingsTracker.ts +++ b/Extension/src/LanguageServer/settingsTracker.ts @@ -48,7 +48,13 @@ export class SettingsTracker { if (val === undefined) { continue; } - if (val instanceof Object && !(val instanceof Array)) { + + // Iterate through dotted "sub" settings. + const collectSettingsRecursive = (key: string, val: Object, depth: number) => { + if (depth > 4) { + // Limit settings recursion to 4 dots (not counting the first one in: `C_Cpp.`) + return; + } for (const subKey in val) { const newKey: string = key + "." + subKey; const newRawSetting: any = util.packageJson.contributes.configuration.properties["C_Cpp." + newKey]; @@ -57,11 +63,18 @@ export class SettingsTracker { if (subVal === undefined) { continue; } - const entry: KeyValuePair | undefined = this.filterAndSanitize(newKey, subVal, correctlyScopedSubSettings, filter); - if (entry && entry.key && entry.value) { - result[entry.key] = entry.value; + if (subVal instanceof Object && !(subVal instanceof Array)) { + collectSettingsRecursive(newKey, subVal, depth + 1); + } else { + const entry: KeyValuePair | undefined = this.filterAndSanitize(newKey, subVal, correctlyScopedSubSettings, filter); + if (entry && entry.key && entry.value) { + result[entry.key] = entry.value; + } } } + }; + if (val instanceof Object && !(val instanceof Array)) { + collectSettingsRecursive(key, val, 1); continue; }