@@ -55,6 +55,8 @@ async fn discover_and_load_ingots(
5555 backend : & mut Backend ,
5656 root_path : & std:: path:: Path ,
5757) -> Result < ( ) , ResponseError > {
58+ info ! ( target: "resolver" , "workspace content {}" , backend. db. workspace( ) . all_files( & backend. db) . len( ) ) ;
59+
5860 // Find all fe.toml files in the workspace
5961 let pattern = format ! ( "{}/**/fe.toml" , root_path. to_string_lossy( ) ) ;
6062 let config_paths = glob:: glob ( & pattern)
@@ -103,6 +105,8 @@ async fn discover_and_load_ingots(
103105 }
104106 }
105107
108+ info ! ( target: "resolver" , "workspace content 2 {}" , backend. db. workspace( ) . all_files( & backend. db) . len( ) ) ;
109+
106110 Ok ( ( ) )
107111}
108112
@@ -255,6 +259,27 @@ pub async fn handle_file_change(
255259 . db
256260 . workspace ( )
257261 . update ( & mut backend. db , url. clone ( ) , contents) ;
262+
263+ // If this is a .fe file, check if its ingot is loaded
264+ if path. extension ( ) . and_then ( |s| s. to_str ( ) ) == Some ( "fe" ) {
265+ // Walk up to find fe.toml
266+ let mut current = path. parent ( ) ;
267+ while let Some ( dir) = current {
268+ let fe_toml = dir. join ( "fe.toml" ) ;
269+ if fe_toml. exists ( ) {
270+ // Found ingot root, check if it's loaded
271+ if let Ok ( ingot_url) = Url :: from_directory_path ( dir) {
272+ let loaded_ingots = backend. db . graph ( ) . all_urls ( & backend. db ) ;
273+ if !loaded_ingots. contains ( & ingot_url) {
274+ info ! ( "Ingot not loaded, initializing: {:?}" , dir) ;
275+ load_ingot_files ( backend, dir) . await ?;
276+ }
277+ }
278+ break ;
279+ }
280+ current = dir. parent ( ) ;
281+ }
282+ }
258283 }
259284 }
260285 ChangeKind :: Create => {
0 commit comments