MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / cloneJsDoc

Function cloneJsDoc

packages/alphatab/scripts/JsonDeclarationEmitter.ts:102–128  ·  view source on GitHub ↗
(node: T, source: ts.Node, additionalTags: string[])

Source from the content-addressed store, hash-verified

100}
101
102function cloneJsDoc<T extends ts.Node>(node: T, source: ts.Node, additionalTags: string[]): T {
103 const docs = ts
104 .getJSDocCommentsAndTags(source)
105 .filter(s => ts.isJSDoc(s))
106 .map(s => s.getText()) as string[];
107
108 for (let text of docs) {
109 if (text.startsWith('/**')) {
110 text = text
111 .substring(2, text.length - 2)
112 .split('\n')
113 .map(l => ` ${l.trimStart()}`)
114 .join('\n')
115 .trimStart();
116
117 for (const tag of additionalTags) {
118 if (!text.includes(tag)) {
119 text += `* ${tag}\n `;
120 }
121 }
122 }
123
124 node = ts.addSyntheticLeadingComment(node, ts.SyntaxKind.MultiLineCommentTrivia, text, true);
125 }
126
127 return node;
128}
129
130function createJsonMember(
131 program: ts.Program,

Callers 2

createJsonMemberFunction · 0.85

Calls 4

filterMethod · 0.80
includesMethod · 0.80
mapMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected