MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / getCommentForUnions

Function getCommentForUnions

src/telemetryGenerator.node.ts:354–374  ·  view source on GitHub ↗
(t: ts.TypeNode)

Source from the content-addressed store, hash-verified

352 return [];
353}
354function getCommentForUnions(t: ts.TypeNode) {
355 const commentLines = t.getFullText().replace(t.getText(), '').split(/\r?\n/);
356 const comment = commentLines.map((line, index) => {
357 if (index === 0) {
358 line = line.trim().startsWith('/**') ? line.trim().replace('/**', '') : line;
359 }
360 if (commentLines.length === index + 1) {
361 // Last time, remove trailing `*/`
362 return line.trim().endsWith('*/') ? line.trim().replace('*/', '') : line;
363 } else {
364 return line.trim().startsWith('*') ? line.trim().replace('*', '') : line; // CodeQL [SM02383] Replace just the first occurrence of '*'.
365 }
366 });
367
368 // Remove leading empty lines.
369 while (comment.length > 0 && comment[0].trim().length === 0) {
370 comment.shift();
371 }
372
373 return comment.length === 0 ? undefined : comment;
374}
375
376type EventProblem = { eventConstantName: string; problems: string[] };
377

Callers 2

visitFunction · 0.85

Calls 4

getTextMethod · 0.80
mapMethod · 0.80
shiftMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected