mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 02:30:15 -06:00
do not insert space after function expressions
This commit is contained in:
parent
a4ec7d66eb
commit
ba7c1a13c3
@ -705,11 +705,18 @@ namespace ts.formatting {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.CatchClause:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
return true;
|
||||
case SyntaxKind.Block: {
|
||||
const blockParent = context.currentTokenParent.parent;
|
||||
if (blockParent.kind !== SyntaxKind.ArrowFunction &&
|
||||
blockParent.kind !== SyntaxKind.FunctionExpression)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -37,4 +37,4 @@ verify.currentLineContentIs(" x = 'Foo';");
|
||||
goTo.marker("11");
|
||||
verify.currentLineContentIs(" return fun;");
|
||||
goTo.marker("12");
|
||||
verify.currentLineContentIs(" } (fun1));");
|
||||
verify.currentLineContentIs(" }(fun1));");
|
||||
@ -72,6 +72,8 @@
|
||||
////<span>) </span>;/*closingParenInJsxElement2*/
|
||||
////<Router routes = { 3 } / >;/*jsxExpressionSpaces*/
|
||||
////<Router routes={ (3) } />;/*jsxExpressionSpaces2*/
|
||||
////<Router routes={() => {}}/*jsxExpressionSpaces3*/
|
||||
/////>;/*jsxDanglingSelfClosingToken*/
|
||||
|
||||
format.document();
|
||||
goTo.marker("autoformat");
|
||||
@ -120,8 +122,7 @@ goTo.marker("expressionIndent");
|
||||
verify.indentationIs(12);
|
||||
|
||||
goTo.marker("danglingBracketAutoformat")
|
||||
// TODO: verify.currentLineContentIs(" >");
|
||||
verify.currentLineContentIs(" >");
|
||||
verify.currentLineContentIs(" >");
|
||||
goTo.marker("closingTagAutoformat");
|
||||
verify.currentLineContentIs(" </div>");
|
||||
|
||||
@ -145,4 +146,8 @@ verify.currentLineContentIs("<span>) </span>;");
|
||||
goTo.marker("jsxExpressionSpaces");
|
||||
verify.currentLineContentIs("<Router routes={3} />;");
|
||||
goTo.marker("jsxExpressionSpaces2");
|
||||
verify.currentLineContentIs("<Router routes={(3)} />;");
|
||||
verify.currentLineContentIs("<Router routes={(3)} />;");
|
||||
goTo.marker("jsxExpressionSpaces3");
|
||||
verify.currentLineContentIs("<Router routes={() => { }}");
|
||||
goTo.marker("jsxDanglingSelfClosingToken");
|
||||
verify.currentLineContentIs("/>;");
|
||||
Loading…
x
Reference in New Issue
Block a user