From 4d17152b31b27a8c851b4b1abaff359044ee9d96 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 9 Mar 2020 20:14:55 +0200 Subject: vscode: make bailing out on custom serverPath more evident --- editors/code/src/config.ts | 12 +++++------- editors/code/src/installation/extension.ts | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'editors/code/src') diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index b5c07876b..345c9e21a 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -45,7 +45,7 @@ export class Config { /** * Either `nightly` or `YYYY-MM-DD` (i.e. `stable` release) */ - private readonly extensionVersion: string = (() => { + readonly extensionReleaseTag: string = (() => { const packageJsonVersion = vscode .extensions .getExtension(this.extensionId)! @@ -135,10 +135,8 @@ export class Config { } } - get installedExtensionUpdateChannel() { - if (this.serverPath !== null) return null; - - return this.extensionVersion === NIGHTLY_TAG + get installedExtensionUpdateChannel(): UpdatesChannel { + return this.extensionReleaseTag === NIGHTLY_TAG ? UpdatesChannel.Nightly : UpdatesChannel.Stable; } @@ -159,7 +157,7 @@ export class Config { return this.createGithubReleaseSource( prebuiltBinaryName, - this.extensionVersion + this.extensionReleaseTag ); } @@ -195,7 +193,7 @@ export class Config { // We don't do runtime config validation here for simplicity. More on stackoverflow: // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension - private get serverPath() { return this.cfg.get("serverPath") as null | string; } + get serverPath() { return this.cfg.get("serverPath") as null | string; } get updatesChannel() { return this.cfg.get("updates.channel") as UpdatesChannel; } get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload") as boolean; } get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; } diff --git a/editors/code/src/installation/extension.ts b/editors/code/src/installation/extension.ts index 7eab68852..a0925acaa 100644 --- a/editors/code/src/installation/extension.ts +++ b/editors/code/src/installation/extension.ts @@ -15,6 +15,9 @@ const HEURISTIC_NIGHTLY_RELEASE_PERIOD_IN_HOURS = 25; * extension version is what's needed according to `desiredUpdateChannel`. */ export async function ensureProperExtensionVersion(config: Config): Promise { + // User has built lsp server from sources, she should manage updates manually + if (config.serverPath !== null) return; + const currentUpdChannel = config.installedExtensionUpdateChannel; const desiredUpdChannel = config.updatesChannel; @@ -23,9 +26,6 @@ export async function ensureProperExtensionVersion(config: Config): Promise