Skip to content

Commit 6b645f5

Browse files
authored
Fix find-refs crash on JSDocNamepath (microsoft#36941)
JSDocNamepaths span a lot of identifiers that we don't actually care about, so it's incorrect for createChildren to add its children as synthetic nodes.
1 parent 7bcb723 commit 6b645f5

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/compiler/utilitiesPublic.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2469,7 +2469,7 @@ namespace ts {
24692469

24702470
/** True if node is of a kind that may contain comment text. */
24712471
export function isJSDocCommentContainingNode(node: Node): boolean {
2472-
return node.kind === SyntaxKind.JSDocComment || isJSDocTag(node) || isJSDocTypeLiteral(node) || isJSDocSignature(node);
2472+
return node.kind === SyntaxKind.JSDocComment || node.kind === SyntaxKind.JSDocNamepathType || isJSDocTag(node) || isJSDocTypeLiteral(node) || isJSDocSignature(node);
24732473
}
24742474

24752475
// TODO: determine what this does before making it public.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*====== /tests/cases/fourslash/renameJSDocNamepath.ts ======*/
2+
3+
/**
4+
* @type {module:foo/A} x
5+
*/
6+
var x = 1
7+
var [|RENAME|] = 0;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @noLib: true
2+
3+
/// <reference path='fourslash.ts'/>
4+
5+
//// /**
6+
//// * @type {module:foo/A} x
7+
//// */
8+
//// var x = 1
9+
//// var /*0*/A = 0;
10+
11+
verify.baselineRename("0", {});

0 commit comments

Comments
 (0)