MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / docstringFor

Method docstringFor

src/extraction/tree-sitter.ts:871–884  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

869 * same symbol, and the column holds free text (#1905).
870 */
871 private docstringFor(node: SyntaxNode): string | undefined {
872 const anchor = this.extractor?.getDeclarationWrapper?.(node) ?? node;
873 const preceding = getPrecedingDocstring(
874 anchor,
875 this.source,
876 this.extractor?.docstringStepOverTypes,
877 this.extractor?.docstringSkipsTrailingComments,
878 this.extractor?.docstringSkipsDetachedComments,
879 this.extractor?.docstringSkipsDirectives
880 );
881 const body = this.extractor?.getBodyDocstring?.(node, this.source);
882 if (preceding && body) return `${preceding}\n\n${body}`;
883 return body || preceding;
884 }
885
886 private filePath: string;
887 private language: Language;

Callers 15

extractFunctionMethod · 0.95
extractClassMethod · 0.95
extractMethodMethod · 0.95
extractInterfaceMethod · 0.95
extractAggregateMethod · 0.95
extractEnumMethod · 0.95
extractPropertyMethod · 0.95
extractFieldMethod · 0.95

Calls 1

getPrecedingDocstringFunction · 0.90

Tested by

no test coverage detected