-
-
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
Print XML Document comments from AST #1878
Comments
Keep in mind that this idea needs to play well with newline trivia. type PostalAddress =
{
/// The address
Address: string
/// The city
City: string
/// The zip code
Zip: string
} Would still need to work. Perhaps the PreXmlDoc should also be considered as trivia node candidate in that scenario. |
XML docs could be integrated into declaration ranges after dotnet/fsharp#11973, would it help Fantomas? Would it make sense to wait until that PR is merged? |
Interesting stuff there, yes is worth the wait for that. |
Be aware that this is valid code: /// DOC COMMENT
// simple comment
// yet anothet simple or (* multiline *) comment
type A = ... |
I've been playing around with this on a local branch using an FCS that has the recent improvements by @DedSec256. The only catch was when you have a regular code comment underneath an XMLDoc. /// doc
// no doc
let a () = 0 To resolve that scenario, it was useful to have the |
Currently, Fantomas is not printing PreXmlDoc (unless in strict mode is active).
Comments are detected as trivia as well so, in order not to print them twice, we don't print PreXmlDoc but print the trivia instead.
This is actually perhaps a bit inefficient as currently, we need to match the trivia with a trivia node.
The PreXmlDoc will always be assigned to the correct node in the tree, so it should be ignored as trivia instead.
Practically, I see an opportunity to capture the ranges of
PreXmlDoc
inASTTransformer
and eliminate trivia content inTrivia.fs
.CodePrinter
would then need an additional change to always print PreXmlDoc.The text was updated successfully, but these errors were encountered: