handle regexes correctly in formatting

This commit is contained in:
Vladimir Matveev
2014-11-26 00:29:20 -08:00
parent faf3413c40
commit eda4b1bea0
3 changed files with 11 additions and 2 deletions

View File

@@ -505,7 +505,7 @@ module ts.formatting {
if (isToken(child)) {
// if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules
var tokenInfo = formattingScanner.readTokenInfo(node);
var tokenInfo = formattingScanner.readTokenInfo(child);
Debug.assert(tokenInfo.token.end === child.end);
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation);
return inheritedIndentation;

View File

@@ -114,7 +114,8 @@ module ts.formatting {
}
function shouldRescanTemplateToken(container: Node): boolean {
return container.kind === SyntaxKind.TemplateSpan;
return container.kind === SyntaxKind.TemplateMiddle ||
container.kind === SyntaxKind.TemplateTail;
}
function startsWithSlashToken(t: SyntaxKind): boolean {

View File

@@ -0,0 +1,8 @@
///<reference path="fourslash.ts"/>
////removeAllButLast(sortedTypes, undefinedType, /keepNullableType**/ true)/*1*/
goTo.marker("1");
edit.insert(";");
verify.currentLineContentIs("removeAllButLast(sortedTypes, undefinedType, /keepNullableType**/ true);");