@@ -38,7 +38,8 @@ namespace ts.SignatureHelp {
3838 return undefined ;
3939 }
4040
41- const argumentInfo = getContainingArgumentInfo ( startingToken , position , sourceFile , typeChecker ) ;
41+ const isManuallyInvoked = ! ! triggerReason && triggerReason . kind === "invoked" ;
42+ const argumentInfo = getContainingArgumentInfo ( startingToken , position , sourceFile , typeChecker , isManuallyInvoked ) ;
4243 if ( ! argumentInfo ) return undefined ;
4344
4445 cancellationToken . throwIfCancellationRequested ( ) ;
@@ -450,8 +451,8 @@ namespace ts.SignatureHelp {
450451 return createTextSpan ( applicableSpanStart , applicableSpanEnd - applicableSpanStart ) ;
451452 }
452453
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 ) {
455456 // If the node is not a subspan of its parent, this is a big problem.
456457 // There have been crashes that might be caused by this violation.
457458 Debug . assert ( rangeContainsRange ( n . parent , n ) , "Not a subspan" , ( ) => `Child: ${ Debug . showSyntaxKind ( n ) } , parent: ${ Debug . showSyntaxKind ( n . parent ) } ` ) ;
0 commit comments