@@ -8,7 +8,7 @@ use std::{sync::Arc, time::Instant};
8
8
use crossbeam_channel:: { unbounded, Receiver , Sender } ;
9
9
use flycheck:: FlycheckHandle ;
10
10
use ide:: { Analysis , AnalysisHost , Cancellable , Change , FileId } ;
11
- use ide_db:: base_db:: CrateId ;
11
+ use ide_db:: base_db:: { CrateId , FileLoader , SourceDatabase } ;
12
12
use lsp_types:: { SemanticTokens , Url } ;
13
13
use parking_lot:: { Mutex , RwLock } ;
14
14
use proc_macro_api:: ProcMacroServer ;
@@ -58,6 +58,7 @@ pub(crate) struct GlobalState {
58
58
pub ( crate ) mem_docs : MemDocs ,
59
59
pub ( crate ) semantic_tokens_cache : Arc < Mutex < FxHashMap < Url , SemanticTokens > > > ,
60
60
pub ( crate ) shutdown_requested : bool ,
61
+ pub ( crate ) proc_macro_changed : bool ,
61
62
pub ( crate ) last_reported_status : Option < lsp_ext:: ServerStatusParams > ,
62
63
pub ( crate ) source_root_config : SourceRootConfig ,
63
64
pub ( crate ) proc_macro_client : Option < ProcMacroServer > ,
@@ -147,6 +148,7 @@ impl GlobalState {
147
148
mem_docs : MemDocs :: default ( ) ,
148
149
semantic_tokens_cache : Arc :: new ( Default :: default ( ) ) ,
149
150
shutdown_requested : false ,
151
+ proc_macro_changed : false ,
150
152
last_reported_status : None ,
151
153
source_root_config : SourceRootConfig :: default ( ) ,
152
154
proc_macro_client : None ,
@@ -187,6 +189,15 @@ impl GlobalState {
187
189
}
188
190
189
191
for file in changed_files {
192
+ if !file. is_created_or_deleted ( ) {
193
+ let crates = self . analysis_host . raw_database ( ) . relevant_crates ( file. file_id ) ;
194
+ let crate_graph = self . analysis_host . raw_database ( ) . crate_graph ( ) ;
195
+
196
+ if crates. iter ( ) . any ( |& krate| !crate_graph[ krate] . proc_macro . is_empty ( ) ) {
197
+ self . proc_macro_changed = true ;
198
+ }
199
+ }
200
+
190
201
if let Some ( path) = vfs. file_path ( file. file_id ) . as_path ( ) {
191
202
let path = path. to_path_buf ( ) ;
192
203
if reload:: should_refresh_for_change ( & path, file. change_kind ) {
0 commit comments