@@ -335,15 +335,15 @@ module ts.SignatureHelp {
335
335
336
336
export function getSignatureHelpItems ( sourceFile : SourceFile , position : number , startingNode : Node , typeInfoResolver : TypeChecker ) : SignatureHelpItems {
337
337
// Decide whether to show signature help
338
- var signatureHelpContext = getSignatureHelpArgumentContext ( startingNode ) ;
338
+ var argumentList = getContainingArgumentList ( startingNode ) ;
339
339
340
340
// Semantic filtering of signature help
341
- if ( signatureHelpContext ) {
342
- var call = < CallExpression > signatureHelpContext . list . parent ;
341
+ if ( argumentList ) {
342
+ var call = < CallExpression > argumentList . parent ;
343
343
var candidates = < Signature [ ] > [ ] ;
344
344
var resolvedSignature = typeInfoResolver . getResolvedSignature ( call , candidates ) ;
345
345
return candidates . length
346
- ? createSignatureHelpItems ( candidates , resolvedSignature , signatureHelpContext . list )
346
+ ? createSignatureHelpItems ( candidates , resolvedSignature , argumentList )
347
347
: undefined ;
348
348
}
349
349
@@ -352,7 +352,7 @@ module ts.SignatureHelp {
352
352
353
353
// If node is an argument, returns its index in the argument list
354
354
// If not, returns -1
355
- function getArgumentIndexInfo ( node : Node ) : ServicesSyntaxUtilities . ListItemInfo {
355
+ function getImmediatelyContainingArgumentList ( node : Node ) : Node {
356
356
if ( node . parent . kind !== SyntaxKind . CallExpression && node . parent . kind !== SyntaxKind . NewExpression ) {
357
357
return undefined ;
358
358
}
@@ -363,11 +363,7 @@ module ts.SignatureHelp {
363
363
// Find the list that starts right *after* the < or ( token
364
364
var list = getChildListThatStartsWithOpenerToken ( parent , node , sourceFile ) ;
365
365
Debug . assert ( list ) ;
366
- // Treat the open paren / angle bracket of a call as the introduction of parameter slot 0
367
- return {
368
- listItemIndex : 0 ,
369
- list : list
370
- } ;
366
+ return list ;
371
367
}
372
368
373
369
if ( node . kind === SyntaxKind . GreaterThanToken
@@ -376,10 +372,10 @@ module ts.SignatureHelp {
376
372
return undefined ;
377
373
}
378
374
379
- return ServicesSyntaxUtilities . findListItemInfo ( node ) ;
375
+ return ServicesSyntaxUtilities . findContainingList ( node ) ;
380
376
}
381
377
382
- function getSignatureHelpArgumentContext ( node : Node ) : ServicesSyntaxUtilities . ListItemInfo {
378
+ function getContainingArgumentList ( node : Node ) : Node {
383
379
// We only want this node if it is a token and it strictly contains the current position.
384
380
// Otherwise we want the previous token
385
381
var isToken = node . kind < SyntaxKind . Missing ;
@@ -397,9 +393,9 @@ module ts.SignatureHelp {
397
393
return undefined ;
398
394
}
399
395
400
- var argumentInfo = getArgumentIndexInfo ( n ) ;
401
- if ( argumentInfo ) {
402
- return argumentInfo ;
396
+ var argumentList = getImmediatelyContainingArgumentList ( n ) ;
397
+ if ( argumentList ) {
398
+ return argumentList ;
403
399
}
404
400
405
401
0 commit comments