Skip to content

Commit 4d17152

Browse files
author
Veetaha
committed
vscode: make bailing out on custom serverPath more evident
1 parent 7e6b1a6 commit 4d17152

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

editors/code/src/config.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class Config {
4545
/**
4646
* Either `nightly` or `YYYY-MM-DD` (i.e. `stable` release)
4747
*/
48-
private readonly extensionVersion: string = (() => {
48+
readonly extensionReleaseTag: string = (() => {
4949
const packageJsonVersion = vscode
5050
.extensions
5151
.getExtension(this.extensionId)!
@@ -135,10 +135,8 @@ export class Config {
135135
}
136136
}
137137

138-
get installedExtensionUpdateChannel() {
139-
if (this.serverPath !== null) return null;
140-
141-
return this.extensionVersion === NIGHTLY_TAG
138+
get installedExtensionUpdateChannel(): UpdatesChannel {
139+
return this.extensionReleaseTag === NIGHTLY_TAG
142140
? UpdatesChannel.Nightly
143141
: UpdatesChannel.Stable;
144142
}
@@ -159,7 +157,7 @@ export class Config {
159157

160158
return this.createGithubReleaseSource(
161159
prebuiltBinaryName,
162-
this.extensionVersion
160+
this.extensionReleaseTag
163161
);
164162
}
165163

@@ -195,7 +193,7 @@ export class Config {
195193
// We don't do runtime config validation here for simplicity. More on stackoverflow:
196194
// https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension
197195

198-
private get serverPath() { return this.cfg.get("serverPath") as null | string; }
196+
get serverPath() { return this.cfg.get("serverPath") as null | string; }
199197
get updatesChannel() { return this.cfg.get("updates.channel") as UpdatesChannel; }
200198
get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload") as boolean; }
201199
get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; }

editors/code/src/installation/extension.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ const HEURISTIC_NIGHTLY_RELEASE_PERIOD_IN_HOURS = 25;
1515
* extension version is what's needed according to `desiredUpdateChannel`.
1616
*/
1717
export 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+
1821
const currentUpdChannel = config.installedExtensionUpdateChannel;
1922
const desiredUpdChannel = config.updatesChannel;
2023

@@ -23,9 +26,6 @@ export async function ensureProperExtensionVersion(config: Config): Promise<neve
2326
config.installedNightlyExtensionReleaseDate.set(null);
2427
}
2528

26-
// User has built lsp server from sources, she should manage updates manually
27-
if (currentUpdChannel === null) return;
28-
2929
if (desiredUpdChannel === UpdatesChannel.Stable) {
3030
// VSCode should handle updates for stable channel
3131
if (currentUpdChannel === UpdatesChannel.Stable) return;

0 commit comments

Comments
 (0)