Code Style / Format - don't affect wrapping
Hi all
I'm new to WebStorm :) I come from a Visual Studio background. Developing in Angular.
I'm just playing around with the Code Style stuff, which seems pretty good for the most part. I am having a big problem, however.
When I tell it to format my code (Ctrl+Shit+Alt+L), it follows the (rather aggressive) code style rules.
Let's look at HTML, for example. There is a "Wrap attributes" drop-down...
- Do not wrap - this will cause WS to reformat everything to be on the same line.
- Wrap if long - this will cause WS to reformat long lines to wrap.
- Chop down if long - this will cause WS to reformat long lines so that each attribute is on a separate line.
- Wrap always - this will cause WS to reformat everything to be on a separate line.
These are very aggressive rules, and none of them seem to be very good... really, I want to be able to decide which things I want on multiple lines, and which things I want all on the same lines. Currently each of the above result in ugly code.
Do not wrap - forces everything on a single line, even when there are a lot of attributes. Horrible.
Wrap always - forces everything on a separate line, even when there are only a couple. Takes up way too much space.
And the other two optional ones create some very unbalanced looking code, with some different siblings being expanded, and some not, based purely on their line length. Horrible.
I just want a "leave my attribute wrapping alone" option... Visual Studio (And VSCode) works like this, and it's very good. It means you get to decide which things are wrapped and which are not. They will fix up your spacing but not your line breaks. Perfect.
Same goes for Typescript things, like parameters and object definitions. Sometimes you want multiline, other times you do not. But it's often not based purely on line length. That much too simplistic a measure. In reality, there are much more complex things to consider, and I do not expect any IDE to be able to magically know what I want.
For example, I like to have each function separated by a line break. Except for get/set combos. Because they belong together. If I can't set those rules, then I need to just be able to disable WS from touching the line breaks at all, and leave them for me to decide. But this currently is not an option.
Short story - with the way it currently is, I cannot use code formatting in WS, because it ruins our code styles :(
And an IDE without code formatting is a real pain...
Please help :D
Please sign in to leave a comment.
Hi! Your feature requests are welcome in our bug-tracker: http://youtrack.jetbrains.com.