Comments (11)
The rationale behind this is:
- You can merge two lines of record files into one without inserting
;
- It's safer. The code can still be parsed if indentation is slightly off or there are some comments being inserted.
- I did this due to my subjective view
@dsyme What do you think about this?
from fantomas.
In C# I always leave trailing commas in enums and object initializers because of the first reason you gave, but in F# for some reason I don't like trailing semi colons. I usually split list expressions into multiple lines (unless it's a very small list) just to not have to put them. Maybe it's just a semicolon trauma :)
from fantomas.
I'm convinced. Will update accordingly.
from fantomas.
I sent @dungpa an email about the formatting defaults. I recommended
* 4 space indent by default, and make this an adjustable option
* Space Before Colon false
* Semicolon at End of Line false
from fantomas.
It would also be nice if fantomas could detect the number of space indents being used in each file, similar to what sublime test does. I usually use 4 spaces, but Tomas likes to use 2 in FSharp.Data, so I'll probably be doing a lot of switching
from fantomas.
About indent size, it is adjustable but in another dialog http://msdn.microsoft.com/en-us/library/ms165330(v=vs.80).aspx
It's the way Ivan implemented in the initial version. I think it is reasonable and consistent with VS editors.
from fantomas.
Oh I see. Hmmm... I personally use "2 space" for the TAB [ actually I mean Indent ] setting in Visual Studio, but actually indent F# code by 4 spaces. This means I use TAB twice to indent the 4 spaces. But that's not what most people will be doing, so what you have makes sense.
I'll try switching to 4 space TAB [ actually I mean Indent ] settings when using Fantomas.
from fantomas.
No. You just need to change "Indent size" option to 4
and keep Tab size
to be 2
. I don't know how Indent size
and Tab size
interplay in VS editors.
from fantomas.
Right, where I said "TAB" I meant to say "Indent". The TAB size setting in Visual Studio is essentially irrelevant for F# code.
from fantomas.
In MonoDevelop Im in the middle I always use three spaces :)
from fantomas.
Steps to fix if anyone would like to handle this issue:
- Change default value of
SemicolonAtEndOfLine
tofalse
in https://github.com/dungpa/fantomas/blob/master/src/Fantomas/FormatConfig.fs#L28. - Fix failing unit tests
from fantomas.
Related Issues (20)
- MultiLineBracketStyle does not work - Settings are just ignored HOT 1
- Invalid code: moved line comment
- [Feature request] Add before/after information to trivia in online tool HOT 1
- Idempotency problem when <add use-case>
- "fantomas --recurse" creates a "--recurse" directory HOT 11
- Inserts unnecessary parentheses
- List expression items don't respect fsharp_blank_lines_around_nested_multiline_expressions
- Semicolon separators should be added when formating a multiline record HOT 2
- Space inserted before final > in type parameter
- MaxDotGetExpressionWidth seems to have no effect on this code
- MultiLineLambdaClosingNewline unnecessarily breaks parameter list HOT 5
- Different infix operators not aligned/broken correctly HOT 4
- Removes space between operator and parenthesized argument in static member operator definition
- Invalid location of comma when using named parameters for a class HOT 2
- Insertion of a newline changes precedence of the `||>` operator HOT 1
- Incorrect indentation of compiler-conditional accessibility modifier for module definition HOT 2
- [Stroustrup] Comment above the record bracket beaks formatting when `MultilineBracketStyle` is `Stroustrup`
- Fantomas strips quotes from quoted type-parameters HOT 2
- Tupled parameter wrapped in conditional directive
- Online formatter URLs do not remember stroustrup HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fantomas.