diff --git a/Extension/.eslintrc.js b/Extension/.eslintrc.js index 01d3dd3b95..e10caf0f72 100644 --- a/Extension/.eslintrc.js +++ b/Extension/.eslintrc.js @@ -127,7 +127,8 @@ module.exports = { "typedef": [ true, "variable-declaration", - "call-signature" + "call-signature", + "variable-declaration-ignore-function" ], "whitespace": [ true, diff --git a/Extension/CHANGELOG.md b/Extension/CHANGELOG.md index f744ad0580..8b027e0ff3 100644 --- a/Extension/CHANGELOG.md +++ b/Extension/CHANGELOG.md @@ -459,7 +459,7 @@ * Don't show `includePath` code actions if compile commands or custom configuration providers are used. [#2334](https://github.com/Microsoft/vscode-cpptools/issues/2334) * Fix `C_Cpp.clang_format_path` not accepting environment variables. [#2344](https://github.com/Microsoft/vscode-cpptools/issues/2344) * Fix IntelliSense not working with non-ASCII characters in the WSL install path. [#2351](https://github.com/Microsoft/vscode-cpptools/issues/2351) -* 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) +* 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) * Fix IntelliSense failing with WSL if gcc is installed bug g++ isn't. [#2360](https://github.com/Microsoft/vscode-cpptools/issues/2360) * Fix WSL paths starting with `/mnt/` failing to get symbols parsed. [#2361](https://github.com/Microsoft/vscode-cpptools/issues/2361) * Fix IntelliSense process crash when hovering over a designated initializer list with an anonymous struct. [#2370](https://github.com/Microsoft/vscode-cpptools/issues/2370) diff --git a/Extension/src/LanguageServer/extension.ts b/Extension/src/LanguageServer/extension.ts index ce389bd070..64807a1778 100644 --- a/Extension/src/LanguageServer/extension.ts +++ b/Extension/src/LanguageServer/extension.ts @@ -536,7 +536,7 @@ function onDidChangeTextEditorSelection(event: vscode.TextEditorSelectionChangeE } if (activeDocument !== event.textEditor.document.uri.toString()) { - // For some strange (buggy?) reason we don't reliably get onDidChangeActiveTextEditor callbacks. + // For some unknown reason we don't reliably get onDidChangeActiveTextEditor callbacks. activeDocument = event.textEditor.document.uri.toString(); clients.activeDocumentChanged(event.textEditor.document); ui.activeDocumentChanged(); diff --git a/Extension/src/LanguageServer/persistentState.ts b/Extension/src/LanguageServer/persistentState.ts index 0aefeca120..20c3c39e8d 100644 --- a/Extension/src/LanguageServer/persistentState.ts +++ b/Extension/src/LanguageServer/persistentState.ts @@ -52,7 +52,7 @@ export class PersistentWorkspaceState extends PersistentStateBase { export class PersistentFolderState extends PersistentWorkspaceState { constructor(key: string, defaultValue: T, folder: vscode.WorkspaceFolder) { - // Check for the old (buggy) key. If found, remove it and update the new key with the old value. + // Check for the old key. If found, remove it and update the new key with the old value. let old_key: string = key + (folder ? `-${path.basename(folder.uri.fsPath)}` : "-untitled"); let old_val: T; if (util.extensionContext) { diff --git a/Extension/src/LanguageServer/settingsTracker.ts b/Extension/src/LanguageServer/settingsTracker.ts index de38c31f48..0573722bea 100644 --- a/Extension/src/LanguageServer/settingsTracker.ts +++ b/Extension/src/LanguageServer/settingsTracker.ts @@ -36,28 +36,29 @@ export class SettingsTracker { } private collectSettings(filter: FilterFunction): { [key: string]: string } { - let settingsResourceScope: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp", this.resource); - let settingsNonScoped: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp"); + const settingsResourceScope: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp", this.resource); + const settingsNonScoped: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp"); + const selectCorrectlyScopedSettings = (rawSetting: any): vscode.WorkspaceConfiguration => + (!rawSetting || rawSetting.scope === "resource" || rawSetting.scope === "machine-overridable") ? settingsResourceScope : settingsNonScoped; let result: { [key: string]: string } = {}; - for (let key in settingsResourceScope) { - let curSetting: any = util.packageJson.contributes.configuration.properties["C_Cpp." + key]; - if (curSetting === undefined) { - continue; - } - let settings: vscode.WorkspaceConfiguration = (curSetting.scope === "resource" || curSetting.scope === "machine-overridable") ? settingsResourceScope : settingsNonScoped; - let val: any = this.getSetting(settings, key); + for (const key in settingsResourceScope) { + const rawSetting: any = util.packageJson.contributes.configuration.properties["C_Cpp." + key]; + const correctlyScopedSettings: vscode.WorkspaceConfiguration = selectCorrectlyScopedSettings(rawSetting); + const val: any = this.getSetting(correctlyScopedSettings, key); if (val === undefined) { continue; } if (val instanceof Object && !(val instanceof Array)) { - for (let subKey in val) { - let newKey: string = key + "." + subKey; - let subVal: any = this.getSetting(settings, newKey); + for (const subKey in val) { + const newKey: string = key + "." + subKey; + const newRawSetting: any = util.packageJson.contributes.configuration.properties["C_Cpp." + newKey]; + const correctlyScopedSubSettings: vscode.WorkspaceConfiguration = selectCorrectlyScopedSettings(newRawSetting); + const subVal: any = this.getSetting(correctlyScopedSubSettings, newKey); if (subVal === undefined) { continue; } - let entry: KeyValuePair = this.filterAndSanitize(newKey, subVal, settings, filter); + const entry: KeyValuePair = this.filterAndSanitize(newKey, subVal, correctlyScopedSubSettings, filter); if (entry && entry.key && entry.value) { result[entry.key] = entry.value; } @@ -65,7 +66,7 @@ export class SettingsTracker { continue; } - let entry: KeyValuePair = this.filterAndSanitize(key, val, settings, filter); + const entry: KeyValuePair = this.filterAndSanitize(key, val, correctlyScopedSettings, filter); if (entry && entry.key && entry.value) { result[entry.key] = entry.value; }