Skip to content

Commit e7bd4fd

Browse files
committed
Pull functions back out to reduce confusion about how to call
1 parent 36cfea0 commit e7bd4fd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/services/signatureHelp.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ function getArgumentOrParameterListInfo(node: Node, position: number, sourceFile
286286
if (!info) return undefined;
287287
const { list, argumentIndex } = info;
288288

289-
const argumentCount = getArgumentIndexOrCount(checker, list, /*node*/ undefined);
289+
const argumentCount = getArgumentCount(checker, list);
290290
if (argumentIndex !== 0) {
291291
Debug.assertLessThan(argumentIndex, argumentCount);
292292
}
@@ -307,7 +307,7 @@ function getArgumentOrParameterListAndIndex(node: Node, sourceFile: SourceFile,
307307
// - On the target of the call (parent.func)
308308
// - On the 'new' keyword in a 'new' expression
309309
const list = findContainingList(node);
310-
return list && { list, argumentIndex: getArgumentIndexOrCount(checker, list, node) };
310+
return list && { list, argumentIndex: getArgumentIndex(checker, list, node) };
311311
}
312312
}
313313

@@ -492,6 +492,14 @@ function getSpreadElementCount(node: SpreadElement, checker: TypeChecker) {
492492
return 0;
493493
}
494494

495+
function getArgumentIndex(checker: TypeChecker, argumentsList: Node, node: Node) {
496+
return getArgumentIndexOrCount(checker, argumentsList, node);
497+
}
498+
499+
function getArgumentCount(checker: TypeChecker, argumentsList: Node) {
500+
return getArgumentIndexOrCount(checker, argumentsList, /*node*/ undefined);
501+
}
502+
495503
function getArgumentIndexOrCount(checker: TypeChecker, argumentsList: Node, node: Node | undefined) {
496504
// The list we got back can include commas. In the presence of errors it may
497505
// also just have nodes without commas. For example "Foo(a b c)" will have 3

0 commit comments

Comments
 (0)