Skip to content

Commit 1bfb247

Browse files
authored
Add setting to throttle workspace parsing. (#1389)
Add workspaceParsingPriority and exclusionPolicy settings.
1 parent 0b8cdac commit 1bfb247

File tree

5 files changed

+36
-5
lines changed

5 files changed

+36
-5
lines changed

Documentation/LanguageServer/How to Contribute Changes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* `processRuntimeDependencies` handles the downloading and installation of the OS-dependent files. Downloading code exists in [packageManager.ts](../../Extension/src/packageManager.ts).
1313
* `downloadCpptoolsJsonPkg` handles the `cpptools.json`, which can be used to enable changes to occur mid-update, such as turning the `intelliSenseEngine` to `"Default"` for a certain percentage of users.
1414
* The debugger code is in the [Debugger](https://github.com/Microsoft/vscode-cpptools/Extension/src/Debugger) folder.
15-
* [LanguageServer/client.ts](../../Extension/src/LanguageServer/C_Cpp.ts) handles various language server functionality.
15+
* [LanguageServer/client.ts](../../Extension/src/LanguageServer/client.ts) handles various language server functionality.
1616
* [LanguageServer/configurations.ts](../../Extension/src/LanguageServer/configurations.ts) handles functionality related to `c_cpp_properties.json`.
1717
* [telemetry.ts](../../Extension/src/telemetry.ts): Telemetry data gets sent to either `logLanguageServerEvent` or `logDebuggerEvent`.
1818
* The Tag Parser (symbol database) doesn't automatically expand macros, so the [cpp.hint](../../Extension/cpp.hint) file contains definitions of macros that should be expanded in order for symbols to be parsed correctly.

Extension/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
# C/C++ for Visual Studio Code Change Log
22

3-
## Version 0.14.6: Janurary 2, 2017
3+
## Version 0.14.6: Janurary 16, 2017
44
* Fix tag parser failing (and continuing to fail after edits) when it shouldn't. [#1367](https://github.com/Microsoft/vscode-cpptools/issues/1367)
55
* Fix tag parser taking too long due to redundant processing. [#1288](https://github.com/Microsoft/vscode-cpptools/issues/1288)
66
* Fix debugging silently failing the 1st time if a C/C++ file isn't opened. [#1366](https://github.com/Microsoft/vscode-cpptools/issues/1366)
77
* Skip automatically adding to `files.associations` if it matches an existing glob pattern or if `C_Cpp.files.associations.autoAdd` is `false`. [#722](https://github.com/Microsoft/vscode-cpptools/issues/722)
88
* Fix extra reload message after installing with VS Code 1.19. [#1362](https://github.com/Microsoft/vscode-cpptools/issues/1362)
99
* Fix incorrect "Warning: Expected file ... is missing" message after installing on Linux. [#1334](https://github.com/Microsoft/vscode-cpptools/issues/1334)
1010
* Fix "Include file not found" messages not re-appearing after settings changes. [#1363](https://github.com/Microsoft/vscode-cpptools/issues/1363)
11+
* Performance improvements with `browse.path` parsing, and stop showing "Parsing files" when there's no actual parsing. [#1393](https://github.com/Microsoft/vscode-cpptools/issues/1393)
12+
* Fix crash when settings with the wrong type are used. [#1396](https://github.com/Microsoft/vscode-cpptools/issues/1396)
13+
* Allow semicolons in `browse.path`. [#1415](https://github.com/Microsoft/vscode-cpptools/issues/1415)
14+
* Add `C_Cpp.workspaceParsingPriority` setting to avoid using 100% CPU during parsing of workspace files.
15+
* Add `C_Cpp.exclusionPolicy` default to `checkFolders` to avoid expensive `files.exclude` checking on every file.
1116

1217
## Version 0.14.5: December 18, 2017
1318
* Fix for stackwalk `NullReferenceException`. [#1339](https://github.com/Microsoft/vscode-cpptools/issues/1339)

Extension/package.json

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,28 @@
172172
"default": true,
173173
"description": "Controls whether files are automatically added to files.associations when they are the target of a navigation operation from a C/C++ file.",
174174
"scope": "resource"
175+
},
176+
"C_Cpp.workspaceParsingPriority": {
177+
"type": "string",
178+
"enum": [
179+
"highest",
180+
"high",
181+
"normal",
182+
"low"
183+
],
184+
"default": "normal",
185+
"description": "Controls whether parsing of the non-active workspace files uses sleeps to avoid using 100% CPU. The values highest/high/normal/low correspond to approximately 100/75/50/25% CPU usage.",
186+
"scope": "resource"
187+
},
188+
"C_Cpp.exclusionPolicy": {
189+
"type": "string",
190+
"enum": [
191+
"checkFolders",
192+
"checkFilesAndFolders"
193+
],
194+
"default": "checkFolders",
195+
"description": "Instructs the extension when to use the \"files.exclude\" setting when determining which files should be added to the code navigation database while traversing through the paths in the \"browse.path\" array. \"checkFolders\" means that the exclusion filters will only be evaluated once per folder (individual files are not checked). \"checkFilesAndFolders\" means that the exclusion filters will be evaluated against every file and folder encountered. If your \"files.exclude\" setting only contains folders, then \"checkFolders\" is the best choice and will increase the speed at which the extension can initialize the code navigation database.",
196+
"scope": "resource"
175197
}
176198
}
177199
},
@@ -1048,7 +1070,7 @@
10481070
"tmp": "~0.0.33",
10491071
"vscode-debugadapter": "~1.24.0",
10501072
"vscode-debugprotocol": "~1.24.0",
1051-
"vscode-extension-telemetry": "~0.0.8",
1073+
"vscode-extension-telemetry": "~0.0.10",
10521074
"vscode-languageclient": "~3.4.5",
10531075
"yauzl": "~2.8.0"
10541076
},

Extension/src/LanguageServer/client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,9 @@ class DefaultClient implements Client {
329329
intelliSenseEngineFallback: settings.intelliSenseEngineFallback,
330330
autocomplete: settings.autoComplete,
331331
errorSquiggles: settings.errorSquiggles,
332-
loggingLevel: settings.loggingLevel
332+
loggingLevel: settings.loggingLevel,
333+
workspaceParsingPriority: settings.workspaceParsingPriority,
334+
exclusionPolicy: settings.exclusionPolicy
333335
},
334336
middleware: createProtocolFilter(this, allClients), // Only send messages directed at this client.
335337
errorHandler: {

Extension/src/LanguageServer/settings.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class CppSettings extends Settings {
2828
constructor(resource?: vscode.Uri) {
2929
super("C_Cpp", resource);
3030
}
31-
31+
3232
public get clangFormatPath(): string { return super.Section.get<string>("clang_format_path"); }
3333
public get clangFormatStyle(): string { return super.Section.get<string>("clang_format_style"); }
3434
public get clangFormatFallbackStyle(): string { return super.Section.get<string>("clang_format_fallbackStyle"); }
@@ -42,6 +42,8 @@ export class CppSettings extends Settings {
4242
public get loggingLevel(): string { return super.Section.get<string>("loggingLevel"); }
4343
public get navigationLength(): number { return super.Section.get<number>("navigation.length", 60); }
4444
public get filesAssociationsAutoAdd(): boolean { return super.Section.get<boolean>("files.associations.autoAdd"); }
45+
public get workspaceParsingPriority(): boolean { return super.Section.get<boolean>("workspaceParsingPriority"); }
46+
public get exclusionPolicy(): boolean { return super.Section.get<boolean>("exclusionPolicy"); }
4547

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

0 commit comments

Comments
 (0)