@@ -9,7 +9,7 @@ use crate::session::client::Client;
99use crate :: system:: AnySystemPath ;
1010use lsp_types as types;
1111use lsp_types:: { FileChangeType , notification as notif} ;
12- use rustc_hash :: FxHashMap ;
12+ use ruff_db :: system :: SystemPathBuf ;
1313use ty_project:: Db as _;
1414use ty_project:: watch:: { ChangeEvent , ChangedKind , CreatedKind , DeletedKind } ;
1515
@@ -25,7 +25,7 @@ impl SyncNotificationHandler for DidChangeWatchedFiles {
2525 client : & Client ,
2626 params : types:: DidChangeWatchedFilesParams ,
2727 ) -> Result < ( ) > {
28- let mut events_by_db : FxHashMap < _ , Vec < ChangeEvent > > = FxHashMap :: default ( ) ;
28+ let mut changes = Vec :: new ( ) ;
2929
3030 for change in params. changes {
3131 let path = DocumentKey :: from_url ( & change. uri ) . into_file_path ( ) ;
@@ -38,13 +38,6 @@ impl SyncNotificationHandler for DidChangeWatchedFiles {
3838 }
3939 } ;
4040
41- let Some ( db) = session. project_db_for_path ( & system_path) else {
42- tracing:: trace!(
43- "Ignoring change event for `{system_path}` because it's not in any workspace"
44- ) ;
45- continue ;
46- } ;
47-
4841 let change_event = match change. typ {
4942 FileChangeType :: CREATED => ChangeEvent :: Created {
5043 path : system_path,
@@ -67,17 +60,19 @@ impl SyncNotificationHandler for DidChangeWatchedFiles {
6760 }
6861 } ;
6962
70- events_by_db
71- . entry ( db. project ( ) . root ( db) . to_path_buf ( ) )
72- . or_default ( )
73- . push ( change_event) ;
63+ changes. push ( change_event) ;
7464 }
7565
76- if events_by_db . is_empty ( ) {
66+ if changes . is_empty ( ) {
7767 return Ok ( ( ) ) ;
7868 }
7969
80- for ( root, changes) in events_by_db {
70+ let roots: Vec < SystemPathBuf > = session
71+ . project_dbs ( )
72+ . map ( |db| db. project ( ) . root ( db) . to_owned ( ) )
73+ . collect ( ) ;
74+
75+ for root in roots {
8176 tracing:: debug!( "Applying changes to `{root}`" ) ;
8277
8378 session. apply_changes ( & AnySystemPath :: System ( root. clone ( ) ) , & changes) ;
0 commit comments