@@ -25,7 +25,7 @@ export class SignatureHelpProvider implements vscode.SignatureHelpProvider {
25
25
document ,
26
26
position ,
27
27
token ,
28
- ) . then ( hover => this . hoverToSignatureHelp ( hover ) ) ;
28
+ ) . then ( hover => this . hoverToSignatureHelp ( hover , position , document ) ) ;
29
29
} else if ( context . triggerCharacter === ',' ) {
30
30
if (
31
31
this . previousFunctionPosition &&
@@ -36,7 +36,7 @@ export class SignatureHelpProvider implements vscode.SignatureHelpProvider {
36
36
document ,
37
37
this . previousFunctionPosition ,
38
38
token ,
39
- ) . then ( hover => this . hoverToSignatureHelp ( hover ) ) ;
39
+ ) . then ( hover => this . hoverToSignatureHelp ( hover , position , document ) ) ;
40
40
} else {
41
41
return null ;
42
42
}
@@ -71,6 +71,8 @@ export class SignatureHelpProvider implements vscode.SignatureHelpProvider {
71
71
72
72
private hoverToSignatureHelp (
73
73
hover : vscode . Hover ,
74
+ position : vscode . Position ,
75
+ document : vscode . TextDocument ,
74
76
) : vscode . SignatureHelp | undefined {
75
77
/*
76
78
The contents of a hover result has the following structure:
@@ -114,8 +116,13 @@ export class SignatureHelpProvider implements vscode.SignatureHelpProvider {
114
116
. replace ( '```' , '' ) ;
115
117
116
118
// the signature help tooltip is activated on `(` or `,`
117
- // and without this, it could show the tooltip after non-functions
118
- if ( ! label . includes ( 'fn' ) ) {
119
+ // here we make sure the label received is for a function,
120
+ // and that we are not showing the hover for the same line
121
+ // where we are declaring a function.
122
+ if (
123
+ ! label . includes ( 'fn' ) ||
124
+ document . lineAt ( position . line ) . text . includes ( 'fn ' )
125
+ ) {
119
126
return undefined ;
120
127
}
121
128
0 commit comments