aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-03-14 00:00:34 +0000
committerVeetaha <[email protected]>2020-03-14 00:01:46 +0000
commit7f02d4657b796a438e441e107d4fb1906ec1ed7b (patch)
tree6d955957f2bc85aaae4ed6e8e5ffb63014ec079f /editors/code
parent607d017229ce398bd7fef43aa5f4ab35914e6f31 (diff)
vscode-postrefactor: minor config refactorings
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/src/config.ts5
-rw-r--r--editors/code/src/installation/extension.ts4
2 files changed, 5 insertions, 4 deletions
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 {
35 35
36 private readonly rootSection = "rust-analyzer"; 36 private readonly rootSection = "rust-analyzer";
37 private readonly requiresReloadOpts = [ 37 private readonly requiresReloadOpts = [
38 "serverPath",
38 "cargoFeatures", 39 "cargoFeatures",
39 "cargo-watch", 40 "cargo-watch",
40 "highlighting.semanticTokens", 41 "highlighting.semanticTokens",
@@ -50,7 +51,7 @@ export class Config {
50 .extensions 51 .extensions
51 .getExtension(this.extensionId)! 52 .getExtension(this.extensionId)!
52 .packageJSON 53 .packageJSON
53 .version as string; 54 .version as string; // n.n.YYYYMMDD[-nightly]
54 55
55 if (packageJsonVersion.endsWith(NIGHTLY_TAG)) return NIGHTLY_TAG; 56 if (packageJsonVersion.endsWith(NIGHTLY_TAG)) return NIGHTLY_TAG;
56 57
@@ -193,7 +194,7 @@ export class Config {
193 // We don't do runtime config validation here for simplicity. More on stackoverflow: 194 // We don't do runtime config validation here for simplicity. More on stackoverflow:
194 // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension 195 // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension
195 196
196 get serverPath() { return this.cfg.get("serverPath") as null | string; } 197 private get serverPath() { return this.cfg.get("serverPath") as null | string; }
197 get updatesChannel() { return this.cfg.get("updates.channel") as UpdatesChannel; } 198 get updatesChannel() { return this.cfg.get("updates.channel") as UpdatesChannel; }
198 get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload") as boolean; } 199 get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload") as boolean; }
199 get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; } 200 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';
4 4
5import { vscodeReinstallExtension, vscodeReloadWindow, log, vscodeInstallExtensionFromVsix, assert, notReentrant } from "../util"; 5import { vscodeReinstallExtension, vscodeReloadWindow, log, vscodeInstallExtensionFromVsix, assert, notReentrant } from "../util";
6import { Config, UpdatesChannel } from "../config"; 6import { Config, UpdatesChannel } from "../config";
7import { ArtifactReleaseInfo } from "./interfaces"; 7import { ArtifactReleaseInfo, ArtifactSource } from "./interfaces";
8import { downloadArtifactWithProgressUi } from "./downloads"; 8import { downloadArtifactWithProgressUi } from "./downloads";
9import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; 9import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info";
10 10
@@ -16,7 +16,7 @@ const HEURISTIC_NIGHTLY_RELEASE_PERIOD_IN_HOURS = 25;
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 18 // User has built lsp server from sources, she should manage updates manually
19 if (config.serverPath !== null) return; 19 if (config.serverSource?.type === ArtifactSource.Type.ExplicitPath) return;
20 20
21 const currentUpdChannel = config.installedExtensionUpdateChannel; 21 const currentUpdChannel = config.installedExtensionUpdateChannel;
22 const desiredUpdChannel = config.updatesChannel; 22 const desiredUpdChannel = config.updatesChannel;