Merge pull request #1277 from Microsoft/formatting_regexes

handle regexes correctly in formatting
This commit is contained in:
Vladimir Matveev 2014-11-26 11:23:06 -08:00
commit 526aed36a0
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);");