Skip to content

Commit 582b0aa

Browse files
committed
parse jsdoc param tag even without a param name
1 parent d1253d5 commit 582b0aa

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/compiler/parser.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5831,7 +5831,6 @@ namespace ts {
58315831

58325832
if (!name) {
58335833
parseErrorAtPosition(pos, 0, Diagnostics.Identifier_expected);
5834-
return undefined;
58355834
}
58365835

58375836
let preName: Identifier, postName: Identifier;

src/services/services.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2989,7 +2989,8 @@ namespace ts {
29892989
switch (tag.kind) {
29902990
case SyntaxKind.JSDocTypeTag:
29912991
case SyntaxKind.JSDocParameterTag:
2992-
let tagWithExpression = <JSDocTypeTag | JSDocParameterTag>tag;
2992+
case SyntaxKind.JSDocReturnTag:
2993+
let tagWithExpression = <JSDocTypeTag | JSDocParameterTag | JSDocReturnTag>tag;
29932994
if (tagWithExpression.typeExpression) {
29942995
insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end;
29952996
}

tests/cases/fourslash/completionInJsDoc.ts

+12
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
////
2323
////// @pa/*7*/
2424
////var v7;
25+
////
26+
/////** @param { n/*8*/ } */
27+
////var v8;
28+
////
29+
/////** @return { n/*9*/ } */
30+
////var v9;
2531

2632
goTo.marker('1');
2733
verify.completionListContains("constructor");
@@ -48,3 +54,9 @@ verify.completionListIsEmpty();
4854
goTo.marker('7');
4955
verify.completionListIsEmpty();
5056

57+
goTo.marker('8');
58+
verify.completionListContains('number');
59+
60+
goTo.marker('9');
61+
verify.completionListContains('number');
62+

0 commit comments

Comments
 (0)