GithubHelp home page GithubHelp logo

Comments (4)

cushon avatar cushon commented on July 27, 2024 1

There are some built-in assertions that formatting only changes whitespace, and doesn't add or remove tokens, because it helps guarantee that reformatting will never affect semantics.

There are some similar things we'd like to do for Java, but so far I haven't had great ideas for supporting non-whitespace fixes without adding complexity or regressing guarantees around not making semantic changes.

Another option would be do to this is a separate pass, similar to how import fixes are handled.

from ktfmt.

strulovich avatar strulovich commented on July 27, 2024 1

I'm leaning towards adding an extra pass that would be more aggressive and modify the tree. This will also let us supply a flag for it. I'm against configurations, but removing symbols might be too aggressive for people that call this when they save a file, so it might be useful to support.

@cgrushko, @cushon, how does that sound? We could experiment with ; removal first.

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024

I was surprised to find out that it wasn't simple to do :)
The underlying engine (google-java-format's) makes some assumptions about tokens not changing. @cushon might be able to provide more details (I forgot the explanation he previously gave me :|)

(Maybe if we modified the tokenizer to not emit ; tokens at all? might be an interesting idea.)

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024

Sounds good.
I think we can go ahead with removing ; without a flag.
If we have luck, kotlin-compiler will just tell us that a symbol is redundant.

from ktfmt.

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.