@@ -218,7 +218,7 @@ impl GlobalState {
218218 let _p = profile:: span ( "GlobalState::process_changes" ) ;
219219
220220 let mut file_changes = FxHashMap :: < _ , ( bool , ChangedFile ) > :: default ( ) ;
221- let ( change, modified_files , workspace_structure_change) = {
221+ let ( change, modified_rust_files , workspace_structure_change) = {
222222 let mut change = Change :: new ( ) ;
223223 let mut guard = self . vfs . write ( ) ;
224224 let changed_files = guard. 0 . take_changes ( ) ;
@@ -254,8 +254,8 @@ impl GlobalState {
254254 * change = Create ( new) ;
255255 * just_created = true ;
256256 }
257- // shouldn't occur, but collapse into `Modify`
258- ( Modify ( prev ) , _, Create ( new ) ) => * prev = new,
257+ // shouldn't occur, but keep the Create
258+ ( prev @ Modify ( _ ) , _, new @ Create ( _ ) ) => * prev = new,
259259 }
260260 }
261261 Entry :: Vacant ( v) => {
@@ -276,7 +276,7 @@ impl GlobalState {
276276 // A file was added or deleted
277277 let mut has_structure_changes = false ;
278278 let mut bytes = vec ! [ ] ;
279- let mut modified_files = vec ! [ ] ;
279+ let mut modified_rust_files = vec ! [ ] ;
280280 for file in changed_files {
281281 let vfs_path = & vfs. file_path ( file. file_id ) ;
282282 if let Some ( path) = vfs_path. as_path ( ) {
@@ -288,8 +288,8 @@ impl GlobalState {
288288 has_structure_changes = true ;
289289 workspace_structure_change =
290290 Some ( ( path, self . crate_graph_file_dependencies . contains ( vfs_path) ) ) ;
291- } else {
292- modified_files . push ( file. file_id ) ;
291+ } else if path . extension ( ) == Some ( "rs" . as_ref ( ) ) {
292+ modified_rust_files . push ( file. file_id ) ;
293293 }
294294 }
295295
@@ -324,7 +324,7 @@ impl GlobalState {
324324 let roots = self . source_root_config . partition ( vfs) ;
325325 change. set_roots ( roots) ;
326326 }
327- ( change, modified_files , workspace_structure_change)
327+ ( change, modified_rust_files , workspace_structure_change)
328328 } ;
329329
330330 self . analysis_host . apply_change ( change) ;
@@ -339,7 +339,7 @@ impl GlobalState {
339339 force_crate_graph_reload,
340340 ) ;
341341 }
342- self . proc_macro_changed = modified_files . into_iter ( ) . any ( |file_id| {
342+ self . proc_macro_changed = modified_rust_files . into_iter ( ) . any ( |file_id| {
343343 let crates = raw_database. relevant_crates ( file_id) ;
344344 let crate_graph = raw_database. crate_graph ( ) ;
345345
0 commit comments