@@ -471,6 +471,72 @@ [<export>] let summary (project: Common.ProjectInfo) =
471471 }
472472 }
473473
474+ [ Test ]
475+ public void CSharp_server_navigates_alias_qualified_function_calls ( )
476+ {
477+ var client = LspClient . StartCSharp ( ) ;
478+ var tempDir = Path . Combine ( Path . GetTempPath ( ) , $ "fscript-lsp-alias-functions-{ Guid . NewGuid ( ) : N} ") ;
479+ Directory . CreateDirectory ( tempDir ) ;
480+ try
481+ {
482+ LspTestFixture . Initialize ( client ) ;
483+
484+ var helpersPath = Path . Combine ( tempDir , "_helpers.fss" ) ;
485+ var mainPath = Path . Combine ( tempDir , "main.fss" ) ;
486+ File . WriteAllText ( helpersPath , """
487+ let append_part part acc =
488+ if part = "" then acc else $"{acc} {part}"
489+ """ ) ;
490+
491+ var source = """
492+ import "_helpers.fss" as Helpers
493+
494+ let append_build_arg acc key value =
495+ Helpers.append_part $"--build-arg {key}=\"{value}\"" acc
496+ """ ;
497+ File . WriteAllText ( mainPath , source ) ;
498+
499+ var mainUri = new Uri ( mainPath ) . AbsoluteUri ;
500+ var helpersUri = new Uri ( helpersPath ) . AbsoluteUri ;
501+
502+ var didOpenParams = new JsonObject
503+ {
504+ [ "textDocument" ] = new JsonObject
505+ {
506+ [ "uri" ] = mainUri ,
507+ [ "languageId" ] = "fscript" ,
508+ [ "version" ] = 1 ,
509+ [ "text" ] = source
510+ }
511+ } ;
512+ LspClient . SendNotification ( client , "textDocument/didOpen" , didOpenParams ) ;
513+ _ = LspClient . ReadUntil ( client , 10_000 , msg => msg [ "method" ] ? . GetValue < string > ( ) == "textDocument/publishDiagnostics" ) ;
514+
515+ var definitionParams = new JsonObject
516+ {
517+ [ "textDocument" ] = new JsonObject { [ "uri" ] = mainUri } ,
518+ [ "position" ] = new JsonObject { [ "line" ] = 3 , [ "character" ] = 17 }
519+ } ;
520+ LspClient . SendRequest ( client , 84 , "textDocument/definition" , definitionParams ) ;
521+ var definitionResponse = LspClient . ReadUntil ( client , 10_000 , msg => msg [ "id" ] is JsonValue idv && idv . TryGetValue < int > ( out var id ) && id == 84 ) ;
522+
523+ var result = definitionResponse [ "result" ] as JsonObject ?? throw new Exception ( "Expected definition location." ) ;
524+ Assert . That ( result [ "uri" ] ? . GetValue < string > ( ) , Is . EqualTo ( helpersUri ) ) ;
525+ var range = result [ "range" ] as JsonObject ?? throw new Exception ( "Expected range." ) ;
526+ var start = range [ "start" ] as JsonObject ?? throw new Exception ( "Expected start range." ) ;
527+ Assert . That ( start [ "line" ] ? . GetValue < int > ( ) , Is . EqualTo ( 0 ) ) ;
528+ }
529+ finally
530+ {
531+ try { LspTestFixture . Shutdown ( client ) ; } catch { }
532+ LspClient . Stop ( client ) ;
533+ if ( Directory . Exists ( tempDir ) )
534+ {
535+ Directory . Delete ( tempDir , true ) ;
536+ }
537+ }
538+ }
539+
474540 private static string FindRepoRoot ( )
475541 {
476542 var current = new DirectoryInfo ( AppContext . BaseDirectory ) ;
0 commit comments