11import * as os from "os" ;
22import * as vscode from 'vscode' ;
33import { ArtifactSource } from "./installation/interfaces" ;
4- import { log } from "./util" ;
4+ import { log , vscodeReloadWindow } from "./util" ;
55
66const RA_LSP_DEBUG = process . env . __RA_LSP_SERVER_DEBUG ;
77
@@ -43,20 +43,20 @@ export class Config {
4343 ]
4444 . map ( opt => `${ this . rootSection } .${ opt } ` ) ;
4545
46+ readonly packageJsonVersion = vscode
47+ . extensions
48+ . getExtension ( this . extensionId ) !
49+ . packageJSON
50+ . version as string ; // n.n.YYYYMMDD[-nightly]
51+
4652 /**
4753 * Either `nightly` or `YYYY-MM-DD` (i.e. `stable` release)
4854 */
4955 readonly extensionReleaseTag : string = ( ( ) => {
50- const packageJsonVersion = vscode
51- . extensions
52- . getExtension ( this . extensionId ) !
53- . packageJSON
54- . version as string ; // n.n.YYYYMMDD[-nightly]
55-
56- if ( packageJsonVersion . endsWith ( NIGHTLY_TAG ) ) return NIGHTLY_TAG ;
56+ if ( this . packageJsonVersion . endsWith ( NIGHTLY_TAG ) ) return NIGHTLY_TAG ;
5757
5858 const realVersionRegexp = / ^ \d + \. \d + \. ( \d { 4 } ) ( \d { 2 } ) ( \d { 2 } ) / ;
59- const [ , yyyy , mm , dd ] = packageJsonVersion . match ( realVersionRegexp ) ! ;
59+ const [ , yyyy , mm , dd ] = this . packageJsonVersion . match ( realVersionRegexp ) ! ;
6060
6161 return `${ yyyy } -${ mm } -${ dd } ` ;
6262 } ) ( ) ;
@@ -72,7 +72,10 @@ export class Config {
7272 this . cfg = vscode . workspace . getConfiguration ( this . rootSection ) ;
7373 const enableLogging = this . cfg . get ( "trace.extension" ) as boolean ;
7474 log . setEnabled ( enableLogging ) ;
75- log . debug ( "Using configuration:" , this . cfg ) ;
75+ log . debug (
76+ "Extension version:" , this . packageJsonVersion ,
77+ "using configuration:" , this . cfg
78+ ) ;
7679 }
7780
7881 private async onConfigChange ( event : vscode . ConfigurationChangeEvent ) {
@@ -90,7 +93,7 @@ export class Config {
9093 ) ;
9194
9295 if ( userResponse === "Reload now" ) {
93- vscode . commands . executeCommand ( "workbench.action.reloadWindow" ) ;
96+ await vscodeReloadWindow ( ) ;
9497 }
9598 }
9699
@@ -180,16 +183,11 @@ export class Config {
180183 }
181184
182185 readonly installedNightlyExtensionReleaseDate = new DateStorage (
183- "rust-analyzer- installed-nightly-extension-release-date" ,
186+ "installed-nightly-extension-release-date" ,
184187 this . ctx . globalState
185188 ) ;
186- readonly serverReleaseDate = new DateStorage (
187- "rust-analyzer-server-release-date" ,
188- this . ctx . globalState
189- ) ;
190- readonly serverReleaseTag = new Storage < null | string > (
191- "rust-analyzer-release-tag" , this . ctx . globalState , null
192- ) ;
189+ readonly serverReleaseDate = new DateStorage ( "server-release-date" , this . ctx . globalState ) ;
190+ readonly serverReleaseTag = new Storage < null | string > ( "server-release-tag" , this . ctx . globalState , null ) ;
193191
194192 // We don't do runtime config validation here for simplicity. More on stackoverflow:
195193 // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension
0 commit comments