Replies: 4 comments 3 replies
|
Could you try in the fsharp_blank_lines_around_nested_multiline_expressions = false
fsharp_max_array_or_list_width = 100
fsharp_max_value_binding_width = 100That should solve your problem. |
|
Assuming you meant In order to allow this kind of formatting, I have to check in We could, of course do that, but my point is rather that in my experience, the best way to format a particular block of code is context-dependent. I don't believe that one universal formatting convention is appropriate, but that's just my opinion. I can live with the situation as it is, but wanted to bring up the question. |
|
As to the underlying question: First of all, I completely agree with you that you should be able to give formatting "semantic meaning". If the autoformat process interferes with this we should try to fix this. As to why in the first place, this is about readability as well. When you have a consistent formatting scheme reading the code should become easier as it will be more predictable from the pattern of the code what the code is. But also, it makes editing the code easier. For example, if some one was going to use cramped style for list expressions and you want to copy paste that code block with a different indentation, that breaks syntax. In that past that was really annoying. Finally, the |
|
@7sharp9 : I have created a Could you give this a try? Also: the old lf vs CRLF issue. Not sure if we handle this correctly. I always forget how this exactly works. As long as it doesn't pollute the git commits. |
Uh oh!
There was an error while loading. Please reload this page.
It took a few Git commits before it dawned on me that, as the contribution guideline explains, code is auto-formatted on each commit.
Mostly, I don't mind.
Some of the rules, however, strike me as less than useful. One example is that the formatter seems to insist on adding a newline before or after each list/array expression. I can't quite figure out what the rule is, and scanning the Fantomas documentation hasn't much helped. Perhaps I'm just not looking closely enough, or in the wrong place...
In any case, I was writing a unit test like this:
Although top-heavy, it follows my simple heuristic for formatting tests according to the AAA pattern: There are three distinct sections of the test, each demarcated by a blank line.
Once committed, however, this test becomes:
The test now contains five 'sections', and at a glance it's not clear what belongs where.
One may, of course, follow the heuristic and consequently add comments to delineate the three phases:
This just seems unnecessarily verbose for no apparent reason.
To be clear, I can appreciate consistency in coding style, but there's an argument to be made for allowing a degree of freedom. Here, for example, I find that the best code layout is contextual. What may work well in a function may not be optimal in a test.
Does using an auto-formatter solve a real problem?
All reactions