Code Style for Objects?
Hello,
for Code Style settings:
Can I indent the ternary signs?
Why is the "backgroundColor" object not wrapped? (Objects: Wrap always is enabled)
Can I fix the wrong intentation of the closing bracket of the "textDecoration" object?
Thank you.
This is from a .ts file after formatting:
function rowStyle(reference) {
return reference.isVisible
? {backgroundColor: 'dd'}
: {
textDecoration: 'line-through',
color: 'gray'
};
}
Please sign in to leave a comment.
>Can I indent the ternary signs?
not sure I follow you.. aren't they indented?
>Why is the "backgroundColor" object not wrapped?
how is it expected to be wrapped? it is a simple object with a single key only
>Can I fix the wrong intentation of the closing bracket of the "textDecoration" object?
it's correctly indented for me - aligned with `?` and `:` (I'm using default settings + Objects: Wrap always):
sorry bad example.
take
now enable always wrap objects and ternaries, align ternaries when multiline, and align ? and :
I get this
but that is what I would expect:
When it says "wrap always" for Objects I would expect this also for single lines objects (like with single line ifs in brackets).
Try disabling Align when multiline for ternary operators - formatting results look better for me when it's off:
As for wrapping single line objects, there should be a separate option for putting braces on new lines, https://youtrack.jetbrains.com/issue/WEB-7122