mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
vscode: make bailing out on custom serverPath more evident
This commit is contained in:
parent
7e6b1a60c3
commit
4d17152b31
2 changed files with 8 additions and 10 deletions
|
@ -45,7 +45,7 @@ export class Config {
|
||||||
/**
|
/**
|
||||||
* Either `nightly` or `YYYY-MM-DD` (i.e. `stable` release)
|
* Either `nightly` or `YYYY-MM-DD` (i.e. `stable` release)
|
||||||
*/
|
*/
|
||||||
private readonly extensionVersion: string = (() => {
|
readonly extensionReleaseTag: string = (() => {
|
||||||
const packageJsonVersion = vscode
|
const packageJsonVersion = vscode
|
||||||
.extensions
|
.extensions
|
||||||
.getExtension(this.extensionId)!
|
.getExtension(this.extensionId)!
|
||||||
|
@ -135,10 +135,8 @@ export class Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get installedExtensionUpdateChannel() {
|
get installedExtensionUpdateChannel(): UpdatesChannel {
|
||||||
if (this.serverPath !== null) return null;
|
return this.extensionReleaseTag === NIGHTLY_TAG
|
||||||
|
|
||||||
return this.extensionVersion === NIGHTLY_TAG
|
|
||||||
? UpdatesChannel.Nightly
|
? UpdatesChannel.Nightly
|
||||||
: UpdatesChannel.Stable;
|
: UpdatesChannel.Stable;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +157,7 @@ export class Config {
|
||||||
|
|
||||||
return this.createGithubReleaseSource(
|
return this.createGithubReleaseSource(
|
||||||
prebuiltBinaryName,
|
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:
|
// 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
|
// 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 updatesChannel() { return this.cfg.get("updates.channel") as UpdatesChannel; }
|
||||||
get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload") as boolean; }
|
get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload") as boolean; }
|
||||||
get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; }
|
get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; }
|
||||||
|
|
|
@ -15,6 +15,9 @@ const HEURISTIC_NIGHTLY_RELEASE_PERIOD_IN_HOURS = 25;
|
||||||
* extension version is what's needed according to `desiredUpdateChannel`.
|
* extension version is what's needed according to `desiredUpdateChannel`.
|
||||||
*/
|
*/
|
||||||
export async function ensureProperExtensionVersion(config: Config): Promise<never | void> {
|
export async function ensureProperExtensionVersion(config: Config): Promise<never | void> {
|
||||||
|
// User has built lsp server from sources, she should manage updates manually
|
||||||
|
if (config.serverPath !== null) return;
|
||||||
|
|
||||||
const currentUpdChannel = config.installedExtensionUpdateChannel;
|
const currentUpdChannel = config.installedExtensionUpdateChannel;
|
||||||
const desiredUpdChannel = config.updatesChannel;
|
const desiredUpdChannel = config.updatesChannel;
|
||||||
|
|
||||||
|
@ -23,9 +26,6 @@ export async function ensureProperExtensionVersion(config: Config): Promise<neve
|
||||||
config.installedNightlyExtensionReleaseDate.set(null);
|
config.installedNightlyExtensionReleaseDate.set(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// User has built lsp server from sources, she should manage updates manually
|
|
||||||
if (currentUpdChannel === null) return;
|
|
||||||
|
|
||||||
if (desiredUpdChannel === UpdatesChannel.Stable) {
|
if (desiredUpdChannel === UpdatesChannel.Stable) {
|
||||||
// VSCode should handle updates for stable channel
|
// VSCode should handle updates for stable channel
|
||||||
if (currentUpdChannel === UpdatesChannel.Stable) return;
|
if (currentUpdChannel === UpdatesChannel.Stable) return;
|
||||||
|
|
Loading…
Reference in a new issue