Skip to content

Commit 8497667

Browse files
committed
drop trailing trivia prior to rescanning it
1 parent a6d374e commit 8497667

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/services/formatting/formattingScanner.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ module ts.formatting {
187187
}
188188

189189
// consume trailing trivia
190+
if (trailingTrivia) {
191+
trailingTrivia = undefined;
192+
}
190193
while(scanner.getStartPos() < endPos) {
191194
currentToken = scanner.scan();
192195
if (!isTrivia(currentToken)) {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
/// <reference path="fourslash.ts"/>
22
////var x = `sadasdasdasdasfegsfd
33
/////*1*/rasdesgeryt35t35y35 e4 ergt er 35t 3535 `;
4+
////var y = `1${2}/*2*/3`;
5+
46

57
goTo.marker("1");
68
edit.insert("\r\n"); // edit will trigger formatting - should succeeed
79

10+
goTo.marker("2");
11+
edit.insert("\r\n");
12+
verify.indentationIs(0);
13+
verify.currentLineContentIs("3`;")

0 commit comments

Comments
 (0)