@@ -19,14 +19,18 @@ export class Config {
1919 configureLang : vscode . Disposable | undefined ;
2020
2121 readonly rootSection = "rust-analyzer" ;
22- private readonly requiresReloadOpts = [
22+ private readonly requiresServerReloadOpts = [
2323 "cargo" ,
2424 "procMacro" ,
2525 "serverPath" ,
2626 "server" ,
2727 "files" ,
2828 ] . map ( ( opt ) => `${ this . rootSection } .${ opt } ` ) ;
2929
30+ private readonly requiresWindowReloadOpts = [ "testExplorer" ] . map (
31+ ( opt ) => `${ this . rootSection } .${ opt } ` ,
32+ ) ;
33+
3034 readonly package : {
3135 version : string ;
3236 releaseTag : string | null ;
@@ -66,18 +70,31 @@ export class Config {
6670
6771 this . configureLanguage ( ) ;
6872
69- const requiresReloadOpt = this . requiresReloadOpts . find ( ( opt ) =>
73+ const requiresWindowReloadOpt = this . requiresWindowReloadOpts . find ( ( opt ) =>
74+ event . affectsConfiguration ( opt ) ,
75+ ) ;
76+
77+ if ( requiresWindowReloadOpt ) {
78+ const message = `Changing "${ requiresWindowReloadOpt } " requires a window reload` ;
79+ const userResponse = await vscode . window . showInformationMessage ( message , "Reload now" ) ;
80+
81+ if ( userResponse ) {
82+ await vscode . commands . executeCommand ( "workbench.action.reloadWindow" ) ;
83+ }
84+ }
85+
86+ const requiresServerReloadOpt = this . requiresServerReloadOpts . find ( ( opt ) =>
7087 event . affectsConfiguration ( opt ) ,
7188 ) ;
7289
73- if ( ! requiresReloadOpt ) return ;
90+ if ( ! requiresServerReloadOpt ) return ;
7491
7592 if ( this . restartServerOnConfigChange ) {
7693 await vscode . commands . executeCommand ( "rust-analyzer.restartServer" ) ;
7794 return ;
7895 }
7996
80- const message = `Changing "${ requiresReloadOpt } " requires a server restart` ;
97+ const message = `Changing "${ requiresServerReloadOpt } " requires a server restart` ;
8198 const userResponse = await vscode . window . showInformationMessage ( message , "Restart now" ) ;
8299
83100 if ( userResponse ) {
0 commit comments