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)
- Long parameter attribute gives weird line break before type annotation
- Fantomas corrupts an explicit constructor with `then` clause HOT 2
- FormatASTAsync loses single quotes for characters HOT 4
- Regression: An empty line or comment at the end of a list breaks Stroustrup formatting HOT 2
- `SpaceBeforeUppercaseInvocation` corrupts underscore lambda invocation HOT 1
- Non needed parentheses are added around lambda call from tuple/members HOT 5
- [Feature request] Make newline experience consistent across match branches HOT 1
- Make Fantomas AOT compatible HOT 12
- cannot determine if Expr AppSingleParenArg Fantomas.Core.SyntaxOak+ExprAppSingleParenArgNode is uppercase or lowercase HOT 1
- cannot determine if Expr AppSingleParenArg Fantomas.Core.SyntaxOak+ExprAppSingleParenArgNode is uppercase or lowercase HOT 2
- [Feature request] Keep `interface end` on a single line HOT 1
- Regression since 6.3.5: Shorthand lambda pushes args far out right with name-sensitive alignment; discrepancy with normal lambda HOT 1
- Stroustrup formatting breaks array containing just empty line or comment HOT 1
- [Feature request] Set custom fantomas path on Fantomas.Client HOT 2
- Idempotency problem when adding members to a single case union without a pipe HOT 15
- Allow "--check" to differ with line-endings style
- Fantomas.Client does not respect DOTNET_CLI_HOME env variable HOT 5
- F# Range Operator (..) with negative numbers produces invalid F# code and idempotent HOT 2
- Weird break after Some instead of binary operator
- Project Update
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.