Giter Club home page Giter Club logo

Comments (6)

deviousasti avatar deviousasti commented on August 10, 2024 1

Thank you for reporting this, @asik.
I agree with how it should behave - I originally didn't implement it because there might be a save-format-save-format loop, but that's been taken care of. I've published a new version, please update and try it out.

The issue got auto-closed by mentioning it in the commit.
If you still have any issues, feel free to re-open this.

Have a good day!

from fantomas-for-vs.

deviousasti avatar deviousasti commented on August 10, 2024 1

A real-life case of xkcd/1172!
xkcd


@bddckr
These days I use Ctrl-K, Ctrl-D, (keybind for formatting in VS).
Earlier I used exactly the workflow you described - I used to review the changes Fantomas made before hard-saving, because my comments or attributes would get eaten.

I'll make it configurable.

from fantomas-for-vs.

deviousasti avatar deviousasti commented on August 10, 2024 1

Just published 0.7.3 which features an option to not commit changes on save.
Have a nice weekend!

Feel free to reopen or file another issue if you have any more problems.

from fantomas-for-vs.

bddckr avatar bddckr commented on August 10, 2024 1

Thanks! I see what you did there in the Performance section 😆❤️

from fantomas-for-vs.

bddckr avatar bddckr commented on August 10, 2024

Is there a way to make this behavior configurable perhaps? 🙏 The old behavior was really handy for me:

Fantomas has a few bugs I keep running into:

  • fsprojects/fantomas#1388: Forces me to keep peeking at the scrollbar and see if VS shows me any ping-ponging formatting on each save. I then scroll down to each change and have a look at each change to invoke the save once more until it's formatted the way I'd like the file to stay at that point.
  • Various issues that end up removing comments in the code: I often don't want to remove the code I commented out - I'm just doing some changes to test something quickly, without other logic running.

I've turned off formatting on save in the options for now as I no longer have any ability to keep going back to the "correct" state of the file after this change.

E.g. with format on save turned on when I hit save it formats the code and removes the commented code accidentally:

  • Before this change: Just hit Ctrl+Z once to get the file back to the saved state, which is the state I typed, but not the formatted state. This way I can bring back anything Fantomas accidentally did wrong. Once I'm done I will uncomment the code again and can hit save twice for it to format+save, this time with no issues.
  • After this change: I can still undo the formatting changes, but I can't save it as that would format+save again. I have to turn off formatting on save.

While I'm here: Thanks for this extension and all the hard work on it!!!

from fantomas-for-vs.

bddckr avatar bddckr commented on August 10, 2024

Yeah I honestly gotta say formatting specifically triggering formatting is totally fine with me... If only I would stop forgetting to do it before raising PRs! I've yet to make Fantomas part of our CI 😅

Thanks for looking into making it an option, much appreciated!

from fantomas-for-vs.

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.