@@ -32,15 +32,27 @@ pub fn ingot_graph_resolver<'a>() -> IngotGraphResolver<'a> {
3232 . with_required_directory ( "src" )
3333 . with_required_file ( "src/lib.fe" )
3434 . with_pattern ( "src/**/*.fe" ) ;
35+
3536 GraphResolverImpl :: new ( files_resolver)
3637}
3738
3839pub fn init_ingot ( db : & mut DriverDataBase , ingot_url : & Url ) -> Vec < IngotInitDiagnostics > {
40+ // Check if ingot is already initialized
41+ if db. graph ( ) . contains_url ( db, ingot_url) {
42+ tracing:: info!( target: "resolver" , "Ingot already initialized: {}" , ingot_url) ;
43+ return Vec :: new ( ) ;
44+ }
45+
3946 tracing:: info!( target: "resolver" , "Starting workspace ingot resolution for: {}" , ingot_url) ;
47+
4048 let mut diagnostics: Vec < IngotInitDiagnostics > = {
4149 let mut handler = InputHandler :: from_db ( db, ingot_url. clone ( ) ) ;
4250 let mut ingot_graph_resolver = ingot_graph_resolver ( ) ;
4351
52+ // Always enable search mode for the initial URL
53+ // It will auto-disable after the first resolution so dependencies use exact paths
54+ ingot_graph_resolver. node_resolver . search_mode = true ;
55+
4456 // Root ingot resolution should never fail since directory existence is validated earlier.
4557 // If it fails, it indicates a bug in the resolver or an unexpected system condition.
4658 if let Err ( err) = ingot_graph_resolver. graph_resolve ( & mut handler, ingot_url) {
@@ -304,6 +316,7 @@ impl<'a> GraphResolutionHandler<Url, DiGraph<Url, (SmolStr, DependencyArguments)
304316 let from_url = & graph[ edge. source ( ) ] ;
305317 let to_url = & graph[ edge. target ( ) ] ;
306318 let ( alias, arguments) = edge. weight ( ) ;
319+
307320 dependency_graph. add_dependency (
308321 self . db ,
309322 from_url,
@@ -312,5 +325,11 @@ impl<'a> GraphResolutionHandler<Url, DiGraph<Url, (SmolStr, DependencyArguments)
312325 arguments. clone ( ) ,
313326 ) ;
314327 }
328+
329+ // Log total ingot count after resolution
330+ let total_ingots = dependency_graph. all_urls ( self . db ) . len ( ) ;
331+ if total_ingots > 0 {
332+ tracing:: info!( target: "resolver" , "Total ingots in workspace: {}" , total_ingots) ;
333+ }
315334 }
316335}
0 commit comments