Comments (12)
Presumably into alphabetical order.
from fantomas.
Removing unused ones would be a nice extra, but I'm guessing it's much harder to implement, and alphabetical sort would be already very good
from fantomas.
Sorting open statements is easy but removing unused ones is difficult.
The latter requires a type-checking phase which hasn't been implemented in Fantomas yet. I think the feature is in the scope of fsharp-refactor.
from fantomas.
Removing duplicates will be useful.
from fantomas.
This was already done in #51
from fantomas.
Reopening, as I had to disable this because of #73
@dungpa any ideas how we can do this more safely
from fantomas.
We can add special treatments for open declarations in TokenMatcher
module. The module should recognize the whole lines of open declarations and skip them although module names don't match.
from fantomas.
What if there are comments between the open declarations? Before I disabled this feature, this:
//comment about System.IO
open System.IO
//comment about System
open System
Was being turned to this:
//comment about System.IO
open System
//comment about System
open System.IO
Is this acceptable or should we output this instead?
//comment about System
open System
//comment about System.IO
open System.IO
I'm gessing your proposed solution would output this:
//comment about System.IO
//comment about System
open System
open System.IO
Maybe this case is rare enough that even if we don't get it exactly right it's ok.
from fantomas.
Yes, we are more likely to arrive at the last example. The second one is of course ideal.
I will try to improve TokenMatcher and see how far we can go.
from fantomas.
@dsyme What do you suggest on this? It seems we can't reorder open statements without losing some comments around them.
from fantomas.
@dungpa any progres on the TokenMatcher changes?
from fantomas.
Not yet. I will work on that tomorrow.
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.