Open sheam opened 3 years ago
When the formatting option for the opening brace on newline for control blocks is true, it would make sense to have the else on it's online as well.
else
Using typescript-formatter with VS Code, and from command 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 "placeOpenBraceOnNewLineForControlBlocks": true, the expected behaviour (IMHO) would be:
"placeOpenBraceOnNewLineForControlBlocks": true
My suggestion meets these guidelines:
We are facing the same issue, as reported here and was directed to here by the visual studio code team: https://github.com/microsoft/vscode/issues/111829
Search Terms
Suggestion
When the formatting option for the opening brace on newline for control blocks is true, it would make sense to have the
else
on it's online as well.Use Cases
Using typescript-formatter with VS Code, and from command line.
Examples
My tsfmt.json is:
I get results like this:
For people using
"placeOpenBraceOnNewLineForControlBlocks": true
, the expected behaviour (IMHO) would be:Checklist
My suggestion meets these guidelines: