fix(59463): Feature that displays method argument names inline does not correctly handle method overloading (#59504)
This commit is contained in:
Родитель
c07da583af
Коммит
df9d16503f
|
@ -106,7 +106,6 @@ import {
|
|||
PrefixUnaryExpression,
|
||||
PropertyDeclaration,
|
||||
QuotePreference,
|
||||
Signature,
|
||||
SignatureDeclarationBase,
|
||||
skipParentheses,
|
||||
some,
|
||||
|
@ -296,11 +295,8 @@ export function provideInlayHints(context: InlayHintsContext): InlayHint[] {
|
|||
return;
|
||||
}
|
||||
|
||||
const candidates: Signature[] = [];
|
||||
const signature = checker.getResolvedSignatureForSignatureHelp(expr, candidates);
|
||||
if (!signature || !candidates.length) {
|
||||
return;
|
||||
}
|
||||
const signature = checker.getResolvedSignature(expr);
|
||||
if (signature === undefined) return;
|
||||
|
||||
let signatureParamPos = 0;
|
||||
for (const originalArg of args) {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
// === Inlay Hints ===
|
||||
{ n: [1, 2, 3] },
|
||||
^
|
||||
{
|
||||
"text": "ok_1:",
|
||||
"position": 195,
|
||||
"kind": "Parameter",
|
||||
"whitespaceAfter": true
|
||||
}
|
||||
|
||||
{
|
||||
^
|
||||
{
|
||||
"text": "ok_2:",
|
||||
"position": 217,
|
||||
"kind": "Parameter",
|
||||
"whitespaceAfter": true
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////type HasID = {
|
||||
//// id: number;
|
||||
////}
|
||||
////
|
||||
////type Numbers = {
|
||||
//// n: number[];
|
||||
////}
|
||||
////
|
||||
////declare function func(bad1: number, bad2: HasID): void;
|
||||
////declare function func(ok_1: Numbers, ok_2: HasID): void;
|
||||
////
|
||||
////func(
|
||||
//// { n: [1, 2, 3] },
|
||||
//// {
|
||||
//// id: 1,
|
||||
//// },
|
||||
////);
|
||||
|
||||
verify.baselineInlayHints(undefined, {
|
||||
includeInlayParameterNameHints: "all",
|
||||
});
|
Загрузка…
Ссылка в новой задаче