This repository was archived by the owner on May 28, 2025. It is now read-only.
  
  
  
  
    
    
    
      
    
  
  
    
File tree Expand file tree Collapse file tree 3 files changed +53
-1
lines changed Expand file tree Collapse file tree 3 files changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,23 @@ fn hover_simple(
201201
202202                Some ( render:: struct_rest_pat ( sema,  config,  & record_pat) ) 
203203            } ) 
204+         } ) 
205+         // try () call hovers 
206+         . or_else ( || { 
207+             descended ( ) . find_map ( |token| { 
208+                 if  token. kind ( )  != T ! [ '(' ]  && token. kind ( )  != T ! [ ')' ]  { 
209+                     return  None ; 
210+                 } 
211+                 let  arg_list = token. parent ( ) . and_then ( ast:: ArgList :: cast) ?. syntax ( ) . parent ( ) ?; 
212+                 let  call_expr = syntax:: match_ast! { 
213+                     match  arg_list { 
214+                         ast:: CallExpr ( expr)  => expr. into( ) , 
215+                         ast:: MethodCallExpr ( expr)  => expr. into( ) , 
216+                         _ => return  None , 
217+                     } 
218+                 } ; 
219+                 render:: type_info_of ( sema,  config,  & Either :: Left ( call_expr) ) 
220+             } ) 
204221        } ) ; 
205222
206223    result. map ( |mut  res :  HoverResult | { 
Original file line number Diff line number Diff line change @@ -5612,3 +5612,38 @@ fn main() {
56125612"# , 
56135613    ) ; 
56145614} 
5615+ 
5616+ #[ test]  
5617+ fn  hover_call_parens ( )  { 
5618+     check ( 
5619+         r#" 
5620+ fn foo() -> i32 {} 
5621+ fn main() { 
5622+     foo($0); 
5623+ } 
5624+ "# , 
5625+         expect ! [ [ r#" 
5626+             *)* 
5627+             ```rust 
5628+             i32 
5629+             ``` 
5630+         "# ] ] , 
5631+     ) ; 
5632+     check ( 
5633+         r#" 
5634+ struct S; 
5635+ impl S { 
5636+     fn foo(self) -> i32 {} 
5637+ } 
5638+ fn main() { 
5639+     S.foo($0); 
5640+ } 
5641+ "# , 
5642+         expect ! [ [ r#" 
5643+             *)* 
5644+             ```rust 
5645+             i32 
5646+             ``` 
5647+         "# ] ] , 
5648+     ) ; 
5649+ } 
Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ impl SourceFile {
186186/// ``` 
187187#[ macro_export]  
188188macro_rules!  match_ast { 
189-     ( match  $node: ident {  $( $tt: tt) *  } )  => {  match_ast!( match  ( $node)  {  $( $tt) *  } )  } ; 
189+     ( match  $node: ident {  $( $tt: tt) *  } )  => {  $crate :: match_ast!( match  ( $node)  {  $( $tt) *  } )  } ; 
190190
191191    ( match  ( $node: expr)  { 
192192        $(  $(  $path: ident ) ::+ ( $it: pat)  => $res: expr,  ) * 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments