Skip to content

Commit 1907064

Browse files
committed
Added test for #12236
1 parent 05b1725 commit 1907064

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/compiler/parser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6360,7 +6360,8 @@ namespace ts {
63606360
const whitespace = scanner.getTokenText();
63616361
if (state === JSDocState.SavingComments) {
63626362
comments.push(whitespace);
6363-
} else if (margin !== undefined && indent + whitespace.length > margin) {
6363+
}
6364+
else if (margin !== undefined && indent + whitespace.length > margin) {
63646365
comments.push(whitespace.slice(margin - indent - 1));
63656366
}
63666367
indent += whitespace.length;

tests/cases/fourslash/commentsLinePreservation.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@
105105
//// * second time information about the param again
106106
//// */
107107
////function /*l*/l(param1: string) { /*9*/param1 = "hello"; }
108+
//// /**
109+
//// * This is firstLine
110+
//// This is second Line
111+
//// @param param1 first Line text
112+
//// second line text
113+
//// */
114+
////function /*m*/m(param1: string) { /*10*/param1 = "hello"; }
108115

109116
verify.quickInfos({
110117
a: ["var a: string", "This is firstLine\nThis is second Line\n\nThis is fourth Line"],
@@ -136,5 +143,8 @@ verify.quickInfos({
136143
8: ["(parameter) param1: string", "hello "],
137144

138145
l: ["function l(param1: string): void", "This is firstLine\nThis is second Line"],
139-
9: ["(parameter) param1: string", "first Line text\nblank line that shouldnt be shown when starting this \nsecond time information about the param again"]
146+
9: ["(parameter) param1: string", "first Line text\nblank line that shouldnt be shown when starting this \nsecond time information about the param again"],
147+
148+
m: ["function m(param1: string): void", "This is firstLine\nThis is second Line"],
149+
10: ["(parameter) param1: string", "first Line text\nsecond line text"]
140150
});

0 commit comments

Comments
 (0)