diff --git a/Extension/c_cpp_properties.schema.json b/Extension/c_cpp_properties.schema.json index d10e750cd..0a0de1972 100644 --- a/Extension/c_cpp_properties.schema.json +++ b/Extension/c_cpp_properties.schema.json @@ -142,6 +142,11 @@ "version": { "type": "integer", "description": "Version of the configuration file. This property is managed by the extension. Please do not change it." + }, + "enableConfigurationSquiggles": { + "type": "boolean", + "default": true, + "description": "Controls whether the extension will report errors detected in c_cpp_properties.json." } }, "properties": { @@ -153,6 +158,9 @@ }, "version": { "$ref": "#/definitions/version" + }, + "enableConfigurationSquiggles": { + "$ref": "#/definitions/enableConfigurationSquiggles" } }, "required": [ diff --git a/Extension/package.json b/Extension/package.json index 932a8328f..b03abc089 100644 --- a/Extension/package.json +++ b/Extension/package.json @@ -470,6 +470,15 @@ "description": "The value to use for the system include path. If set, it overrides the system include path acquired via \"compilerPath\" and \"compileCommands\" settings.", "scope": "resource" }, + "C_Cpp.default.enableConfigurationSquiggles": { + "type": [ + "boolean", + "null" + ], + "default": null, + "description": "Controls whether the extension will report errors detected in c_cpp_properties.json.", + "scope": "resource" + }, "C_Cpp.updateChannel": { "type": "string", "enum": [ @@ -1613,4 +1622,4 @@ "binaries": [] } ] -} +} \ No newline at end of file diff --git a/Extension/src/LanguageServer/configurations.ts b/Extension/src/LanguageServer/configurations.ts index a35ca065f..0d84066d5 100644 --- a/Extension/src/LanguageServer/configurations.ts +++ b/Extension/src/LanguageServer/configurations.ts @@ -42,6 +42,7 @@ export interface ConfigurationJson { configurations: Configuration[]; env?: {[key: string]: string | string[]}; version: number; + enableConfigurationSquiggles?: boolean; } export interface Configuration { @@ -699,7 +700,18 @@ export class CppProperties { } } - this.handleSquiggles(); + if (this.configurationJson.enableConfigurationSquiggles === false) { + this.diagnosticCollection.clear(); + } else if (this.configurationJson.enableConfigurationSquiggles === true) { + this.handleSquiggles(); + } else { + const settings: CppSettings = new CppSettings(this.rootUri); + if (settings.defaultEnableConfigurationSquiggles === false) { + this.diagnosticCollection.clear(); + } else { + this.handleSquiggles(); + } + } } catch (err) { vscode.window.showErrorMessage(`Failed to parse "${this.propertiesFile.fsPath}": ${err.message}`); throw err; diff --git a/Extension/src/LanguageServer/settings.ts b/Extension/src/LanguageServer/settings.ts index a42edc9c7..c3f37d772 100644 --- a/Extension/src/LanguageServer/settings.ts +++ b/Extension/src/LanguageServer/settings.ts @@ -72,6 +72,7 @@ export class CppSettings extends Settings { public get defaultDatabaseFilename(): string { return super.Section.get("default.browse.databaseFilename"); } public get defaultLimitSymbolsToIncludedHeaders(): boolean { return super.Section.get("default.browse.limitSymbolsToIncludedHeaders"); } public get defaultSystemIncludePath(): string[] { return super.Section.get("default.systemIncludePath"); } + public get defaultEnableConfigurationSquiggles(): boolean { return super.Section.get("default.enableConfigurationSquiggles"); } public toggleSetting(name: string, value1: string, value2: string): void { let value: string = super.Section.get(name);