diff options
Diffstat (limited to 'editors/code/src/config.ts')
-rw-r--r-- | editors/code/src/config.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 7866ed7e1..4335c3a71 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -24,6 +24,19 @@ export class Config { | |||
24 | ] | 24 | ] |
25 | .map(opt => `${Config.rootSection}.${opt}`); | 25 | .map(opt => `${Config.rootSection}.${opt}`); |
26 | 26 | ||
27 | private static readonly extensionVersion: string = (() => { | ||
28 | const packageJsonVersion = vscode | ||
29 | .extensions | ||
30 | .getExtension("matklad.rust-analyzer")! | ||
31 | .packageJSON | ||
32 | .version as string; // n.n.YYYYMMDD | ||
33 | |||
34 | const realVersionRegexp = /^\d+\.\d+\.(\d{4})(\d{2})(\d{2})/; | ||
35 | const [, yyyy, mm, dd] = packageJsonVersion.match(realVersionRegexp)!; | ||
36 | |||
37 | return `${yyyy}-${mm}-${dd}`; | ||
38 | })(); | ||
39 | |||
27 | private cfg!: vscode.WorkspaceConfiguration; | 40 | private cfg!: vscode.WorkspaceConfiguration; |
28 | 41 | ||
29 | constructor(private readonly ctx: vscode.ExtensionContext) { | 42 | constructor(private readonly ctx: vscode.ExtensionContext) { |
@@ -98,7 +111,7 @@ export class Config { | |||
98 | } | 111 | } |
99 | } | 112 | } |
100 | 113 | ||
101 | get serverBinarySource(): null | BinarySource { | 114 | get serverSource(): null | BinarySource { |
102 | const serverPath = RA_LSP_DEBUG ?? this.cfg.get<null | string>("raLspServerPath"); | 115 | const serverPath = RA_LSP_DEBUG ?? this.cfg.get<null | string>("raLspServerPath"); |
103 | 116 | ||
104 | if (serverPath) { | 117 | if (serverPath) { |
@@ -116,6 +129,8 @@ export class Config { | |||
116 | type: BinarySource.Type.GithubRelease, | 129 | type: BinarySource.Type.GithubRelease, |
117 | dir: this.ctx.globalStoragePath, | 130 | dir: this.ctx.globalStoragePath, |
118 | file: prebuiltBinaryName, | 131 | file: prebuiltBinaryName, |
132 | storage: this.ctx.globalState, | ||
133 | version: Config.extensionVersion, | ||
119 | repo: { | 134 | repo: { |
120 | name: "rust-analyzer", | 135 | name: "rust-analyzer", |
121 | owner: "rust-analyzer", | 136 | owner: "rust-analyzer", |