* The node's prose, from either place it can live: a preceding comment * sibling (every language) or a docstring inside the body (Python's bare * first-statement string, and the same shape in other languages that opt in * via `getBodyDocstring`). When a node carries both, they are joined ra
(node: SyntaxNode)
| 868 | * same symbol, and the column holds free text (#1905). |
| 869 | */ |
| 870 | private docstringFor(node: SyntaxNode): string | undefined { |
| 871 | const anchor = this.extractor?.getDeclarationWrapper?.(node) ?? node; |
| 872 | const preceding = getPrecedingDocstring( |
| 873 | anchor, |
| 874 | this.source, |
| 875 | this.extractor?.docstringStepOverTypes, |
| 876 | this.extractor?.docstringSkipsTrailingComments, |
| 877 | this.extractor?.docstringSkipsDetachedComments, |
| 878 | this.extractor?.docstringSkipsDirectives |
| 879 | ); |
| 880 | const body = this.extractor?.getBodyDocstring?.(node, this.source); |
| 881 | if (preceding && body) return `${preceding}\n\n${body}`; |
| 882 | return body || preceding; |
| 883 | } |
| 884 | |
| 885 | private filePath: string; |
| 886 | private language: Language; |
no test coverage detected