MCPcopy Index your code
hub / github.com/CopilotKit/CopilotKit / getCleanedCommentsForNode

Method getCleanedCommentsForNode

scripts/docs/lib/comments.ts:4–31  ·  view source on GitHub ↗
(
    node: ts.Node,
    sourceFile: ts.SourceFile,
  )

Source from the content-addressed store, hash-verified

2
3export class Comments {
4 static getCleanedCommentsForNode(
5 node: ts.Node,
6 sourceFile: ts.SourceFile,
7 ): string {
8 const fullText = sourceFile.getFullText();
9 const commentRanges = ts.getLeadingCommentRanges(
10 fullText,
11 node.getFullStart(),
12 );
13
14 if (!commentRanges) return "";
15
16 return commentRanges
17 .map((comment) => {
18 let commentText = fullText.substring(comment.pos, comment.end);
19 commentText = Comments.removeCommentSyntax(commentText);
20
21 // for now, remove @default annotations
22 commentText = commentText
23 .split("\n")
24 .filter((line) => !line.includes("@default"))
25 .join("\n");
26
27 return commentText;
28 })
29 .join("\n")
30 .trim();
31 }
32
33 static getDefaultValueForNode(
34 node: ts.Node,

Callers 2

visitMethod · 0.80
getFirstCommentBlockMethod · 0.80

Calls 3

removeCommentSyntaxMethod · 0.80
filterMethod · 0.80
joinMethod · 0.65

Tested by

no test coverage detected