Skip to content

Commit 34d8874

Browse files
authored
Seanmcm/disable cpp squiggles (#3405)
* Add enableConfigurationSquiggles.
1 parent 0773ec8 commit 34d8874

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

Extension/c_cpp_properties.schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@
142142
"version": {
143143
"type": "integer",
144144
"description": "Version of the configuration file. This property is managed by the extension. Please do not change it."
145+
},
146+
"enableConfigurationSquiggles": {
147+
"type": "boolean",
148+
"default": true,
149+
"description": "Controls whether the extension will report errors detected in c_cpp_properties.json."
145150
}
146151
},
147152
"properties": {
@@ -153,6 +158,9 @@
153158
},
154159
"version": {
155160
"$ref": "#/definitions/version"
161+
},
162+
"enableConfigurationSquiggles": {
163+
"$ref": "#/definitions/enableConfigurationSquiggles"
156164
}
157165
},
158166
"required": [

Extension/package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,15 @@
470470
"description": "The value to use for the system include path. If set, it overrides the system include path acquired via \"compilerPath\" and \"compileCommands\" settings.",
471471
"scope": "resource"
472472
},
473+
"C_Cpp.default.enableConfigurationSquiggles": {
474+
"type": [
475+
"boolean",
476+
"null"
477+
],
478+
"default": null,
479+
"description": "Controls whether the extension will report errors detected in c_cpp_properties.json.",
480+
"scope": "resource"
481+
},
473482
"C_Cpp.updateChannel": {
474483
"type": "string",
475484
"enum": [
@@ -1613,4 +1622,4 @@
16131622
"binaries": []
16141623
}
16151624
]
1616-
}
1625+
}

Extension/src/LanguageServer/configurations.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export interface ConfigurationJson {
4242
configurations: Configuration[];
4343
env?: {[key: string]: string | string[]};
4444
version: number;
45+
enableConfigurationSquiggles?: boolean;
4546
}
4647

4748
export interface Configuration {
@@ -699,7 +700,18 @@ export class CppProperties {
699700
}
700701
}
701702

702-
this.handleSquiggles();
703+
if (this.configurationJson.enableConfigurationSquiggles === false) {
704+
this.diagnosticCollection.clear();
705+
} else if (this.configurationJson.enableConfigurationSquiggles === true) {
706+
this.handleSquiggles();
707+
} else {
708+
const settings: CppSettings = new CppSettings(this.rootUri);
709+
if (settings.defaultEnableConfigurationSquiggles === false) {
710+
this.diagnosticCollection.clear();
711+
} else {
712+
this.handleSquiggles();
713+
}
714+
}
703715
} catch (err) {
704716
vscode.window.showErrorMessage(`Failed to parse "${this.propertiesFile.fsPath}": ${err.message}`);
705717
throw err;

Extension/src/LanguageServer/settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export class CppSettings extends Settings {
7272
public get defaultDatabaseFilename(): string { return super.Section.get<string>("default.browse.databaseFilename"); }
7373
public get defaultLimitSymbolsToIncludedHeaders(): boolean { return super.Section.get<boolean>("default.browse.limitSymbolsToIncludedHeaders"); }
7474
public get defaultSystemIncludePath(): string[] { return super.Section.get<string[]>("default.systemIncludePath"); }
75+
public get defaultEnableConfigurationSquiggles(): boolean { return super.Section.get<boolean>("default.enableConfigurationSquiggles"); }
7576

7677
public toggleSetting(name: string, value1: string, value2: string): void {
7778
let value: string = super.Section.get<string>(name);

0 commit comments

Comments
 (0)