Merge pull request #1277 from Microsoft/formatting_regexes
handle regexes correctly in formatting
This commit is contained in:
commit
526aed36a0
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
8
tests/cases/fourslash/formattingRegexes.ts
Normal file
8
tests/cases/fourslash/formattingRegexes.ts
Normal 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);");
|
||||
|
Loading…
Reference in a new issue