-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly resolve tags for function overloads (#30253)
* Correctly resolve tags for function overloads. Fixes #30181 * Better fix for #30181. Added more unit tests * Fix commentsOverloads tests * Fallback to first signature when doc and tags are empty
- Loading branch information
Showing
7 changed files
with
370 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
tests/cases/fourslash/quickInfoJsDocTagsFunctionOverload01.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/// <reference path='fourslash.ts'/> | ||
|
||
// @Filename: quickInfoJsDocTagsFunctionOverload01.ts | ||
/////** | ||
//// * Doc foo | ||
//// */ | ||
////declare function /*1*/foo(): void; | ||
//// | ||
/////** | ||
//// * Doc foo overloaded | ||
//// * @tag Tag text | ||
//// */ | ||
////declare function /*2*/foo(x: number): void | ||
|
||
goTo.marker("1"); | ||
verify.verifyQuickInfoDisplayParts( | ||
"function", | ||
"declare", | ||
{ start: 36, length: 3 }, | ||
[ | ||
{text:"function",kind:"keyword"}, | ||
{text:" ",kind:"space"}, | ||
{text:"foo",kind:"functionName"}, | ||
{text:"(",kind:"punctuation"}, | ||
{text:")",kind:"punctuation"}, | ||
{text:":",kind:"punctuation"}, | ||
{text:" ",kind:"space"}, | ||
{text:"void",kind:"keyword"}, | ||
{text:" ",kind:"space"}, | ||
{text:"(",kind:"punctuation"}, | ||
{text:"+",kind:"operator"}, | ||
{text:"1",kind:"numericLiteral"}, | ||
{text:" ",kind:"space"}, | ||
{text:"overload",kind:"text"}, | ||
{text:")",kind:"punctuation"} | ||
], | ||
[{ text: "Doc foo", kind: "text" }]); | ||
|
||
goTo.marker("2"); | ||
verify.verifyQuickInfoDisplayParts( | ||
"function", | ||
"declare", | ||
{ start: 114, length: 3 }, | ||
[ | ||
{text:"function",kind:"keyword"}, | ||
{text:" ",kind:"space"}, | ||
{text:"foo",kind:"functionName"}, | ||
{text:"(",kind:"punctuation"}, | ||
{text:"x",kind:"parameterName"}, | ||
{text:":",kind:"punctuation"}, | ||
{text:" ",kind:"space"}, | ||
{text:"number",kind:"keyword"}, | ||
{text:")",kind:"punctuation"}, | ||
{text:":",kind:"punctuation"}, | ||
{text:" ",kind:"space"}, | ||
{text:"void",kind:"keyword"}, | ||
{text:" ",kind:"space"}, | ||
{text:"(",kind:"punctuation"}, | ||
{text:"+",kind:"operator"}, | ||
{text:"1",kind:"numericLiteral"}, | ||
{text:" ",kind:"space"}, | ||
{text:"overload",kind:"text"}, | ||
{text:")",kind:"punctuation"} | ||
], | ||
[{ text: "Doc foo overloaded", kind: "text" }], | ||
[{ name: "tag", text: "Tag text" }]); |
64 changes: 64 additions & 0 deletions
64
tests/cases/fourslash/quickInfoJsDocTagsFunctionOverload02.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/// <reference path='fourslash.ts'/> | ||
|
||
// @Filename: quickInfoJsDocTagsFunctionOverload02.ts | ||
/////** | ||
//// * Doc foo | ||
//// */ | ||
////declare function /*1*/foo(): void; | ||
//// | ||
/////** | ||
//// * Doc foo overloaded | ||
//// */ | ||
////declare function /*2*/foo(x: number): void | ||
|
||
goTo.marker("1"); | ||
verify.verifyQuickInfoDisplayParts( | ||
"function", | ||
"declare", | ||
{ start: 36, length: 3 }, | ||
[ | ||
{text:"function",kind:"keyword"}, | ||
{text:" ",kind:"space"}, | ||
{text:"foo",kind:"functionName"}, | ||
{text:"(",kind:"punctuation"}, | ||
{text:")",kind:"punctuation"}, | ||
{text:":",kind:"punctuation"}, | ||
{text:" ",kind:"space"}, | ||
{text:"void",kind:"keyword"}, | ||
{text:" ",kind:"space"}, | ||
{text:"(",kind:"punctuation"}, | ||
{text:"+",kind:"operator"}, | ||
{text:"1",kind:"numericLiteral"}, | ||
{text:" ",kind:"space"}, | ||
{text:"overload",kind:"text"}, | ||
{text:")",kind:"punctuation"} | ||
], | ||
[{ text: "Doc foo", kind: "text" }]); | ||
|
||
goTo.marker("2"); | ||
verify.verifyQuickInfoDisplayParts( | ||
"function", | ||
"declare", | ||
{ start: 97, length: 3 }, | ||
[ | ||
{text:"function",kind:"keyword"}, | ||
{text:" ",kind:"space"}, | ||
{text:"foo",kind:"functionName"}, | ||
{text:"(",kind:"punctuation"}, | ||
{text:"x",kind:"parameterName"}, | ||
{text:":",kind:"punctuation"}, | ||
{text:" ",kind:"space"}, | ||
{text:"number",kind:"keyword"}, | ||
{text:")",kind:"punctuation"}, | ||
{text:":",kind:"punctuation"}, | ||
{text:" ",kind:"space"}, | ||
{text:"void",kind:"keyword"}, | ||
{text:" ",kind:"space"}, | ||
{text:"(",kind:"punctuation"}, | ||
{text:"+",kind:"operator"}, | ||
{text:"1",kind:"numericLiteral"}, | ||
{text:" ",kind:"space"}, | ||
{text:"overload",kind:"text"}, | ||
{text:")",kind:"punctuation"} | ||
], | ||
[{ text: "Doc foo overloaded", kind: "text" }]); |
Oops, something went wrong.