aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-03-09 18:14:55 +0000
committerVeetaha <[email protected]>2020-03-14 00:01:46 +0000
commit4d17152b31b27a8c851b4b1abaff359044ee9d96 (patch)
tree6f8e3f3750c54201cd80cdc07d25c747e3f3dc4d /editors
parent7e6b1a60c3d7b20e1b4cee2ab210b617e359a002 (diff)
vscode: make bailing out on custom serverPath more evident
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/config.ts12
-rw-r--r--editors/code/src/installation/extension.ts6
2 files changed, 8 insertions, 10 deletions
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 {
45 /** 45 /**
46 * Either `nightly` or `YYYY-MM-DD` (i.e. `stable` release) 46 * Either `nightly` or `YYYY-MM-DD` (i.e. `stable` release)
47 */ 47 */
48 private readonly extensionVersion: string = (() => { 48 readonly extensionReleaseTag: string = (() => {
49 const packageJsonVersion = vscode 49 const packageJsonVersion = vscode
50 .extensions 50 .extensions
51 .getExtension(this.extensionId)! 51 .getExtension(this.extensionId)!
@@ -135,10 +135,8 @@ export class Config {
135 } 135 }
136 } 136 }
137 137
138 get installedExtensionUpdateChannel() { 138 get installedExtensionUpdateChannel(): UpdatesChannel {
139 if (this.serverPath !== null) return null; 139 return this.extensionReleaseTag === NIGHTLY_TAG
140
141 return this.extensionVersion === NIGHTLY_TAG
142 ? UpdatesChannel.Nightly 140 ? UpdatesChannel.Nightly
143 : UpdatesChannel.Stable; 141 : UpdatesChannel.Stable;
144 } 142 }
@@ -159,7 +157,7 @@ export class Config {
159 157
160 return this.createGithubReleaseSource( 158 return this.createGithubReleaseSource(
161 prebuiltBinaryName, 159 prebuiltBinaryName,
162 this.extensionVersion 160 this.extensionReleaseTag
163 ); 161 );
164 } 162 }
165 163
@@ -195,7 +193,7 @@ export class Config {
195 // We don't do runtime config validation here for simplicity. More on stackoverflow: 193 // We don't do runtime config validation here for simplicity. More on stackoverflow:
196 // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension 194 // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension
197 195
198 private get serverPath() { return this.cfg.get("serverPath") as null | string; } 196 get serverPath() { return this.cfg.get("serverPath") as null | string; }
199 get updatesChannel() { return this.cfg.get("updates.channel") as UpdatesChannel; } 197 get updatesChannel() { return this.cfg.get("updates.channel") as UpdatesChannel; }
200 get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload") as boolean; } 198 get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload") as boolean; }
201 get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; } 199 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;
15 * extension version is what's needed according to `desiredUpdateChannel`. 15 * extension version is what's needed according to `desiredUpdateChannel`.
16 */ 16 */
17export async function ensureProperExtensionVersion(config: Config): Promise<never | void> { 17export async function ensureProperExtensionVersion(config: Config): Promise<never | void> {
18 // User has built lsp server from sources, she should manage updates manually
19 if (config.serverPath !== null) return;
20
18 const currentUpdChannel = config.installedExtensionUpdateChannel; 21 const currentUpdChannel = config.installedExtensionUpdateChannel;
19 const desiredUpdChannel = config.updatesChannel; 22 const desiredUpdChannel = config.updatesChannel;
20 23
@@ -23,9 +26,6 @@ export async function ensureProperExtensionVersion(config: Config): Promise<neve
23 config.installedNightlyExtensionReleaseDate.set(null); 26 config.installedNightlyExtensionReleaseDate.set(null);
24 } 27 }
25 28
26 // User has built lsp server from sources, she should manage updates manually
27 if (currentUpdChannel === null) return;
28
29 if (desiredUpdChannel === UpdatesChannel.Stable) { 29 if (desiredUpdChannel === UpdatesChannel.Stable) {
30 // VSCode should handle updates for stable channel 30 // VSCode should handle updates for stable channel
31 if (currentUpdChannel === UpdatesChannel.Stable) return; 31 if (currentUpdChannel === UpdatesChannel.Stable) return;