Skip to content

Commit 297bada

Browse files
authored
Fix Insider channel not auto-downgrading after an Insider vsix is unpublished. (#4765)
* Fix Insider channel not auto-downgrading after an Insider vsix is unpublished.
1 parent 336c529 commit 297bada

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

Extension/CHANGELOG.md

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

3+
## Version 0.26.3-insiders2: December 18, 2019
4+
### Bug Fixes
5+
* Fix IntelliSense regression crashes. [#4754](https://github.com/microsoft/vscode-cpptools/issues/4754)
6+
* Fix Insiders channel not auto-downgrading after an Insiders vsix is unpublished. [#4760](https://github.com/microsoft/vscode-cpptools/issues/4760)
7+
38
## Version 0.26.3-insiders: December 16, 2019
49
### Bug Fixes
510
* Fix clang-cl detection for system includes and defines.

Extension/src/githubAPI.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export async function getTargetBuildInfo(updateChannel: string): Promise<BuildIn
142142
// Allows testing pre-releases without accidentally downgrading to the latest version
143143
const userVersion: PackageVersion = new PackageVersion(util.packageJson.version);
144144
const latestVersion: PackageVersion = new PackageVersion(builds[0].name);
145-
if (!testingInsidersVsixInstall && (userVersion.isGreaterThan(latestVersion) || (userVersion.suffix && userVersion.suffix !== 'insiders'))) {
145+
if (!testingInsidersVsixInstall && ((userVersion.suffix && userVersion.suffix !== 'insiders') || (userVersion.isEqual(latestVersion)))) {
146146
return undefined;
147147
}
148148

@@ -179,7 +179,7 @@ function getTargetBuild(builds: Build[], userVersion: PackageVersion, updateChan
179179
let needsUpdate: (installed: PackageVersion, target: PackageVersion) => boolean;
180180
let useBuild: (build: Build) => boolean;
181181
if (updateChannel === 'Insiders') {
182-
needsUpdate = (installed: PackageVersion, target: PackageVersion) => testingInsidersVsixInstall || target.isGreaterThan(installed);
182+
needsUpdate = (installed: PackageVersion, target: PackageVersion) => testingInsidersVsixInstall || (!target.isEqual(installed));
183183
useBuild = (build: Build): boolean => true;
184184
} else if (updateChannel === 'Default') {
185185
needsUpdate = function(installed: PackageVersion, target: PackageVersion): boolean { return installed.isGreaterThan(target); };

Extension/src/packageVersion.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ export class PackageVersion {
4040
}
4141
}
4242

43+
public isEqual(other: PackageVersion): boolean {
44+
return this.major === other.major && this.minor === other.minor && this.patch === other.patch &&
45+
this.suffix === other.suffix && this.suffixVersion === other.suffixVersion;
46+
}
47+
4348
public isGreaterThan(other: PackageVersion, suffixStr: string = 'insiders'): boolean {
4449
if ((this.suffix && !this.suffix.startsWith(suffixStr)) || (other.suffix && !other.suffix.startsWith(suffixStr))) {
4550
return false;

0 commit comments

Comments
 (0)