Skip to content

Commit

Permalink
Add setting to throttle workspace parsing. (#1389)
Browse files Browse the repository at this point in the history
Add workspaceParsingPriority and exclusionPolicy settings.
  • Loading branch information
sean-mcmanus authored Jan 9, 2018
1 parent 0b8cdac commit 1bfb247
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Documentation/LanguageServer/How to Contribute Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* `processRuntimeDependencies` handles the downloading and installation of the OS-dependent files. Downloading code exists in [packageManager.ts](../../Extension/src/packageManager.ts).
* `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.
* The debugger code is in the [Debugger](https://github.com/Microsoft/vscode-cpptools/Extension/src/Debugger) folder.
* [LanguageServer/client.ts](../../Extension/src/LanguageServer/C_Cpp.ts) handles various language server functionality.
* [LanguageServer/client.ts](../../Extension/src/LanguageServer/client.ts) handles various language server functionality.
* [LanguageServer/configurations.ts](../../Extension/src/LanguageServer/configurations.ts) handles functionality related to `c_cpp_properties.json`.
* [telemetry.ts](../../Extension/src/telemetry.ts): Telemetry data gets sent to either `logLanguageServerEvent` or `logDebuggerEvent`.
* 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.
7 changes: 6 additions & 1 deletion Extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# C/C++ for Visual Studio Code Change Log

## Version 0.14.6: Janurary 2, 2017
## Version 0.14.6: Janurary 16, 2017
* Fix tag parser failing (and continuing to fail after edits) when it shouldn't. [#1367](https://github.com/Microsoft/vscode-cpptools/issues/1367)
* Fix tag parser taking too long due to redundant processing. [#1288](https://github.com/Microsoft/vscode-cpptools/issues/1288)
* Fix debugging silently failing the 1st time if a C/C++ file isn't opened. [#1366](https://github.com/Microsoft/vscode-cpptools/issues/1366)
* 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)
* Fix extra reload message after installing with VS Code 1.19. [#1362](https://github.com/Microsoft/vscode-cpptools/issues/1362)
* Fix incorrect "Warning: Expected file ... is missing" message after installing on Linux. [#1334](https://github.com/Microsoft/vscode-cpptools/issues/1334)
* Fix "Include file not found" messages not re-appearing after settings changes. [#1363](https://github.com/Microsoft/vscode-cpptools/issues/1363)
* 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)
* Fix crash when settings with the wrong type are used. [#1396](https://github.com/Microsoft/vscode-cpptools/issues/1396)
* Allow semicolons in `browse.path`. [#1415](https://github.com/Microsoft/vscode-cpptools/issues/1415)
* Add `C_Cpp.workspaceParsingPriority` setting to avoid using 100% CPU during parsing of workspace files.
* Add `C_Cpp.exclusionPolicy` default to `checkFolders` to avoid expensive `files.exclude` checking on every file.

## Version 0.14.5: December 18, 2017
* Fix for stackwalk `NullReferenceException`. [#1339](https://github.com/Microsoft/vscode-cpptools/issues/1339)
Expand Down
24 changes: 23 additions & 1 deletion Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,28 @@
"default": true,
"description": "Controls whether files are automatically added to files.associations when they are the target of a navigation operation from a C/C++ file.",
"scope": "resource"
},
"C_Cpp.workspaceParsingPriority": {
"type": "string",
"enum": [
"highest",
"high",
"normal",
"low"
],
"default": "normal",
"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.",
"scope": "resource"
},
"C_Cpp.exclusionPolicy": {
"type": "string",
"enum": [
"checkFolders",
"checkFilesAndFolders"
],
"default": "checkFolders",
"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.",
"scope": "resource"
}
}
},
Expand Down Expand Up @@ -1048,7 +1070,7 @@
"tmp": "~0.0.33",
"vscode-debugadapter": "~1.24.0",
"vscode-debugprotocol": "~1.24.0",
"vscode-extension-telemetry": "~0.0.8",
"vscode-extension-telemetry": "~0.0.10",
"vscode-languageclient": "~3.4.5",
"yauzl": "~2.8.0"
},
Expand Down
4 changes: 3 additions & 1 deletion Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ class DefaultClient implements Client {
intelliSenseEngineFallback: settings.intelliSenseEngineFallback,
autocomplete: settings.autoComplete,
errorSquiggles: settings.errorSquiggles,
loggingLevel: settings.loggingLevel
loggingLevel: settings.loggingLevel,
workspaceParsingPriority: settings.workspaceParsingPriority,
exclusionPolicy: settings.exclusionPolicy
},
middleware: createProtocolFilter(this, allClients), // Only send messages directed at this client.
errorHandler: {
Expand Down
4 changes: 3 additions & 1 deletion Extension/src/LanguageServer/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class CppSettings extends Settings {
constructor(resource?: vscode.Uri) {
super("C_Cpp", resource);
}

public get clangFormatPath(): string { return super.Section.get<string>("clang_format_path"); }
public get clangFormatStyle(): string { return super.Section.get<string>("clang_format_style"); }
public get clangFormatFallbackStyle(): string { return super.Section.get<string>("clang_format_fallbackStyle"); }
Expand All @@ -42,6 +42,8 @@ export class CppSettings extends Settings {
public get loggingLevel(): string { return super.Section.get<string>("loggingLevel"); }
public get navigationLength(): number { return super.Section.get<number>("navigation.length", 60); }
public get filesAssociationsAutoAdd(): boolean { return super.Section.get<boolean>("files.associations.autoAdd"); }
public get workspaceParsingPriority(): boolean { return super.Section.get<boolean>("workspaceParsingPriority"); }
public get exclusionPolicy(): boolean { return super.Section.get<boolean>("exclusionPolicy"); }

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

0 comments on commit 1bfb247

Please sign in to comment.