exclude closeparen/propertyaccess tokens

This commit is contained in:
SaschaNaz
2015-06-02 15:28:29 +09:00
parent 50a02237d1
commit 910079a60e
3 changed files with 21 additions and 3 deletions

View File

@@ -296,7 +296,12 @@ module ts.formatting {
}
function getLineIndentationWhenExpressionIsInMultiLine(node: Node, sourceFile: SourceFile, options: EditorOptions): number {
if (node.parent && (
// actual indentation should not be used when:
// - node is close parenthesis - this is the end of the expression
// - node is property access expression
if (node.kind !== SyntaxKind.CloseParenToken &&
node.kind !== SyntaxKind.PropertyAccessExpression &&
node.parent && (
node.parent.kind === SyntaxKind.CallExpression ||
node.parent.kind === SyntaxKind.NewExpression)) {

View File

@@ -18,4 +18,4 @@ goTo.marker("1");
edit.insert("\r\n");
goTo.marker("0");
// Won't-fixed: Smart indent during chained function calls
verify.indentationIs(4);
verify.indentationIs(8);

View File

@@ -13,6 +13,14 @@
//// })/*b*/
////}
////Promise
//// .then(
//// /*n1*/
//// )
//// /*n2*/
//// .then();
goTo.marker('1');
edit.insertLine('');
goTo.marker('2');
@@ -36,4 +44,9 @@ edit.insert(';');
verify.currentLineContentIs(' "";');
goTo.marker('b');
edit.insert(';');
verify.currentLineContentIs(' });');
verify.currentLineContentIs(' });');
goTo.marker('n1');
verify.indentationIs(8);
goTo.marker('n2');
verify.indentationIs(4);