@@ -38,7 +38,8 @@ namespace ts.SignatureHelp {
38
38
return undefined ;
39
39
}
40
40
41
- const argumentInfo = getContainingArgumentInfo ( startingToken , position , sourceFile , typeChecker ) ;
41
+ const isManuallyInvoked = ! ! triggerReason && triggerReason . kind === "invoked" ;
42
+ const argumentInfo = getContainingArgumentInfo ( startingToken , position , sourceFile , typeChecker , isManuallyInvoked ) ;
42
43
if ( ! argumentInfo ) return undefined ;
43
44
44
45
cancellationToken . throwIfCancellationRequested ( ) ;
@@ -450,8 +451,8 @@ namespace ts.SignatureHelp {
450
451
return createTextSpan ( applicableSpanStart , applicableSpanEnd - applicableSpanStart ) ;
451
452
}
452
453
453
- function getContainingArgumentInfo ( node : Node , position : number , sourceFile : SourceFile , checker : TypeChecker ) : ArgumentListInfo | undefined {
454
- for ( let n = node ; ! isBlock ( n ) && ! isSourceFile ( n ) ; n = n . parent ) {
454
+ function getContainingArgumentInfo ( node : Node , position : number , sourceFile : SourceFile , checker : TypeChecker , isManuallyInvoked : boolean ) : ArgumentListInfo | undefined {
455
+ for ( let n = node ; isManuallyInvoked || ( ! isBlock ( n ) && ! isSourceFile ( n ) ) ; n = n . parent ) {
455
456
// If the node is not a subspan of its parent, this is a big problem.
456
457
// There have been crashes that might be caused by this violation.
457
458
Debug . assert ( rangeContainsRange ( n . parent , n ) , "Not a subspan" , ( ) => `Child: ${ Debug . showSyntaxKind ( n ) } , parent: ${ Debug . showSyntaxKind ( n . parent ) } ` ) ;
0 commit comments