mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 20:14:01 -06:00
allow consecutive newlines in jsdoc tag comments (#38036)
This commit is contained in:
parent
93ccc17658
commit
2d09da6df5
@ -7440,11 +7440,9 @@ namespace ts {
|
||||
loop: while (true) {
|
||||
switch (tok) {
|
||||
case SyntaxKind.NewLineTrivia:
|
||||
if (state >= JSDocState.SawAsterisk) {
|
||||
state = JSDocState.BeginningOfLine;
|
||||
// don't use pushComment here because we want to keep the margin unchanged
|
||||
comments.push(scanner.getTokenText());
|
||||
}
|
||||
state = JSDocState.BeginningOfLine;
|
||||
// don't use pushComment here because we want to keep the margin unchanged
|
||||
comments.push(scanner.getTokenText());
|
||||
indent = 0;
|
||||
break;
|
||||
case SyntaxKind.AtToken:
|
||||
|
||||
@ -320,6 +320,12 @@ namespace ts {
|
||||
`/**
|
||||
* @author John Doe <john.doe@example.com>
|
||||
* @author John Doe <john.doe@example.com> unexpected comment
|
||||
*/`);
|
||||
|
||||
parsesCorrectly("consecutive newline tokens",
|
||||
`/**
|
||||
* @example
|
||||
* Some\n\n * text\r\n * with newlines.
|
||||
*/`);
|
||||
});
|
||||
});
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
{
|
||||
"kind": "JSDocComment",
|
||||
"pos": 0,
|
||||
"end": 55,
|
||||
"flags": "JSDoc",
|
||||
"modifierFlagsCache": 0,
|
||||
"transformFlags": 0,
|
||||
"tags": {
|
||||
"0": {
|
||||
"kind": "JSDocTag",
|
||||
"pos": 7,
|
||||
"end": 19,
|
||||
"modifierFlagsCache": 0,
|
||||
"transformFlags": 0,
|
||||
"tagName": {
|
||||
"kind": "Identifier",
|
||||
"pos": 8,
|
||||
"end": 15,
|
||||
"modifierFlagsCache": 0,
|
||||
"transformFlags": 0,
|
||||
"escapedText": "example"
|
||||
},
|
||||
"comment": "Some\n\ntext\r\nwith newlines."
|
||||
},
|
||||
"length": 1,
|
||||
"pos": 7,
|
||||
"end": 19,
|
||||
"hasTrailingComma": false,
|
||||
"transformFlags": 0
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user