MCPcopy Index your code
hub / github.com/nodejs/node / classifyComment

Function classifyComment

test/fixtures/snapshot/typescript.js:130572–130591  ·  view source on GitHub ↗
(token, kind, start, width)

Source from the content-addressed store, hash-verified

130570 }
130571 }
130572 function classifyComment(token, kind, start, width) {
130573 if (kind === 3 /* SyntaxKind.MultiLineCommentTrivia */) {
130574 // See if this is a doc comment. If so, we'll classify certain portions of it
130575 // specially.
130576 var docCommentAndDiagnostics = ts.parseIsolatedJSDocComment(sourceFile.text, start, width);
130577 if (docCommentAndDiagnostics && docCommentAndDiagnostics.jsDoc) {
130578 // TODO: This should be predicated on `token["kind"]` being compatible with `HasJSDoc["kind"]`
130579 ts.setParent(docCommentAndDiagnostics.jsDoc, token);
130580 classifyJSDocComment(docCommentAndDiagnostics.jsDoc);
130581 return;
130582 }
130583 }
130584 else if (kind === 2 /* SyntaxKind.SingleLineCommentTrivia */) {
130585 if (tryClassifyTripleSlashComment(start, width)) {
130586 return;
130587 }
130588 }
130589 // Simple comment. Just add as is.
130590 pushCommentRange(start, width);
130591 }
130592 function pushCommentRange(start, width) {
130593 pushClassification(start, width, 1 /* ClassificationType.comment */);
130594 }

Callers 1

Calls 3

classifyJSDocCommentFunction · 0.85
pushCommentRangeFunction · 0.85

Tested by

no test coverage detected