-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
Project Dallas #2626
Project Dallas #2626
Conversation
90% of |
93% |
The names are interesting, but maybe it would be better to use self-evident names to make it easier for other, especially new, contributors? 🙂 |
@auduchinok yup, already part of my to-do list (see above) 😊. |
96% |
98% |
Good morning all 😊, I was able to restore all unit tests of Fantomas.Core! I suspect I'll have the format selection wrapped up by the end of the week. |
Works for |
6c938f2
to
74d0bea
Compare
Co-authored-by: dawe <[email protected]>
22287ab
to
06fc461
Compare
The F# compiler syntax tree. It will always have a special place in my heart and all that but in a lot of cases, it is not the tree Fantomas truly needs to restore the source code.
A couple of shortcomings (from Fantomas' point of view) come to mind:
SourceParser.fs
) to get around that. Think ofDebugPoint
,SynValData
and others.These shortcomings lead to a more complex story than necessary for newcomers.
Our guide on missing code comments is a good example of that. You really need to jump through a lot of hoops to fix this problem.
So, after carefully considering this, we think the situation could be improved by having our own syntax tree. In this PR we are laying the foundation for this. I believe it will unlock some more opportunities in the future due to the new approach.
In short, the premise goes a bit like this:
Node
interface. ANode
can storeTriviaNode
s before and after. (SeeSyntaxOak.fs
)Fangorn.fs
we map the F# compiler AST to this new Node model.Flowering.fs
we insert the found trivia (comments, newline, directives) into the existing tree.CodePrinter2.fs
we traverse the new tree to collect theWriterEvents
At the time of writing, 83% of the unit tests are passing. So, there still is some work left to do.
From a style point of view, we try to keep everything exactly as it was. But due to the size of this refactor, we don't necessarily guarantee that nothing will change. Of course, we will respect the style guide at all times. Some things might just change slightly due to convenience.
From an end-user point of view, this won't really affect the usage of the tool. Some performance will be gained, but I don't expect anything significant.
Some todo items: