Code Monkey home page Code Monkey logo

Comments (12)

 avatar commented on July 2, 2024

Presumably into alphabetical order.

from fantomas.

ovatsus avatar ovatsus commented on July 2, 2024

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.

dungpa avatar dungpa commented on July 2, 2024

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.

 avatar commented on July 2, 2024

Removing duplicates will be useful.

from fantomas.

ovatsus avatar ovatsus commented on July 2, 2024

This was already done in #51

from fantomas.

ovatsus avatar ovatsus commented on July 2, 2024

Reopening, as I had to disable this because of #73
@dungpa any ideas how we can do this more safely

from fantomas.

dungpa avatar dungpa commented on July 2, 2024

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.

ovatsus avatar ovatsus commented on July 2, 2024

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.

dungpa avatar dungpa commented on July 2, 2024

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.

dungpa avatar dungpa commented on July 2, 2024

@dsyme What do you suggest on this? It seems we can't reorder open statements without losing some comments around them.

from fantomas.

ovatsus avatar ovatsus commented on July 2, 2024

@dungpa any progres on the TokenMatcher changes?

from fantomas.

dungpa avatar dungpa commented on July 2, 2024

Not yet. I will work on that tomorrow.

from fantomas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.