-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to format without regard to input line breaks #1627
Comments
@olafurpg @tanishiking @poslegm need recommendation on this proposal.
|
Personally I don't need this changes. And I never heard feedback about scalafmt from my teammates with something like it. But right now I'm only speaking for myself, not for the best solution for everyone.
I strongly prefer forcing users to multiline blocks every time. So my only wish for potential changes is the configuration flag to keep current behavior.
I am completely OK with splitting big changes into couple of small releases |
@kitbellew I am mostly aligning with the sentiments of @olafurpg in the series of comments in #1560 My first impression of Scala gives a better approach with nested functions, and order can make the code more readable and tools can alphabetize the methods, functions etc. so they don't need to be that way in the actual code. This is a bit off base but may help with my philosophy. There are a sort of good, okay and bad categories of code formatting and if automated and in the first two, all is good. Bad is when the code is harder to read but of course this is also subjective based on what you are used to. I wish there were pretty much a no options approach except for maybe line length and a few other basic independent options. Now that I am trying to maintain a I do see a need to allow code to not wrap during formatting if basic things like internal spacing and line length are ok. The reverse to inline code may also be desirable. The problem I see is that then both of these styles could be in the code base and then a reviewer could say "I like the compact style, or I like the block style" and thus you are back to custom formatting or spending allot of time playing with options. Hope this is helpful. |
While previously we were trying to keep blocks without line breaks if that's how they were originally input, now we actively attempt to take a multi-line representation and fold it into a single line (fold), or take a single-line representation and unfold it into multiple lines (unfold). Fixes scalameta#271 scalameta#1002 scalameta#1043 Helps with scalameta#1627
Looks like it's done :) |
To avoid frequent discussions in code review requesting formatting changes in the code to induce
scalafmt
to produce different output, I would like to introduce an option to format input and ignore input newlines (except adjacent to comments).Propose 4 options:
As this requires a lot of changes, I'd like to consider this option as work-in-progress until all changes have been merged, and larger community had time to comment. It will not be subject to edition guards until the logic has been finalized and declared completed.
NB: Follow-on to #1560
The text was updated successfully, but these errors were encountered: