This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +16
-19
lines changed Expand file tree Collapse file tree 3 files changed +16
-19
lines changed Original file line number Diff line number Diff line change @@ -307,16 +307,18 @@ impl GlobalState {
307
307
for file in changed_files {
308
308
let vfs_path = vfs. file_path ( file. file_id ) ;
309
309
if let Some ( path) = vfs_path. as_path ( ) {
310
- let path = path. to_path_buf ( ) ;
311
- if reload:: should_refresh_for_change ( & path, file. kind ( ) ) {
312
- workspace_structure_change = Some ( ( path. clone ( ) , false ) ) ;
310
+ has_structure_changes = file. is_created_or_deleted ( ) ;
311
+
312
+ if file. is_modified ( ) && path. extension ( ) == Some ( "rs" ) {
313
+ modified_rust_files. push ( file. file_id ) ;
313
314
}
315
+
316
+ let path = path. to_path_buf ( ) ;
314
317
if file. is_created_or_deleted ( ) {
315
- has_structure_changes = true ;
316
- workspace_structure_change =
317
- Some ( ( path, self . crate_graph_file_dependencies . contains ( vfs_path) ) ) ;
318
- } else if path. extension ( ) == Some ( "rs" . as_ref ( ) ) {
319
- modified_rust_files. push ( file. file_id ) ;
318
+ workspace_structure_change. get_or_insert ( ( path, false ) ) . 1 |=
319
+ self . crate_graph_file_dependencies . contains ( vfs_path) ;
320
+ } else if reload:: should_refresh_for_change ( & path, file. kind ( ) ) {
321
+ workspace_structure_change. get_or_insert ( ( path. clone ( ) , false ) ) ;
320
322
}
321
323
}
322
324
Original file line number Diff line number Diff line change @@ -535,21 +535,11 @@ impl GlobalState {
535
535
let ( crate_graph, proc_macro_paths, layouts, toolchains) = {
536
536
// Create crate graph from all the workspaces
537
537
let vfs = & mut self . vfs . write ( ) . 0 ;
538
- let loader = & mut self . loader ;
539
538
540
539
let load = |path : & AbsPath | {
541
- let _p = tracing:: span!( tracing:: Level :: DEBUG , "switch_workspaces::load" ) . entered ( ) ;
542
540
let vfs_path = vfs:: VfsPath :: from ( path. to_path_buf ( ) ) ;
543
541
crate_graph_file_dependencies. insert ( vfs_path. clone ( ) ) ;
544
- match vfs. file_id ( & vfs_path) {
545
- Some ( file_id) => Some ( file_id) ,
546
- None => {
547
- // FIXME: Consider not loading this here?
548
- let contents = loader. handle . load_sync ( path) ;
549
- vfs. set_file_contents ( vfs_path. clone ( ) , contents) ;
550
- vfs. file_id ( & vfs_path)
551
- }
552
- }
542
+ vfs. file_id ( & vfs_path)
553
543
} ;
554
544
555
545
ws_to_crate_graph ( & self . workspaces , self . config . extra_env ( ) , load)
Original file line number Diff line number Diff line change @@ -121,6 +121,11 @@ impl ChangedFile {
121
121
matches ! ( self . change, Change :: Create ( _) | Change :: Delete )
122
122
}
123
123
124
+ /// Returns `true` if the change is [`Modify`](ChangeKind::Modify).
125
+ pub fn is_modified ( & self ) -> bool {
126
+ matches ! ( self . change, Change :: Modify ( _) )
127
+ }
128
+
124
129
pub fn kind ( & self ) -> ChangeKind {
125
130
match self . change {
126
131
Change :: Create ( _) => ChangeKind :: Create ,
You can’t perform that action at this time.
0 commit comments