Skip to content

Commit a88ca88

Browse files
authored
Disable Insiders updates for unsupported cases. (#5371)
* Disable Insiders updates for unsupported cases.
1 parent 9ea6727 commit a88ca88

File tree

3 files changed

+35
-16
lines changed

3 files changed

+35
-16
lines changed

Extension/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# C/C++ for Visual Studio Code Change Log
22

3+
## Version 0.27.1: April 28, 2020
4+
### Bug Fix
5+
* Disable Insiders `updateChannel` for 32-bit Linux and VS Code older than 1.43.0.
6+
37
## Version 0.27.0: March 30, 2020
48
### Enhancements
59
* Improved multi-root implementation with a single language server process and database for the entire workspace (shared between workspace folders). Fixes most [multi-root bugs](https://github.com/microsoft/vscode-cpptools/issues?q=is%3Aopen+is%3Aissue+label%3A%22Feature%3A+Multiroot%22+label%3A%22fixed+%28release+pending%29%22+milestone%3A0.27.0).

Extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "cpptools",
33
"displayName": "C/C++",
44
"description": "C/C++ IntelliSense, debugging, and code browsing.",
5-
"version": "0.27.0",
5+
"version": "0.27.1",
66
"publisher": "ms-vscode",
77
"preview": true,
88
"icon": "LanguageCCPP_color_128x.png",

Extension/src/LanguageServer/extension.ts

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ let ui: UI;
4141
let disposables: vscode.Disposable[] = [];
4242
let languageConfigurations: vscode.Disposable[] = [];
4343
let intervalTimer: NodeJS.Timer;
44+
let insiderUpdateEnabled: boolean = false;
4445
let insiderUpdateTimer: NodeJS.Timer;
46+
const insiderUpdateTimerInterval: number = 1000 * 60 * 60;
4547
let realActivationOccurred: boolean = false;
4648
let tempCommands: vscode.Disposable[] = [];
4749
let activatedPreviously: PersistentWorkspaceState<boolean>;
48-
const insiderUpdateTimerInterval: number = 1000 * 60 * 60;
4950
let buildInfoCache: BuildInfo | undefined;
5051
const taskSourceStr: string = "C/C++";
5152
const cppInstallVsixStr: string = 'C/C++: Install vsix -- ';
@@ -462,12 +463,24 @@ function realActivation(): void {
462463

463464
vcpkgDbPromise = initVcpkgDatabase();
464465

465-
if (settings.updateChannel === 'Default') {
466-
suggestInsidersChannel();
467-
} else if (settings.updateChannel === 'Insiders') {
468-
insiderUpdateTimer = global.setInterval(checkAndApplyUpdate, insiderUpdateTimerInterval, settings.updateChannel);
469-
checkAndApplyUpdate(settings.updateChannel);
470-
}
466+
PlatformInformation.GetPlatformInformation().then(info => {
467+
// Skip Insiders processing for 32-bit Linux.
468+
if (info.platform !== "linux" || info.architecture === "x86_64") {
469+
// Skip Insiders processing for VS Code newer than 1.42.1.
470+
// TODO: Change this to not require the hardcoded version to be updated.
471+
let vscodeVersion: PackageVersion = new PackageVersion(vscode.version);
472+
let minimumSupportedVersionForInsidersUpgrades: PackageVersion = new PackageVersion("1.42.1");
473+
if (vscodeVersion.isGreaterThan(minimumSupportedVersionForInsidersUpgrades, "insider")) {
474+
insiderUpdateEnabled = true;
475+
if (settings.updateChannel === 'Default') {
476+
suggestInsidersChannel();
477+
} else if (settings.updateChannel === 'Insiders') {
478+
insiderUpdateTimer = global.setInterval(checkAndApplyUpdate, insiderUpdateTimerInterval, settings.updateChannel);
479+
checkAndApplyUpdate(settings.updateChannel);
480+
}
481+
}
482+
}
483+
});
471484

472485
// Register a protocol handler to serve localized versions of the schema for c_cpp_properties.json
473486
class SchemaProvider implements vscode.TextDocumentContentProvider {
@@ -511,15 +524,17 @@ function onDidChangeSettings(event: vscode.ConfigurationChangeEvent): void {
511524
}
512525
});
513526

514-
const newUpdateChannel: string = changedActiveClientSettings['updateChannel'];
515-
if (newUpdateChannel) {
516-
if (newUpdateChannel === 'Default') {
517-
clearInterval(insiderUpdateTimer);
518-
} else if (newUpdateChannel === 'Insiders') {
519-
insiderUpdateTimer = global.setInterval(checkAndApplyUpdate, insiderUpdateTimerInterval);
520-
}
527+
if (insiderUpdateEnabled) {
528+
const newUpdateChannel: string = changedActiveClientSettings['updateChannel'];
529+
if (newUpdateChannel) {
530+
if (newUpdateChannel === 'Default') {
531+
clearInterval(insiderUpdateTimer);
532+
} else if (newUpdateChannel === 'Insiders') {
533+
insiderUpdateTimer = global.setInterval(checkAndApplyUpdate, insiderUpdateTimerInterval);
534+
}
521535

522-
checkAndApplyUpdate(newUpdateChannel);
536+
checkAndApplyUpdate(newUpdateChannel);
537+
}
523538
}
524539
}
525540

0 commit comments

Comments
 (0)