Skip to content

Commit 8d5aaf8

Browse files
authored
avoid creating syntax nodes for jsdoc comment tags (#10526)
1 parent bab4a52 commit 8d5aaf8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/services/services.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,14 @@ namespace ts {
280280
let pos = this.pos;
281281
const useJSDocScanner = this.kind >= SyntaxKind.FirstJSDocTagNode && this.kind <= SyntaxKind.LastJSDocTagNode;
282282
const processNode = (node: Node) => {
283-
if (pos < node.pos) {
283+
const isJSDocTagNode = isJSDocTag(node);
284+
if (!isJSDocTagNode && pos < node.pos) {
284285
pos = this.addSyntheticNodes(children, pos, node.pos, useJSDocScanner);
285286
}
286287
children.push(node);
287-
pos = node.end;
288+
if (!isJSDocTagNode) {
289+
pos = node.end;
290+
}
288291
};
289292
const processNodes = (nodes: NodeArray<Node>) => {
290293
if (pos < nodes.pos) {
@@ -299,10 +302,6 @@ namespace ts {
299302
processNode(jsDocComment);
300303
}
301304
}
302-
// For syntactic classifications, all trivia are classcified together, including jsdoc comments.
303-
// For that to work, the jsdoc comments should still be the leading trivia of the first child.
304-
// Restoring the scanner position ensures that.
305-
pos = this.pos;
306305
forEachChild(this, processNode, processNodes);
307306
if (pos < this.end) {
308307
this.addSyntheticNodes(children, pos, this.end);

0 commit comments

Comments
 (0)