Skip to content

Commit bc721d3

Browse files
authored
Fix delay in language service activation caused by cpptools.json downloading. (#1433)
* Prevent downloadCpptoolsJsonPkg from delaying activation. * Also, changed the default workspaceParsingPriority to "highest" and the "normal" enum to "medium". * And updated the changelog.
1 parent 5885388 commit bc721d3

File tree

3 files changed

+28
-23
lines changed

3 files changed

+28
-23
lines changed

Extension/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
* 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)
1212
* Fix crash when settings with the wrong type are used. [#1396](https://github.com/Microsoft/vscode-cpptools/issues/1396)
1313
* 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.
14+
* Fix to handle relative pathing in source file paths properly when normalizing. [#1228](https://github.com/Microsoft/vscode-cpptools/issues/1228)
15+
* Fix delay in language service activation caused by cpptools.json downloading. [#1429](https://github.com/Microsoft/vscode-cpptools/issues/1429)
16+
* Add `C_Cpp.workspaceParsingPriority` setting to enable using less than 100% CPU during parsing of workspace files.
1517
* Add `C_Cpp.exclusionPolicy` default to `checkFolders` to avoid expensive `files.exclude` checking on every file.
1618

1719
## Version 0.14.5: December 18, 2017

Extension/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@
178178
"enum": [
179179
"highest",
180180
"high",
181-
"normal",
181+
"medium",
182182
"low"
183183
],
184-
"default": "normal",
184+
"default": "highest",
185185
"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.",
186186
"scope": "resource"
187187
},

Extension/src/main.ts

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -138,27 +138,30 @@ export function activate(context: vscode.ExtensionContext): void {
138138
registerTempCommand("C_Cpp.TakeSurvey");
139139

140140
processRuntimeDependencies(() => {
141-
downloadCpptoolsJsonPkg().then(() => {
142-
util.readFileText(util.getExtensionFilePath("cpptools.json"))
143-
.then((cpptoolsString) => {
144-
processCpptoolsJson(cpptoolsString);
145-
})
146-
.catch((error) => {
147-
// We already log telemetry if cpptools.json fails to download.
148-
})
149-
.then(() => {
150-
// Main activation code.
151-
tempCommands.forEach((command) => {
152-
command.dispose();
153-
});
154-
tempCommands = [];
155-
LanguageServer.activate(delayedCommandsToExecute);
156-
delayedCommandsToExecute.forEach((command) => {
157-
vscode.commands.executeCommand(command);
158-
});
159-
delayedCommandsToExecute.clear();
141+
util.readFileText(util.getExtensionFilePath("cpptools.json"))
142+
.then((cpptoolsString) => {
143+
processCpptoolsJson(cpptoolsString);
144+
})
145+
.catch((error) => {
146+
// We already log telemetry if cpptools.json fails to download.
147+
})
148+
.then(() => {
149+
// Main activation code.
150+
tempCommands.forEach((command) => {
151+
command.dispose();
160152
});
161-
});
153+
tempCommands = [];
154+
LanguageServer.activate(delayedCommandsToExecute);
155+
delayedCommandsToExecute.forEach((command) => {
156+
vscode.commands.executeCommand(command);
157+
});
158+
delayedCommandsToExecute.clear();
159+
})
160+
.then(() => {
161+
// Redownload cpptools.json after activation so it's not blocked.
162+
// It'll be used after the extension reloads.
163+
downloadCpptoolsJsonPkg();
164+
});
162165
});
163166

164167
setInterval(() => {

0 commit comments

Comments
 (0)