mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-17 01:49:41 -05:00
Allow signature help argument count to be equal to argument index (#58203)
This commit is contained in:
committed by
GitHub
parent
0ca1973d8f
commit
25d34138e3
@@ -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++) {
|
||||
|
||||
1018
tests/baselines/reference/signatureHelpRestArgs3.baseline
Normal file
1018
tests/baselines/reference/signatureHelpRestArgs3.baseline
Normal file
File diff suppressed because it is too large
Load Diff
12
tests/cases/fourslash/completionsBeforeRestArg1.ts
Normal file
12
tests/cases/fourslash/completionsBeforeRestArg1.ts
Normal 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,
|
||||
});
|
||||
8
tests/cases/fourslash/signatureHelpRestArgs3.ts
Normal file
8
tests/cases/fourslash/signatureHelpRestArgs3.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
|
||||
//// const layers = Object.assign({}, /*1*/...[]);
|
||||
|
||||
verify.baselineSignatureHelp();
|
||||
Reference in New Issue
Block a user