Skip to content

Commit 98e9e77

Browse files
committed
Fixed JSDoc with only one asterisk in comment
1 parent 995023c commit 98e9e77

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

src/compiler/parser.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7602,15 +7602,8 @@ namespace ts {
76027602
if (state === JSDocState.BeginningOfLine) {
76037603
// leading asterisks start recording on the *next* (non-whitespace) token
76047604
state = JSDocState.SawAsterisk;
7605-
7606-
if (lookAhead(() => nextTokenJSDoc() === SyntaxKind.AsteriskToken)) {
7607-
pushComment(scanner.getTokenText());
7608-
tok = nextTokenJSDoc();
7609-
}
7610-
else {
7611-
indent += 1;
7612-
break;
7613-
}
7605+
indent += 1;
7606+
break;
76147607
}
76157608
// record the * as a comment
76167609
// falls through
@@ -7695,13 +7688,14 @@ namespace ts {
76957688
skipWhitespaceOrAsterisk();
76967689

76977690
const { name, isBracketed } = parseBracketNameInPropertyAndParamTag();
7698-
skipWhitespace();
7691+
const indentText = skipWhitespaceOrAsterisk();
76997692

77007693
if (isNameFirst) {
77017694
typeExpression = tryParseTypeExpression();
77027695
}
77037696

7704-
const comment = parseTagComments(indent + scanner.getStartPos() - start);
7697+
const comment = parseTrailingTagComments(indent + scanner.getStartPos() - start, getNodePos(), indent, indentText);
7698+
77057699
const nestedTypeLiteral = target !== PropertyLikeParse.CallbackParameter && parseNestedTypeLiteral(typeExpression, name, target, indent);
77067700
if (nestedTypeLiteral) {
77077701
typeExpression = nestedTypeLiteral;

tests/cases/fourslash/quickInfoJsDocTextFormatting1.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//// function f1(var1, var2) { }
1010
////
1111
//// /**
12-
//// * @param {number} var1 *This asterisk gets trimmed unfortunatelly
12+
//// * @param {number} var1 *Regular text with an asterisk
1313
//// * @param {string} var2 Another *Regular text with an asterisk
1414
//// */
1515
//// function f2(var1, var2) { }
@@ -57,10 +57,10 @@ verify.signatureHelp({
5757
});
5858
verify.signatureHelp({
5959
marker: "2",
60-
parameterDocComment: "This asterisk gets trimmed unfortunatelly",
60+
parameterDocComment: "*Regular text with an asterisk",
6161
tags: [{
6262
name: "param",
63-
text: "var1 This asterisk gets trimmed unfortunatelly"
63+
text: "var1 *Regular text with an asterisk"
6464
}, {
6565
name: "param",
6666
text: "var2 Another *Regular text with an asterisk"

0 commit comments

Comments
 (0)