From 7f02d4657b796a438e441e107d4fb1906ec1ed7b Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 14 Mar 2020 02:00:34 +0200 Subject: vscode-postrefactor: minor config refactorings --- editors/code/src/config.ts | 5 +++-- editors/code/src/installation/extension.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'editors') diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 5371384ba..93f72409d 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -35,6 +35,7 @@ export class Config { private readonly rootSection = "rust-analyzer"; private readonly requiresReloadOpts = [ + "serverPath", "cargoFeatures", "cargo-watch", "highlighting.semanticTokens", @@ -50,7 +51,7 @@ export class Config { .extensions .getExtension(this.extensionId)! .packageJSON - .version as string; + .version as string; // n.n.YYYYMMDD[-nightly] if (packageJsonVersion.endsWith(NIGHTLY_TAG)) return NIGHTLY_TAG; @@ -193,7 +194,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 - get serverPath() { return this.cfg.get("serverPath") as null | string; } + private 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 87a587403..2022d090d 100644 --- a/editors/code/src/installation/extension.ts +++ b/editors/code/src/installation/extension.ts @@ -4,7 +4,7 @@ import { promises as fs } from 'fs'; import { vscodeReinstallExtension, vscodeReloadWindow, log, vscodeInstallExtensionFromVsix, assert, notReentrant } from "../util"; import { Config, UpdatesChannel } from "../config"; -import { ArtifactReleaseInfo } from "./interfaces"; +import { ArtifactReleaseInfo, ArtifactSource } from "./interfaces"; import { downloadArtifactWithProgressUi } from "./downloads"; import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; @@ -16,7 +16,7 @@ const HEURISTIC_NIGHTLY_RELEASE_PERIOD_IN_HOURS = 25; */ export async function ensureProperExtensionVersion(config: Config): Promise { // User has built lsp server from sources, she should manage updates manually - if (config.serverPath !== null) return; + if (config.serverSource?.type === ArtifactSource.Type.ExplicitPath) return; const currentUpdChannel = config.installedExtensionUpdateChannel; const desiredUpdChannel = config.updatesChannel; -- cgit v1.2.3