Skip to content

Commit 7f02d46

Browse files
author
Veetaha
committed
vscode-postrefactor: minor config refactorings
1 parent 607d017 commit 7f02d46

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

editors/code/src/config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export class Config {
3535

3636
private readonly rootSection = "rust-analyzer";
3737
private readonly requiresReloadOpts = [
38+
"serverPath",
3839
"cargoFeatures",
3940
"cargo-watch",
4041
"highlighting.semanticTokens",
@@ -50,7 +51,7 @@ export class Config {
5051
.extensions
5152
.getExtension(this.extensionId)!
5253
.packageJSON
53-
.version as string;
54+
.version as string; // n.n.YYYYMMDD[-nightly]
5455

5556
if (packageJsonVersion.endsWith(NIGHTLY_TAG)) return NIGHTLY_TAG;
5657

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

196-
get serverPath() { return this.cfg.get("serverPath") as null | string; }
197+
private get serverPath() { return this.cfg.get("serverPath") as null | string; }
197198
get updatesChannel() { return this.cfg.get("updates.channel") as UpdatesChannel; }
198199
get askBeforeDownload() { return this.cfg.get("updates.askBeforeDownload") as boolean; }
199200
get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; }

editors/code/src/installation/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { promises as fs } from 'fs';
44

55
import { vscodeReinstallExtension, vscodeReloadWindow, log, vscodeInstallExtensionFromVsix, assert, notReentrant } from "../util";
66
import { Config, UpdatesChannel } from "../config";
7-
import { ArtifactReleaseInfo } from "./interfaces";
7+
import { ArtifactReleaseInfo, ArtifactSource } from "./interfaces";
88
import { downloadArtifactWithProgressUi } from "./downloads";
99
import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info";
1010

@@ -16,7 +16,7 @@ const HEURISTIC_NIGHTLY_RELEASE_PERIOD_IN_HOURS = 25;
1616
*/
1717
export async function ensureProperExtensionVersion(config: Config): Promise<never | void> {
1818
// 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;
2020

2121
const currentUpdChannel = config.installedExtensionUpdateChannel;
2222
const desiredUpdChannel = config.updatesChannel;

0 commit comments

Comments
 (0)