TrailingCommentNormalizer
com.colofabrix.scala.dixtra.normalize.TrailingCommentNormalizer
object TrailingCommentNormalizer
Trailing comments: the one-line comments at the end of a line of code.
A trailing comment never counts in the width of its line, so the code before it never breaks because of it. Two passes change where it goes:
- moveAbove, with
overflow.trailing-comment = move-above: a line that goes past the maximum width with its trailing comment gets the comment on a line of its own above, at the indent of the line. When the line above is a//comment, an empty//line keeps the two comments apart, so that the comment reflow does not join them. - align, with
alignment.trailing-comments: the trailing comments of consecutive lines start on one column, one space after the longest code. A line that would go past the maximum width once aligned stays as it is, and the lines before and after it align separately.
Both passes are token-aware; if the text cannot be tokenised, it is returned unchanged (safety net).
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Members list
In this article