@@ -440,4 +440,94 @@ public void GetSuggestedActions_RawStringLiteralMultiLine_ShouldProvideNavigatio
440440
441441 Assert . NotEmpty ( actions ) ; // This should fail - no navigation appears
442442 }
443+
444+ [ Fact ]
445+ public void GetSuggestedActions_VerbatimStringMultiLine_EarlyProperties_ShouldProvideNavigation ( )
446+ {
447+ // Test the specific scenario where {AppName}, {Version}, {Environment} don't get navigation
448+ var multiLineCode =
449+ "logger.LogInformation(@\" \r \n " +
450+ "===============================================\r \n " +
451+ "Application: {AppName}\r \n " +
452+ "Version: {Version}\r \n " +
453+ "Environment: {Environment}\r \n " +
454+ "===============================================\r \n " +
455+ "User: {UserName} (ID: {UserId})\r \n " +
456+ "Session: {SessionId}\r \n " +
457+ "Timestamp: {Timestamp:yyyy-MM-dd HH:mm:ss}\r \n " +
458+ "===============================================\r \n " +
459+ "\" , appName, version, env, userName, userId, sessionId, DateTime.Now);" ;
460+
461+ var mockBuffer = new MockTextBuffer ( multiLineCode ) ;
462+ var mockSnapshot = new MockTextSnapshot ( multiLineCode , mockBuffer , 1 ) ;
463+ var provider = new SerilogSuggestedActionsSource ( null ) ;
464+
465+ // Test navigation for {AppName} - this reportedly fails
466+ var appNameStart = multiLineCode . IndexOf ( "{AppName}" ) ;
467+ var appNameRange = new SnapshotSpan ( mockSnapshot , appNameStart + 1 , 7 ) ; // Inside "AppName"
468+ var appNameActions = provider . GetSuggestedActions ( null , appNameRange , CancellationToken . None ) ;
469+
470+ // Test navigation for {Version} - this reportedly fails
471+ var versionStart = multiLineCode . IndexOf ( "{Version}" ) ;
472+ var versionRange = new SnapshotSpan ( mockSnapshot , versionStart + 1 , 7 ) ; // Inside "Version"
473+ var versionActions = provider . GetSuggestedActions ( null , versionRange , CancellationToken . None ) ;
474+
475+ // Test navigation for {Environment} - this reportedly fails
476+ var environmentStart = multiLineCode . IndexOf ( "{Environment}" ) ;
477+ var environmentRange = new SnapshotSpan ( mockSnapshot , environmentStart + 1 , 11 ) ; // Inside "Environment"
478+ var environmentActions = provider . GetSuggestedActions ( null , environmentRange , CancellationToken . None ) ;
479+
480+ // Test navigation for {UserName} - this reportedly works
481+ var userNameStart = multiLineCode . IndexOf ( "{UserName}" ) ;
482+ var userNameRange = new SnapshotSpan ( mockSnapshot , userNameStart + 1 , 8 ) ; // Inside "UserName"
483+ var userNameActions = provider . GetSuggestedActions ( null , userNameRange , CancellationToken . None ) ;
484+
485+ // All should work, but currently only later ones do
486+ Assert . NotEmpty ( appNameActions ) ;
487+ Assert . NotEmpty ( versionActions ) ;
488+ Assert . NotEmpty ( environmentActions ) ;
489+ Assert . NotEmpty ( userNameActions ) ;
490+ }
491+
492+ [ Fact ]
493+ public void GetSuggestedActions_RawStringMultiLine_EarlyProperties_ShouldProvideNavigation ( )
494+ {
495+ // Test the same issue with raw string literals
496+ var multiLineCode =
497+ "logger.LogInformation(\" \" \" \r \n " +
498+ " ===============================================\r \n " +
499+ " Application: {AppName}\r \n " +
500+ " Version: {Version}\r \n " +
501+ " Environment: {Environment}\r \n " +
502+ " ===============================================\r \n " +
503+ " User: {UserName} (ID: {UserId})\r \n " +
504+ " Session: {SessionId}\r \n " +
505+ " Timestamp: {Timestamp:yyyy-MM-dd HH:mm:ss}\r \n " +
506+ " ===============================================\r \n " +
507+ " \" \" \" , appName, version, environment, userName, userId, sessionId, DateTime.Now);" ;
508+
509+ var mockBuffer = new MockTextBuffer ( multiLineCode ) ;
510+ var mockSnapshot = new MockTextSnapshot ( multiLineCode , mockBuffer , 1 ) ;
511+ var provider = new SerilogSuggestedActionsSource ( null ) ;
512+
513+ // Test navigation for {AppName} - this reportedly fails
514+ var appNameStart = multiLineCode . IndexOf ( "{AppName}" ) ;
515+ var appNameRange = new SnapshotSpan ( mockSnapshot , appNameStart + 1 , 7 ) ; // Inside "AppName"
516+ var appNameActions = provider . GetSuggestedActions ( null , appNameRange , CancellationToken . None ) ;
517+
518+ // Test navigation for {Version} - this reportedly fails
519+ var versionStart = multiLineCode . IndexOf ( "{Version}" ) ;
520+ var versionRange = new SnapshotSpan ( mockSnapshot , versionStart + 1 , 7 ) ; // Inside "Version"
521+ var versionActions = provider . GetSuggestedActions ( null , versionRange , CancellationToken . None ) ;
522+
523+ // Test navigation for {Environment} - this reportedly fails
524+ var environmentStart = multiLineCode . IndexOf ( "{Environment}" ) ;
525+ var environmentRange = new SnapshotSpan ( mockSnapshot , environmentStart + 1 , 11 ) ; // Inside "Environment"
526+ var environmentActions = provider . GetSuggestedActions ( null , environmentRange , CancellationToken . None ) ;
527+
528+ // All should work, but currently only later ones do
529+ Assert . NotEmpty ( appNameActions ) ;
530+ Assert . NotEmpty ( versionActions ) ;
531+ Assert . NotEmpty ( environmentActions ) ;
532+ }
443533}
0 commit comments