pub enum KeptDocs {
All,
Last {
joins: fn(&Node<'_>, &Node<'_>, &[u8]) -> bool,
},
Nearest {
hidden: fn(&Node<'_>, &Node<'_>) -> bool,
},
Leading {
hidden: fn(&Node<'_>, &[u8]) -> bool,
joins: fn(&Node<'_>, &Node<'_>, &[u8]) -> bool,
after_code: fn(&Node<'_>) -> bool,
},
}Expand description
Re-exported because the LOC metric bills documentation through them —
Go, Ruby and Lua runs by position, and the doc comments a bound
language’s tool attaches — while the predicates beside them stay
crate-private.
Re-exported because the LOC metric bills documentation through them —
Go, Ruby and Lua runs by position, and the doc comments a bound
language’s tool attaches — while the predicates beside them stay
crate-private.
Re-exported because the LOC metric bills documentation through them —
Go, Ruby and Lua runs by position, and the doc comments a bound
language’s tool attaches — while the predicates beside them stay
crate-private.
Which doc comments of a stretch a DocBinding attaches.
Variants§
All
Every doc comment of the stretch: rustc gives an item all the outer doc comments above it, across blank rows, plain comments and other attributes, which rustdoc concatenates.
Last
The last doc comment before the declaration’s first token, and the
doc comments before it that joins(earlier, later, code) makes one
comment with it: javac’s Token::docComment and Kotlin’s
PrecedingDocCommentsBinder keep the last, and javac’s
dangling-doc-comments lint names the rest. A skipped node is that
first token, a Kotlin annotation the grammar leaves outside its
declaration; when no doc comment precedes it, the first one after
it is read, as findDocComment reads Kotlin’s modifier list.
Fields
Nearest
The stretch’s last comment, if it is a doc comment: Groovy’s
GroovydocManager reads the comment nearest the declaration and
drops it unless it opens /**, so a plain comment in between
detaches it. A comment for which hidden(comment, next) holds,
next being the sibling after it, is invisible to the tool and
read past.
Fields
Whether the tool cannot see a comment.
Leading
What a reverse scan over the declaration’s leading trivia keeps,
from its first token back: past the comments and skipped nodes
hidden(node, code) names to the nearest other comment, kept if it
is a doc comment, then on over the doc comments directly before it
that joins(earlier, later, code) makes one with it. A member
directly before them that is hidden or plain ends the run. A skipped
node hidden does not name is the first token — a decorator the
grammar leaves outside its declaration — so a doc comment after it
documents nothing. Roslyn’s GetDocumentationCommentTriviaFromSyntaxNode
reads past plain comments and directives and keeps adjacent doc
comments; JSDoc’s getLeadingJsdocComment reads past line comments
only; tsc reads past every plain comment.
Fields
Whether the scan reads past a member to the one before it.
joins: fn(&Node<'_>, &Node<'_>, &[u8]) -> boolWhether two adjacent doc comments are one to the tool.
after_code: fn(&Node<'_>) -> boolWhether the tool reads a member on the row where the code
before the stretch ends, asked of the target. tsc’s
getLeadingCommentRanges starts at the line break after the
token before the declaration, so x; /** d */ documents
nothing after it, except before a parameter, whose trailing
comment ranges it reads too; Roslyn and JSDoc read it.