Git Product home page Git Product logo

Comments (15)

deviousasti avatar deviousasti commented on May 24, 2024 2

Dear @davidspiess and @kodfodrasz

I've shipped a better diff model which is line-ending agnostic, and also results in smaller diffs.
Could you please update (to 0.8.3) and let me know how it works now (with Apply As Diff turned on)?

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024 1

Ah, so that's definitely the suspect. It should really be line-ending agnostic - I'm currently using the Diffplex library.
Issue #13 is also related to the diffing library. Maybe it's time to try some alternatives.

I'll try to work on a fix soon, so in the mean time could you please adjust with the diff turned off?

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024 1

I can see where it breaks - that's a good repro.

P.S.
If you're trying advent of code, I'd like to recommend F# Worksheet.
https://github.com/deviousasti/fsharp-worksheet

It makes exploratory coding fairly fun.

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024 1

Just pushed 0.8.4 which shrinks the diff before applying to the edit buffer, hopefully fixing #13.
Thanks for the report!

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024

Hi Gábor,

First off, thank you for providing such a detailed report.
We can rule out a number of cases just based on that.

I'm not able to reproduce the problem, unfortunately.
I'm on VS 16.9 Preview 4.

Could you try toggling the formatter version - if it's Latest, it's on 4.4.0 beta 8 and Stable it's on 4.3.0 .
image

from fantomas-for-vs.

kodfodrasz avatar kodfodrasz commented on May 24, 2024

Hi!

I have ran sfc /scannow, and Repair on the Visual Studio installation from the Visual Studio Installer, just in case. Reinstalled the extension afterwards.

I have tried both Stable and Latest versions. Both exhibit the same erroneous behavior.

I have updated fantomas to latest stable version (4.4.0), and it still does not exhibit problematic behavior, it formats the files as expected.

from fantomas-for-vs.

kodfodrasz avatar kodfodrasz commented on May 24, 2024

After having poked around the options the "Apply As Diff" option seems to be the problematic part. When disabling it the formatter works as expected. (albeit whole file is marked as changed).

I'm using UNIX file endings in many projects. Maybe that can be the cause of some offset problems when calculating the diff?

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024

Yikes, that sounds pretty off.

Could you try downloading this and try formatting it?
https://www.dropbox.com/s/59iapleqviuo8r8/Program.fsx?dl=1
This is CRLF and UTF-8 BOM.

Another thing you can do is try to set Apply As Diff to False.

from fantomas-for-vs.

kodfodrasz avatar kodfodrasz commented on May 24, 2024

For now I have set Apply As Diff to false, as the tool working from the IDE instead of running fantomas manually from the cli is worth way more for me than the correctly colored margins on VS editor. 🙂

When reenabling the Apply As Diff the example file is properly formatted.

The following file (the original I extracted the repro example, but in verbatim binary copy) is still incorrectly formatted:

http://files.kodfodrasz.net/Day7.fs

This is UTF-8 NO-BOM, LF line endings.

from fantomas-for-vs.

davidspiess avatar davidspiess commented on May 24, 2024

Same problem as @kodfodrasz. Disabling Apply As Diff fixed it for me too!

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024

@davidspiess The same Unix line-endings as well?

from fantomas-for-vs.

davidspiess avatar davidspiess commented on May 24, 2024

@deviousasti yes, this is my editorconfig:

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

from fantomas-for-vs.

davidspiess avatar davidspiess commented on May 24, 2024

@deviousasti it formats correctly, thank you!

from fantomas-for-vs.

kodfodrasz avatar kodfodrasz commented on May 24, 2024

I have just tired it. The previously problematic file was formatted perfectly. Will test it further in the next days, but for the glimpse it seems like the problem is solved!

Thank you very much!

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024

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.