-
Couldn't load subscription status.
- Fork 52
Open
Description
When having opening curly braces on new lines, it is pretty normal to have the else on it's own line.
My tsfmt.json is:
{
"baseIndentSize": 0,
"indentSize": 4,
"tabSize": 4,
"indentStyle": 2,
"newLineCharacter": "\n",
"convertTabsToSpaces": true,
"insertSpaceAfterCommaDelimiter": true,
"insertSpaceAfterSemicolonInForStatements": true,
"insertSpaceBeforeAndAfterBinaryOperators": true,
"insertSpaceAfterConstructor": false,
"insertSpaceAfterKeywordsInControlFlowStatements": true,
"insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,
"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false,
"insertSpaceAfterTypeAssertion": false,
"insertSpaceBeforeFunctionParenthesis": false,
"insertSpaceBeforeTypeAnnotation": false,
"placeOpenBraceOnNewLineForFunctions": true,
"placeOpenBraceOnNewLineForControlBlocks": true
}
I get results like this:
if(condition)
{
console.log('condition true');
} else if(otherCondition)
{
console.log('other condition is true');
} else
{
console.log('condition not true');
}
For people using "placeOpenBraceOnNewLineForFunctions": true and "placeOpenBraceOnNewLineForControlBlocks": true, the expected behaviour (IMHO) would be:
if(condition)
{
console.log('condition true');
}
else if(otherCondition)
{
console.log('other condition is true');
}
else
{
console.log('condition not true');
}
I am happy to do a PR (potentially for a new setting) if someone could point me in the right direction.
Cheers.
ps - opened issue with the TS project here: microsoft/TypeScript#41777
BergenSoft and outlawpractice
Metadata
Metadata
Assignees
Labels
No labels