Fixed jsDoc parser - no longer omits asterisks in the middle (if the line does not start with asterisk) and additional case for whitespaces being ignored
This commit is contained in:
parent
19070648eb
commit
aa4a0b6469
2 changed files with 5 additions and 2 deletions
|
@ -6337,7 +6337,7 @@ namespace ts {
|
||||||
break;
|
break;
|
||||||
case SyntaxKind.AsteriskToken:
|
case SyntaxKind.AsteriskToken:
|
||||||
const asterisk = scanner.getTokenText();
|
const asterisk = scanner.getTokenText();
|
||||||
if (state === JSDocState.SawAsterisk) {
|
if (state === JSDocState.SawAsterisk || state === JSDocState.SavingComments) {
|
||||||
// If we've already seen an asterisk, then we can no longer parse a tag on this line
|
// If we've already seen an asterisk, then we can no longer parse a tag on this line
|
||||||
state = JSDocState.SavingComments;
|
state = JSDocState.SavingComments;
|
||||||
pushComment(asterisk);
|
pushComment(asterisk);
|
||||||
|
@ -6369,6 +6369,8 @@ namespace ts {
|
||||||
case SyntaxKind.EndOfFileToken:
|
case SyntaxKind.EndOfFileToken:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
// anything other than whitespace or asterisk at the beginning of the line starts the comment text
|
||||||
|
state = JSDocState.SavingComments;
|
||||||
pushComment(scanner.getTokenText());
|
pushComment(scanner.getTokenText());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,7 @@
|
||||||
//// /**
|
//// /**
|
||||||
//// * This is firstLine
|
//// * This is firstLine
|
||||||
//// This is second Line
|
//// This is second Line
|
||||||
|
//// [1]: third * line
|
||||||
//// @param param1 first Line text
|
//// @param param1 first Line text
|
||||||
//// second line text
|
//// second line text
|
||||||
//// */
|
//// */
|
||||||
|
@ -145,6 +146,6 @@ verify.quickInfos({
|
||||||
l: ["function l(param1: string): void", "This is firstLine\nThis is second Line"],
|
l: ["function l(param1: string): void", "This is firstLine\nThis is second Line"],
|
||||||
9: ["(parameter) param1: string", "first Line text\nblank line that shouldnt be shown when starting this \nsecond time information about the param again"],
|
9: ["(parameter) param1: string", "first Line text\nblank line that shouldnt be shown when starting this \nsecond time information about the param again"],
|
||||||
|
|
||||||
m: ["function m(param1: string): void", "This is firstLine\nThis is second Line"],
|
m: ["function m(param1: string): void", "This is firstLine\nThis is second Line\n[1]: third * line"],
|
||||||
10: ["(parameter) param1: string", "first Line text\nsecond line text"]
|
10: ["(parameter) param1: string", "first Line text\nsecond line text"]
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue