You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 18, 2020. It is now read-only.
I believe the state-of-the art in this space is what I describe here scalameta/scalameta#1137 (comment) I've been meaning to either move the scala-syntax repo to scalafmt or scalameta. This would allow users to write Tree.transform and where applicable explicitly copy over comments where important tree nodes are deconstructed into other trees.
@olafurpg I have a rough idea that should work for scaladoc comments only...
The new backend uses a tree of "Contexts", it's almost done and should be this weekend.
The GeneratorInputContext contains input tree, generators to apply, soon the semantic api etc.
This get's turned into a GeneratorOutputContext which contains the input + the result.
The plan
Get the ADT of the the scaladoc for each Defn/Decl in the tree when converting from Tree -> GeneratorInputContext and add it as a field GeneratorInputContext
Allow the user to update the scaladoc for a given Defn/Decl and enable/disable scaladoc preservation.
Have a Show[Syntax] instance for GeneratorOutputContext which can handle doc comments.
Notes:
This definitely would not be easy, the retaining of doc is easy, but generating the syntax would be harder.
This would only work for the annotee, or untransformed tree's, not subtrees that have been transformed, although its possible we might be able to tweak it to be slightly more general.
Mentioned it gitter multiple times.
We will need to either pull in scalafix and/or handle it with a scalameta/contrib patch for transforming trees while retaining comments.
The text was updated successfully, but these errors were encountered: