Skip to content
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

Expose SyntaxOak API #2711

Closed
nojaf opened this issue Jan 13, 2023 · 1 comment
Closed

Expose SyntaxOak API #2711

nojaf opened this issue Jan 13, 2023 · 1 comment
Labels

Comments

@nojaf
Copy link
Contributor

nojaf commented Jan 13, 2023

Fantomas.Core currently exposes a way to generate source code by passing in a raw syntax tree.
This syntax tree (from FSharp.Compiler.Syntax in Fantomas.FCS) will internally be transformed into a SyntaxOak (in ASTTransformer).

We could make the SyntaxOak public (in 5.2 it is internal) and expose a method to format an Oak to string.
Additionally, we could have another method that parses a string to an Oak.

Tools that use Fantomas today for code generation could benefit from this as our Oak model is easier to reason with.

Only the new methods in CodeFormatter would be considered part of the stable API. The exact Oak model types will be forever in flux according to the needs of Fantomas. The API won't be considered broken if any of those underlying types change.

Nor will Fantomas provide any DSL to easily construct nodes in our Oak model, that would all be the consumer's responsibility.

//cc @edgarfgp

@nojaf nojaf added the v6 label Jan 13, 2023
@nojaf nojaf mentioned this issue Jan 13, 2023
10 tasks
@nojaf
Copy link
Contributor Author

nojaf commented Apr 13, 2023

Available in v6.

@nojaf nojaf closed this as completed Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant