@@ -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 , FileLoader , SourceDatabase , SourceDatabaseExt } ;
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 ;
@@ -176,9 +176,9 @@ impl GlobalState {
176
176
177
177
pub ( crate ) fn process_changes ( & mut self ) -> bool {
178
178
let _p = profile:: span ( "GlobalState::process_changes" ) ;
179
- let mut fs_refresh_changes = Vec :: new ( ) ;
180
179
// A file was added or deleted
181
180
let mut has_structure_changes = false ;
181
+ let mut workspace_structure_change = None ;
182
182
183
183
let ( change, changed_files) = {
184
184
let mut change = Change :: new ( ) ;
@@ -192,7 +192,7 @@ impl GlobalState {
192
192
if let Some ( path) = vfs. file_path ( file. file_id ) . as_path ( ) {
193
193
let path = path. to_path_buf ( ) ;
194
194
if reload:: should_refresh_for_change ( & path, file. change_kind ) {
195
- fs_refresh_changes . push ( ( path, file . file_id ) ) ;
195
+ workspace_structure_change = Some ( path) ;
196
196
}
197
197
if file. is_created_or_deleted ( ) {
198
198
has_structure_changes = true ;
@@ -227,11 +227,10 @@ impl GlobalState {
227
227
228
228
{
229
229
let raw_database = self . analysis_host . raw_database ( ) ;
230
- let workspace_structure_change =
231
- fs_refresh_changes. into_iter ( ) . find ( |& ( _, file_id) | {
232
- !raw_database. source_root ( raw_database. file_source_root ( file_id) ) . is_library
233
- } ) ;
234
- if let Some ( ( path, _) ) = workspace_structure_change {
230
+ // FIXME: ideally we should only trigger a workspace fetch for non-library changes
231
+ // but somethings going wrong with the source root business when we add a new local
232
+ // crate see https://github.com/rust-lang/rust-analyzer/issues/13029
233
+ if let Some ( path) = workspace_structure_change {
235
234
self . fetch_workspaces_queue
236
235
. request_op ( format ! ( "workspace vfs file change: {}" , path. display( ) ) ) ;
237
236
}
0 commit comments