-
-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idempotency problem when reformatting type declaration with large when clause #2896
Comments
Hello, thank you for reporting this issue. I think: fantomas/src/Fantomas.Core/CodePrinter.fs Lines 3065 to 3071 in f95faa9
can probably be simplified to: | Type.WithGlobalConstraints node ->
genType node.Type +> genTypeConstraints node.TypeConstraints
|> genNode node
Are you interested in submitting a PR? |
I can look into it in a few hours, but I'm not familiar with the codebase. |
We have quite some documentation on the codebase at https://fsprojects.github.io/fantomas/docs/contributors/Index.html I think in this case, you can follow the pull request ground rules, add a test in |
No, apparently it doesn't. And i can't even run or debug it in Rider, only in the CLI with this build.fsx script which has a lot of extra output and strips off most of the provided/expected strings in test output. Edit: Also if i just run |
I'm guessing you don't have the right preview SDK on your machine. |
I've installed the preview sdk according to instructions in the docs you've linked to me. The thing i missed is |
Just tried running |
Mmh, that's strange. The
Mmh, that's strange. The |
What change did you expect? Did you do a normal build afterwards? |
Yeah, i did. The change I'm expecting is that |
Okay, maybe let's start all over again. The following steps work for me:
After that, I'm also able to do a |
Yeah, I've just figured out that running build script and then dotnet clean followed by another dotnet restore fixes the problem. |
@nojaf When i was able to look into the output string more closely it became clear that suggested change fixes the problem quite well. I'll open up a PR with that. |
Issue created from fantomas-online
Input code
Formatted code
Reformatted code
Reformatted again
Problem description
Fantomas was not able to produce the same code after reformatting the result.
Extra information
Options
Fantomas v6.1 branch at 1/1/1990
Default Fantomas configuration
Did you know that you can ignore files when formatting by using a .fantomasignore file?
PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.
The text was updated successfully, but these errors were encountered: