Skip to content

Commit 526aed3

Browse files
committed
Merge pull request microsoft#1277 from Microsoft/formatting_regexes
handle regexes correctly in formatting
2 parents cf3d284 + eda4b1b commit 526aed3

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/services/formatting.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ module ts.formatting {
505505

506506
if (isToken(child)) {
507507
// if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules
508-
var tokenInfo = formattingScanner.readTokenInfo(node);
508+
var tokenInfo = formattingScanner.readTokenInfo(child);
509509
Debug.assert(tokenInfo.token.end === child.end);
510510
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation);
511511
return inheritedIndentation;

src/services/formatting/formattingScanner.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ module ts.formatting {
114114
}
115115

116116
function shouldRescanTemplateToken(container: Node): boolean {
117-
return container.kind === SyntaxKind.TemplateSpan;
117+
return container.kind === SyntaxKind.TemplateMiddle ||
118+
container.kind === SyntaxKind.TemplateTail;
118119
}
119120

120121
function startsWithSlashToken(t: SyntaxKind): boolean {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
///<reference path="fourslash.ts"/>
2+
3+
////removeAllButLast(sortedTypes, undefinedType, /keepNullableType**/ true)/*1*/
4+
5+
goTo.marker("1");
6+
edit.insert(";");
7+
verify.currentLineContentIs("removeAllButLast(sortedTypes, undefinedType, /keepNullableType**/ true);");
8+

0 commit comments

Comments
 (0)