-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
Some floating-point numbers are changed #785
Comments
I've dug into this a bit more, and it looks like this is not Fantomas' doing but FSC: https://fsprojects.github.io/fantomas-tools/#/ast?data=N4KABGBEAmCmBmBLAdrAzpAXFSAacUiaAYmolmPAIYA2as%2BEkAxgPZwWQ2wAuYAHmAC8YALQBmAHQAmAIzj4kEAF8gA |
Yes, there seems to be a problem in the FCS indeed, however, there is also a Fantomas one here I believe. Numbers can't be trusted from the AST anyways, so we use trivia to set the correct number, which in this case also didn't happen correctly. |
We detected the number, the problem is somewhere around the assignment of the trivia to a trivia node. Given this insight @ErikSchierboom, could I persuade you to tackle this issue yourself? |
I believe the problem is located in here. Proposed solution: Something along the lines: | minus::head::rest when (minus.TokenInfo.TokenName = "MINUS" && isNumber head) ->
... |
Yeah sure! It will be my pleasure :) I'll work on this tomorrow. |
Great to hear! I recommend you watch https://www.youtube.com/watch?v=FCrkUqCCzgI&list=PLvw_J2kfZCX3Mf6tEbIPZXbzJOD1VGl4K first to have some understanding of what all this trivia fuzz is about. If you were to have any questions, please reach out over here or on the F# foundation slack. |
Will do! Thanks for the links. |
@nojaf I've submitted a PR to fix this. I have one question about how to best implement it, which I've left as a comment in the PR. |
Issue created from fantomas-ui
The value of some floating-point numbers will change when formatting the code. It appears to only apply to negative floating-point numbers:
Code
Result
Options
Fantomas 3.2.0
IndentOnTryWith
false
IndentSpaceNum
4
KeepNewlineAfter
false
MaxIfThenElseShortWidth
40
PageWidth
120
ReorderOpenDeclaration
false
SemicolonAtEndOfLine
false
SpaceAfterComma
true
SpaceAfterSemicolon
true
SpaceAroundDelimiter
true
SpaceBeforeArgument
true
SpaceBeforeColon
false
StrictMode
false
The text was updated successfully, but these errors were encountered: