https://bugs.llvm.org/show_bug.cgi?id=50501
Bug ID: 50501
Summary: JavaScript / TypeScript BreakBeforeBraces Problem
Product: clang
Version: 12.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Formatter
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
In JavaScript and TypeScript I fail to set the BreakBeforeBraces to always.
Moreover by function returns, the format differs according to the last comma
and semicolon. Some of that can be intentional, but I don't see any logic
there.
1) Is there a way to set BreakBeforeBraces to really always in JS and TS?
2) Is the function return behaviour intentional? (it should be actually solved
when 1) is solved
```
enum SampleEnum {
ENUM1,
ENUM2
}
const sampleObject = {
sampleBoolean: true,
sampleInt: 5
};
function noEndComma()
{
return {first: true, last: false};
}
function noColon()
{
return
{
first: true, last: false
}
}
function endCommaAndColon()
{
return {
first: true,
last: false,
};
}
```
my setting:
```
---
Language: JavaScript
BasedOnStyle: Chromium
ColumnLimit: 100
BreakBeforeBraces: Allman
AlignConsecutiveAssignments: 'true'
AlignConsecutiveMacros: 'true'
AlignConsecutiveDeclarations: 'true'
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: 'false'
AllowShortLambdasOnASingleLine: 'false'
AllowShortLoopsOnASingleLine: 'false'
BinPackArguments: 'false'
BinPackParameters: 'false'
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializers: BeforeColon
AlwaysBreakTemplateDeclarations: Yes
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
DerivePointerAlignment: 'false'
IncludeBlocks: Preserve
IndentCaseLabels: 'false'
IndentWidth: '4'
KeepEmptyLinesAtTheStartOfBlocks: 'true'
MaxEmptyLinesToKeep: '1'
NamespaceIndentation: 'None'
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
SortIncludes: 'true'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeParens: ControlStatements
SpacesInAngles: false
SpacesInContainerLiterals: false
SpaceInEmptyParentheses: 'false'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInParentheses: 'false'
TabWidth: '4'
UseTab: Never
```
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs