Allow signature help argument count to be equal to argument index (#58203)

This commit is contained in:
Mateusz Burzyński
2024-06-14 23:50:36 +02:00
committed by GitHub
parent 0ca1973d8f
commit 25d34138e3
4 changed files with 1038 additions and 6 deletions

View File

@@ -287,9 +287,6 @@ function getArgumentOrParameterListInfo(node: Node, position: number, sourceFile
const { list, argumentIndex } = info;
const argumentCount = getArgumentCount(checker, list);
if (argumentIndex !== 0) {
Debug.assertLessThan(argumentIndex, argumentCount);
}
const argumentsSpan = getApplicableSpanForArguments(list, sourceFile);
return { list, argumentIndex, argumentCount, argumentsSpan };
}
@@ -660,9 +657,6 @@ function createSignatureHelpItems(
const callTargetDisplayParts = callTargetSymbol ? symbolToDisplayParts(typeChecker, callTargetSymbol, useFullPrefix ? sourceFile : undefined, /*meaning*/ undefined) : emptyArray;
const items = map(candidates, candidateSignature => getSignatureHelpItem(candidateSignature, callTargetDisplayParts, isTypeParameterList, typeChecker, enclosingDeclaration, sourceFile));
if (argumentIndex !== 0) {
Debug.assertLessThan(argumentIndex, argumentCount);
}
let selectedItemIndex = 0;
let itemsSeen = 0;
for (let i = 0; i < items.length; i++) {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
/// <reference path="fourslash.ts" />
// @target: esnext
// @lib: esnext
//// const layers = Object.assign({}, /*1*/...[]);
verify.completions({
marker: "1",
includes: completion.globals,
isNewIdentifierLocation: true,
});

View File

@@ -0,0 +1,8 @@
/// <reference path="fourslash.ts" />
// @target: esnext
// @lib: esnext
//// const layers = Object.assign({}, /*1*/...[]);
verify.baselineSignatureHelp();