Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion Extension/src/LanguageServer/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { Range } from 'vscode-languageclient';
import { ChildProcess, spawn, execSync } from 'child_process';
import * as tmp from 'tmp';
import { getTargetBuildInfo } from '../githubAPI';
import { PackageVersion } from '../packageVersion';

let prevCrashFile: string;
let clients: ClientCollection;
Expand Down Expand Up @@ -266,7 +267,25 @@ async function installVsix(vsixLocation: string, updateChannel: string): Promise
return Promise.reject(new Error('Failed to find VS Code script'));
}

// Install the VSIX
// 1.28.0 changes the CLI for making installations
let userVersion: PackageVersion = new PackageVersion(vscode.version);
let breakingVersion: PackageVersion = new PackageVersion('1.28.0');
if (userVersion.isGreaterThan(breakingVersion, 'insider')) {
return new Promise<void>((resolve, reject) => {
let process: ChildProcess;
try {
process = spawn(vsCodeScriptPath, ['--install-extension', vsixLocation, '--force']);
if (process.pid === undefined) {
throw new Error();
}
} catch (error) {
reject(new Error('Failed to launch VS Code script process for installation'));
return;
}
resolve();
});
}

return new Promise<void>((resolve, reject) => {
let process: ChildProcess;
try {
Expand Down
5 changes: 2 additions & 3 deletions Extension/src/packageVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ export class PackageVersion {
}
}

public isGreaterThan(other: PackageVersion): boolean {
// PackageVersions cannot be compared if either have a suffix that is not 'insiders'
if ((this.suffix && !this.suffix.startsWith('insiders')) || (other.suffix && !other.suffix.startsWith('insiders'))) {
public isGreaterThan(other: PackageVersion, suffixStr: string = 'insiders'): boolean {
if ((this.suffix && !this.suffix.startsWith(suffixStr)) || (other.suffix && !other.suffix.startsWith(suffixStr))) {
return false;
}

Expand Down