* 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)
| 852 | * same symbol, and the column holds free text (#1905). |
| 853 | */ |
| 854 | private docstringFor(node: SyntaxNode): string | undefined { |
| 855 | const anchor = this.extractor?.getDeclarationWrapper?.(node) ?? node; |
| 856 | const preceding = getPrecedingDocstring( |
| 857 | anchor, |
| 858 | this.source, |
| 859 | this.extractor?.docstringStepOverTypes, |
| 860 | this.extractor?.docstringSkipsTrailingComments, |
| 861 | this.extractor?.docstringSkipsDetachedComments, |
| 862 | this.extractor?.docstringSkipsDirectives |
| 863 | ); |
| 864 | const body = this.extractor?.getBodyDocstring?.(node, this.source); |
| 865 | if (preceding && body) return `${preceding}\n\n${body}`; |
| 866 | return body || preceding; |
| 867 | } |
| 868 | |
| 869 | private filePath: string; |
| 870 | private language: Language; |
no test coverage detected