@@ -1413,7 +1413,6 @@ namespace Parser {
14131413 let IdentifierConstructor: new (kind: SyntaxKind.Identifier, pos: number, end: number) => Identifier;
14141414 let PrivateIdentifierConstructor: new (kind: SyntaxKind.PrivateIdentifier, pos: number, end: number) => PrivateIdentifier;
14151415 let SourceFileConstructor: new (kind: SyntaxKind.SourceFile, pos: number, end: number) => SourceFile;
1416- let isInTsserver = true;
14171416
14181417 function countNode(node: Node) {
14191418 nodeCount++;
@@ -1660,10 +1659,10 @@ namespace Parser {
16601659 IdentifierConstructor = objectAllocator.getIdentifierConstructor();
16611660 PrivateIdentifierConstructor = objectAllocator.getPrivateIdentifierConstructor();
16621661 SourceFileConstructor = objectAllocator.getSourceFileConstructor();
1663- isInTsserver = (new NodeConstructor(0, 0, 0).constructor.name !== "Node");
16641662
16651663 fileName = normalizePath(_fileName);
16661664 sourceText = _sourceText;
1665+
16671666 languageVersion = _languageVersion;
16681667 syntaxCursor = _syntaxCursor;
16691668 scriptKind = _scriptKind;
@@ -1764,19 +1763,17 @@ namespace Parser {
17641763 return hasJSDoc ? addJSDocComment(node) : node;
17651764 }
17661765
1767- function shouldCheckJSDoc<T extends HasJSDoc>(node: T, comment: ts.CommentRange) {
1768- if (isInTsserver) return true;
1766+ const seeLink = /@(?:see|link)/;
1767+ function shouldParseJSDoc<T extends HasJSDoc>(node: T, comment: ts.CommentRange) {
1768+ if (!(globalThis as any).isTSC) return true;
17691769 if (node.flags & NodeFlags.JavaScriptFile) return true;
1770- const link = sourceText.indexOf("@link", comment.pos);
1771- const see = sourceText.indexOf("@see", comment.pos);
1772- if (comment.pos < link && link < comment.end) return true;
1773- if (comment.pos < see && see < comment.end) return true;
1770+ if (seeLink.test(sourceText.slice(comment.pos, comment.end))) return true;
17741771 }
17751772
17761773 let hasDeprecatedTag = false;
17771774 function addJSDocComment<T extends HasJSDoc>(node: T): T {
17781775 Debug.assert(!node.jsDoc); // Should only be called once per node
1779- const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceText), comment => shouldCheckJSDoc (node, comment) && JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos));
1776+ const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceText), comment => shouldParseJSDoc (node, comment) && JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos));
17801777 if (jsDoc.length) node.jsDoc = jsDoc;
17811778 if (hasDeprecatedTag) {
17821779 hasDeprecatedTag = false;
0 commit comments