* 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)
| 823 | * same symbol, and the column holds free text (#1905). |
| 824 | */ |
| 825 | private docstringFor(node: SyntaxNode): string | undefined { |
| 826 | const anchor = this.extractor?.getDeclarationWrapper?.(node) ?? node; |
| 827 | const preceding = getPrecedingDocstring( |
| 828 | anchor, |
| 829 | this.source, |
| 830 | this.extractor?.docstringStepOverTypes, |
| 831 | this.extractor?.docstringSkipsTrailingComments, |
| 832 | this.extractor?.docstringSkipsDetachedComments, |
| 833 | this.extractor?.docstringSkipsDirectives |
| 834 | ); |
| 835 | const body = this.extractor?.getBodyDocstring?.(node, this.source); |
| 836 | if (preceding && body) return `${preceding}\n\n${body}`; |
| 837 | return body || preceding; |
| 838 | } |
| 839 | |
| 840 | private filePath: string; |
| 841 | private language: Language; |
no test coverage detected