Skip to content

Commit 0fbf73a

Browse files
committed
Fixed the + overload according to feedback
1 parent d4e58b2 commit 0fbf73a

File tree

6 files changed

+127
-131
lines changed

6 files changed

+127
-131
lines changed

src/services/services.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2717,7 +2717,7 @@ module ts {
27172717
}
27182718
callExpression = <CallExpression>location.parent;
27192719

2720-
var candidateSignatures = <Signature[]>[];
2720+
var candidateSignatures: Signature[] = [];
27212721
signature = typeResolver.getResolvedSignature(callExpression, candidateSignatures);
27222722
if (!signature && candidateSignatures.length) {
27232723
// Use the first candidate:
@@ -2934,13 +2934,9 @@ module ts {
29342934
displayParts.push(spacePart());
29352935
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
29362936
displayParts.push(operatorPart(SyntaxKind.PlusToken));
2937-
displayParts.push(spacePart());
29382937
displayParts.push(displayPart((allSignatures.length - 1).toString(), SymbolDisplayPartKind.numericLiteral));
29392938
displayParts.push(spacePart());
2940-
displayParts.push(textPart("overload"));
2941-
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
2942-
displayParts.push(textPart("s"));
2943-
displayParts.push(punctuationPart(SyntaxKind.CloseParenToken));
2939+
displayParts.push(textPart(allSignatures.length === 2 ? "overload" : "overloads"));
29442940
displayParts.push(punctuationPart(SyntaxKind.CloseParenToken));
29452941
}
29462942
documentation = signature.getDocumentationComment();

tests/cases/fourslash/commentsCommentParsing.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,21 +334,21 @@ goTo.marker('25');
334334
verify.currentSignatureHelpDocCommentIs("fn f1 with number");
335335
verify.currentParameterHelpArgumentDocCommentIs("");
336336
goTo.marker('25q');
337-
verify.quickInfoIs("(function) f1(a: number): any (+ 1 overload(s))", "fn f1 with number");
337+
verify.quickInfoIs("(function) f1(a: number): any (+1 overload)", "fn f1 with number");
338338
goTo.marker('25aq');
339339
verify.quickInfoIs("(parameter) a: number", "");
340340

341341
goTo.marker('26');
342342
verify.currentSignatureHelpDocCommentIs("");
343343
verify.currentParameterHelpArgumentDocCommentIs("");
344344
goTo.marker('26q');
345-
verify.quickInfoIs("(function) f1(b: string): any (+ 1 overload(s))", "");
345+
verify.quickInfoIs("(function) f1(b: string): any (+1 overload)", "");
346346
goTo.marker('26aq');
347347
verify.quickInfoIs("(parameter) b: string", "");
348348

349349
goTo.marker('27');
350350
verify.completionListContains("multiply", "(function) multiply(a: number, b: number, c?: number, d?: any, e?: any): void", "This is multiplication function\n@anotherTag\n@anotherTag");
351-
verify.completionListContains("f1", "(function) f1(a: number): any (+ 1 overload(s))", "fn f1 with number");
351+
verify.completionListContains("f1", "(function) f1(a: number): any (+1 overload)", "fn f1 with number");
352352

353353
goTo.marker('28');
354354
verify.currentSignatureHelpDocCommentIs("This is subtract function");

0 commit comments

Comments
 (0)