Auto-formatter is too opinionated #583
Replies: 4 comments
-
I was able to disable the auto-format on saving by changing following part of
After reloading vscode, I was still able to have the syntax highlighting (and other helpful hints) without being forced to use the auto-formatting. I am nervous about using this as a permanent solution though because if the extension is ever updated without me realizing, my code will be auto-formatted again on saving. Since formatting can still be done using |
Beta Was this translation helpful? Give feedback.
-
@fallen-icarus The auto-formatter will never be configurable and the whole point of them is to have a unified kind of experience. Before most languages had formatters teams would waste countless hrs arguing about style and ad-hoc tools start to manifest. Like it or not opinionated formatting is more or less the industry standard at this point. That said I understand some formatters allow for some level of configuration but we are not interested in supporting that at all. Regardless of how objective people may try to present arguments for one formatting or another it's important to understand that this is actually a very subjective topic, so what you see if what you get here. Now specifically in regards to some of the formatting that you are not a fan of, I am also NOT a fan of it either. I plan on removing the forced newline on assignments sometime this week or next. And we are aware of some issues around comments and chained booleans |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response. I'll try the formatter again after the changes are finished. Feel free to close this issue unless you see a reason for keeping it open. |
Beta Was this translation helpful? Give feedback.
-
I'll keep it open until I address all your concerns. Thanks for reporting :) |
Beta Was this translation helpful? Give feedback.
-
For reference, I am using VSCode with the aiken extension.
What is your idea? Provide a use case.
Either:
Why is it a good idea?
The auto-formatter is very opinionated about how the code and comments should be formatted and not all developers will likely agree with these choices. The main two scenarios that come to mind are line wrapping and comments.
Line wrapping
Consider this code:
The moment I hit ctrl-s, it gets re-formatted to:
This applies to
let
bindings as well. I personally prefer to read code horizontally (within reason) like a book such as:To me, this is much easier to read than vertically such as:
There does not seem to be an easy way to disable this without also disabling the aiken syntax highlighting.
Comments
When I write code, I like to comment what each line is doing above that line of code. As an example:
The auto-formatter re-formats that to this:
I could possibly always put the comments after the code like this:
The auto-formatter seems to leave this alone. However, this is not always feasible since long comments will quickly go off the screen. There seems to be no way to include paragraphs of comments in this manner. I tried adding an extra
/
to the comment I wanted to be left alone such as:And the auto-formatter deleted that comment.
What is the current alternative and why is it not good enough?
Disable the aiken extension but this also disables the syntax highlighting. I feel like I am flying blind without the syntax highlighing...
EDIT: I felt like my original version made me come across like a jerk which wasn't my intention. Apologies if anyone felt that way.
Beta Was this translation helpful? Give feedback.
All reactions