@@ -19,14 +19,18 @@ export class Config {
19
19
configureLang : vscode . Disposable | undefined ;
20
20
21
21
readonly rootSection = "rust-analyzer" ;
22
- private readonly requiresReloadOpts = [
22
+ private readonly requiresServerReloadOpts = [
23
23
"cargo" ,
24
24
"procMacro" ,
25
25
"serverPath" ,
26
26
"server" ,
27
27
"files" ,
28
28
] . map ( ( opt ) => `${ this . rootSection } .${ opt } ` ) ;
29
29
30
+ private readonly requiresWindowReloadOpts = [ "testExplorer" ] . map (
31
+ ( opt ) => `${ this . rootSection } .${ opt } ` ,
32
+ ) ;
33
+
30
34
readonly package : {
31
35
version : string ;
32
36
releaseTag : string | null ;
@@ -66,18 +70,31 @@ export class Config {
66
70
67
71
this . configureLanguage ( ) ;
68
72
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 ) =>
70
87
event . affectsConfiguration ( opt ) ,
71
88
) ;
72
89
73
- if ( ! requiresReloadOpt ) return ;
90
+ if ( ! requiresServerReloadOpt ) return ;
74
91
75
92
if ( this . restartServerOnConfigChange ) {
76
93
await vscode . commands . executeCommand ( "rust-analyzer.restartServer" ) ;
77
94
return ;
78
95
}
79
96
80
- const message = `Changing "${ requiresReloadOpt } " requires a server restart` ;
97
+ const message = `Changing "${ requiresServerReloadOpt } " requires a server restart` ;
81
98
const userResponse = await vscode . window . showInformationMessage ( message , "Restart now" ) ;
82
99
83
100
if ( userResponse ) {
0 commit comments