mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-10-31 03:54:42 +00:00 
			
		
		
		
	fix: Reload workspaces when cargo configs change
This commit is contained in:
		
							parent
							
								
									a31e10a2fd
								
							
						
					
					
						commit
						24b0666d93
					
				
					 3 changed files with 15 additions and 11 deletions
				
			
		|  | @ -239,7 +239,7 @@ pub(crate) fn handle_did_change_configuration( | ||||||
|                         let (config, e, _) = config.apply_change(change); |                         let (config, e, _) = config.apply_change(change); | ||||||
|                         this.config_errors = e.is_empty().not().then_some(e); |                         this.config_errors = e.is_empty().not().then_some(e); | ||||||
| 
 | 
 | ||||||
|                         // Client config changes neccesitates .update_config method to be called.
 |                         // Client config changes necessitates .update_config method to be called.
 | ||||||
|                         this.update_configuration(config); |                         this.update_configuration(config); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|  | @ -114,6 +114,16 @@ impl GlobalState { | ||||||
|                 Durability::HIGH, |                 Durability::HIGH, | ||||||
|             ); |             ); | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         if self.config.cargo(None) != old_config.cargo(None) { | ||||||
|  |             let req = FetchWorkspaceRequest { path: None, force_crate_graph_reload: false }; | ||||||
|  |             self.fetch_workspaces_queue.request_op("cargo config changed".to_owned(), req) | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if self.config.cfg_set_test(None) != old_config.cfg_set_test(None) { | ||||||
|  |             let req = FetchWorkspaceRequest { path: None, force_crate_graph_reload: false }; | ||||||
|  |             self.fetch_workspaces_queue.request_op("cfg_set_test config changed".to_owned(), req) | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     pub(crate) fn current_status(&self) -> lsp_ext::ServerStatusParams { |     pub(crate) fn current_status(&self) -> lsp_ext::ServerStatusParams { | ||||||
|  |  | ||||||
|  | @ -20,15 +20,9 @@ export class Config { | ||||||
|     configureLang: vscode.Disposable | undefined; |     configureLang: vscode.Disposable | undefined; | ||||||
| 
 | 
 | ||||||
|     readonly rootSection = "rust-analyzer"; |     readonly rootSection = "rust-analyzer"; | ||||||
|     private readonly requiresServerReloadOpts = [ |     private readonly requiresServerReloadOpts = ["server", "files", "showSyntaxTree"].map( | ||||||
|         "cargo", |         (opt) => `${this.rootSection}.${opt}`, | ||||||
|         "procMacro", |     ); | ||||||
|         "serverPath", |  | ||||||
|         "server", |  | ||||||
|         "files", |  | ||||||
|         "cfg", |  | ||||||
|         "showSyntaxTree", |  | ||||||
|     ].map((opt) => `${this.rootSection}.${opt}`); |  | ||||||
| 
 | 
 | ||||||
|     private readonly requiresWindowReloadOpts = ["testExplorer"].map( |     private readonly requiresWindowReloadOpts = ["testExplorer"].map( | ||||||
|         (opt) => `${this.rootSection}.${opt}`, |         (opt) => `${this.rootSection}.${opt}`, | ||||||
|  | @ -208,7 +202,7 @@ export class Config { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     get serverPath() { |     get serverPath() { | ||||||
|         return this.get<null | string>("server.path") ?? this.get<null | string>("serverPath"); |         return this.get<null | string>("server.path"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     get serverExtraEnv(): Env { |     get serverExtraEnv(): Env { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lukas Wirth
						Lukas Wirth