mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-10 01:43:59 -05:00
exclude closeparen/propertyaccess tokens
This commit is contained in:
@@ -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)) {
|
||||
|
||||
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
Reference in New Issue
Block a user