Keep the lines inside comments verbatim in created interfaces
Why
Since #9144, "create interface" reindents copied declarations to their nesting depth and keeps only lines inside string and template literals verbatim. A multi-line doc comment is the string payload of @res.doc, so shifting its lines changed the documentation: a fenced code block became an indented one and relative indentation collapsed.
literal_lines now also marks the lines inside comments, doc comments and regular block comments alike, so they are copied verbatim.
modifiedFormat created interface of a doc comment in a nested module
module A = { module B = { /** Example:```rescriptlet v: t = 1```*/ type t = int }}
rescript
Before
After
module A: {module A: { module B: { module B: { /** Example: /** Example: ```rescript let v: t = 1 ``` */```rescriptlet v: t = 1```*/ type t = int type t = int } }}}
Review
- What about a comment whose last line continues with code, such as
*/ field: int? The whole line keeps its source indentation, as a line ending a multi-line string literal already does.