File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed
crates/ra_assists/src/handlers Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,14 @@ use crate::{
25
25
// }
26
26
// ```
27
27
pub ( crate ) fn add_turbo_fish ( acc : & mut Assists , ctx : & AssistContext ) -> Option < ( ) > {
28
- let ident = ctx. find_token_at_offset ( SyntaxKind :: IDENT ) ?;
28
+ let ident = ctx. find_token_at_offset ( SyntaxKind :: IDENT ) . or_else ( || {
29
+ let arg_list = ctx. find_node_at_offset :: < ast:: ArgList > ( ) ?;
30
+ if arg_list. args ( ) . count ( ) > 0 {
31
+ return None ;
32
+ }
33
+ mark:: hit!( add_turbo_fish_after_call) ;
34
+ arg_list. l_paren_token ( ) ?. prev_token ( ) . filter ( |it| it. kind ( ) == SyntaxKind :: IDENT )
35
+ } ) ?;
29
36
let next_token = ident. next_token ( ) ?;
30
37
if next_token. kind ( ) == T ! [ :: ] {
31
38
mark:: hit!( add_turbo_fish_one_fish_is_enough) ;
@@ -82,6 +89,26 @@ fn main() {
82
89
) ;
83
90
}
84
91
92
+ #[ test]
93
+ fn add_turbo_fish_after_call ( ) {
94
+ mark:: check!( add_turbo_fish_after_call) ;
95
+ check_assist (
96
+ add_turbo_fish,
97
+ r#"
98
+ fn make<T>() -> T {}
99
+ fn main() {
100
+ make()<|>;
101
+ }
102
+ "# ,
103
+ r#"
104
+ fn make<T>() -> T {}
105
+ fn main() {
106
+ make::<${0:_}>();
107
+ }
108
+ "# ,
109
+ ) ;
110
+ }
111
+
85
112
#[ test]
86
113
fn add_turbo_fish_method ( ) {
87
114
check_assist (
You can’t perform that action at this time.
0 commit comments