File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,10 +56,16 @@ pub async fn hover(
5656 }
5757 if let HoverOrigin :: Path ( path) = strategy. origin {
5858 let md = format ! ( "```\n {}\n ```" , path. display( ) ) ;
59+ let default_nix_path = path. join ( "default.nix" ) ;
60+ let goto_path = if path. is_dir ( ) && default_nix_path. exists ( ) {
61+ default_nix_path
62+ } else {
63+ path
64+ } ;
5965 let position = Some ( Position {
6066 line : 1 ,
6167 col : 1 ,
62- path,
68+ path : goto_path ,
6369 } ) ;
6470 return Ok ( HoverResult { md, position } ) ;
6571 }
@@ -630,6 +636,23 @@ mod test {
630636 . await ;
631637 }
632638
639+ #[ test_log:: test( tokio:: test) ]
640+ async fn test_hover_default_nix_path ( ) {
641+ check_hover_nixpkgs (
642+ "default.nix" ,
643+ indoc ! { "
644+ import ./l$0ib
645+ " } ,
646+ expect ! [ [ r#"
647+ /test/hello/world/other.nix:1:1
648+
649+ ```
650+ /test/hello/world/other.nix
651+ ```"# ] ] ,
652+ )
653+ . await ;
654+ }
655+
633656 #[ test_log:: test( tokio:: test) ]
634657 async fn test_hover_nixpkgs_lib ( ) {
635658 check_hover_nixpkgs (
You can’t perform that action at this time.
0 commit comments