Fixed JSDoc with only one asterisk in comment

This commit is contained in:
Armando Aguirre 2021-01-19 15:55:01 -08:00
parent 995023c2a7
commit 98e9e77255
2 changed files with 8 additions and 14 deletions

View File

@ -7602,15 +7602,8 @@ namespace ts {
if (state === JSDocState.BeginningOfLine) {
// leading asterisks start recording on the *next* (non-whitespace) token
state = JSDocState.SawAsterisk;
if (lookAhead(() => nextTokenJSDoc() === SyntaxKind.AsteriskToken)) {
pushComment(scanner.getTokenText());
tok = nextTokenJSDoc();
}
else {
indent += 1;
break;
}
indent += 1;
break;
}
// record the * as a comment
// falls through
@ -7695,13 +7688,14 @@ namespace ts {
skipWhitespaceOrAsterisk();
const { name, isBracketed } = parseBracketNameInPropertyAndParamTag();
skipWhitespace();
const indentText = skipWhitespaceOrAsterisk();
if (isNameFirst) {
typeExpression = tryParseTypeExpression();
}
const comment = parseTagComments(indent + scanner.getStartPos() - start);
const comment = parseTrailingTagComments(indent + scanner.getStartPos() - start, getNodePos(), indent, indentText);
const nestedTypeLiteral = target !== PropertyLikeParse.CallbackParameter && parseNestedTypeLiteral(typeExpression, name, target, indent);
if (nestedTypeLiteral) {
typeExpression = nestedTypeLiteral;

View File

@ -9,7 +9,7 @@
//// function f1(var1, var2) { }
////
//// /**
//// * @param {number} var1 *This asterisk gets trimmed unfortunatelly
//// * @param {number} var1 *Regular text with an asterisk
//// * @param {string} var2 Another *Regular text with an asterisk
//// */
//// function f2(var1, var2) { }
@ -57,10 +57,10 @@ verify.signatureHelp({
});
verify.signatureHelp({
marker: "2",
parameterDocComment: "This asterisk gets trimmed unfortunatelly",
parameterDocComment: "*Regular text with an asterisk",
tags: [{
name: "param",
text: "var1 This asterisk gets trimmed unfortunatelly"
text: "var1 *Regular text with an asterisk"
}, {
name: "param",
text: "var2 Another *Regular text with an asterisk"