Skip to content

Commit 309a93c

Browse files
TypeScript BotAndarist
TypeScript Bot
andauthored
🤖 Pick PR #59207 (Fixed crash when finding all refere...) into release-5.5 (#59209)
Co-authored-by: Mateusz BurzyÅ„ski <[email protected]>
1 parent 326cb1f commit 309a93c

9 files changed

+787
-2
lines changed

‎src/services/importTracker.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,10 +785,9 @@ function getContainingModuleSymbol(importer: Importer, checker: TypeChecker): Sy
785785
}
786786

787787
function getSourceFileLikeForImportDeclaration(node: ImporterOrCallExpression): SourceFileLike {
788-
if (node.kind === SyntaxKind.CallExpression) {
788+
if (node.kind === SyntaxKind.CallExpression || node.kind === SyntaxKind.JSDocImportTag) {
789789
return node.getSourceFile();
790790
}
791-
792791
const { parent } = node;
793792
if (parent.kind === SyntaxKind.SourceFile) {
794793
return parent as SourceFile;
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
// === findAllReferences ===
2+
// === /player.js ===
3+
// <|import [|{| defId: 0, isWriteAccess: true |}Component|] from './component.js';|>
4+
//
5+
// /**
6+
// * @extends [|{| defId: 0 |}Component|]/*FIND ALL REFS*/
7+
// */
8+
// export class Player extends [|{| defId: 0 |}Component|] {}
9+
10+
// === /component.js ===
11+
// <|export default class [|{| defId: 1, isWriteAccess: true |}Component|] {
12+
// constructor() {
13+
// this.id_ = Math.random();
14+
// }
15+
// id() {
16+
// return this.id_;
17+
// }
18+
// }|>
19+
20+
// === /spatial-navigation.js ===
21+
// /** <|@import [|{| defId: 2, isWriteAccess: true |}Component|] from './component.js'|> */
22+
//
23+
// export class SpatialNavigation {
24+
// /**
25+
// * @param {[|{| defId: 2 |}Component|]} component
26+
// */
27+
// add(component) {}
28+
// }
29+
30+
// === Definitions ===
31+
// === /player.js ===
32+
// <|import [|{| defId: 0 |}Component|] from './component.js';|>
33+
//
34+
// /**
35+
// * @extends Component/*FIND ALL REFS*/
36+
// */
37+
// export class Player extends Component {}
38+
39+
// === /component.js ===
40+
// <|export default class [|{| defId: 1 |}Component|] {
41+
// constructor() {
42+
// this.id_ = Math.random();
43+
// }
44+
// id() {
45+
// return this.id_;
46+
// }
47+
// }|>
48+
49+
// === /spatial-navigation.js ===
50+
// /** <|@import [|{| defId: 2 |}Component|] from './component.js'|> */
51+
//
52+
// export class SpatialNavigation {
53+
// /**
54+
// --- (line: 5) skipped ---
55+
56+
// === Details ===
57+
[
58+
{
59+
"defId": 0,
60+
"containerKind": "",
61+
"containerName": "",
62+
"kind": "alias",
63+
"name": "(alias) class Component\nimport Component",
64+
"displayParts": [
65+
{
66+
"text": "(",
67+
"kind": "punctuation"
68+
},
69+
{
70+
"text": "alias",
71+
"kind": "text"
72+
},
73+
{
74+
"text": ")",
75+
"kind": "punctuation"
76+
},
77+
{
78+
"text": " ",
79+
"kind": "space"
80+
},
81+
{
82+
"text": "class",
83+
"kind": "keyword"
84+
},
85+
{
86+
"text": " ",
87+
"kind": "space"
88+
},
89+
{
90+
"text": "Component",
91+
"kind": "aliasName"
92+
},
93+
{
94+
"text": "\n",
95+
"kind": "lineBreak"
96+
},
97+
{
98+
"text": "import",
99+
"kind": "keyword"
100+
},
101+
{
102+
"text": " ",
103+
"kind": "space"
104+
},
105+
{
106+
"text": "Component",
107+
"kind": "aliasName"
108+
}
109+
]
110+
},
111+
{
112+
"defId": 1,
113+
"containerKind": "",
114+
"containerName": "",
115+
"kind": "class",
116+
"name": "class Component",
117+
"displayParts": [
118+
{
119+
"text": "class",
120+
"kind": "keyword"
121+
},
122+
{
123+
"text": " ",
124+
"kind": "space"
125+
},
126+
{
127+
"text": "Component",
128+
"kind": "className"
129+
}
130+
]
131+
},
132+
{
133+
"defId": 2,
134+
"containerKind": "",
135+
"containerName": "",
136+
"kind": "alias",
137+
"name": "(alias) class Component\nimport Component",
138+
"displayParts": [
139+
{
140+
"text": "(",
141+
"kind": "punctuation"
142+
},
143+
{
144+
"text": "alias",
145+
"kind": "text"
146+
},
147+
{
148+
"text": ")",
149+
"kind": "punctuation"
150+
},
151+
{
152+
"text": " ",
153+
"kind": "space"
154+
},
155+
{
156+
"text": "class",
157+
"kind": "keyword"
158+
},
159+
{
160+
"text": " ",
161+
"kind": "space"
162+
},
163+
{
164+
"text": "Component",
165+
"kind": "aliasName"
166+
},
167+
{
168+
"text": "\n",
169+
"kind": "lineBreak"
170+
},
171+
{
172+
"text": "import",
173+
"kind": "keyword"
174+
},
175+
{
176+
"text": " ",
177+
"kind": "space"
178+
},
179+
{
180+
"text": "Component",
181+
"kind": "aliasName"
182+
}
183+
]
184+
}
185+
]
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
// === findAllReferences ===
2+
// === /player.js ===
3+
// <|import { [|{| defId: 0, isWriteAccess: true |}Component|] } from './component.js';|>
4+
//
5+
// /**
6+
// * @extends [|{| defId: 0 |}Component|]/*FIND ALL REFS*/
7+
// */
8+
// export class Player extends [|{| defId: 0 |}Component|] {}
9+
10+
// === /component.js ===
11+
// <|export class [|{| defId: 1, isWriteAccess: true |}Component|] {
12+
// constructor() {
13+
// this.id_ = Math.random();
14+
// }
15+
// id() {
16+
// return this.id_;
17+
// }
18+
// }|>
19+
20+
// === /spatial-navigation.js ===
21+
// /** <|@import { [|{| defId: 2, isWriteAccess: true |}Component|] } from './component.js'|> */
22+
//
23+
// export class SpatialNavigation {
24+
// /**
25+
// * @param {[|{| defId: 2 |}Component|]} component
26+
// */
27+
// add(component) {}
28+
// }
29+
30+
// === Definitions ===
31+
// === /player.js ===
32+
// <|import { [|{| defId: 0 |}Component|] } from './component.js';|>
33+
//
34+
// /**
35+
// * @extends Component/*FIND ALL REFS*/
36+
// */
37+
// export class Player extends Component {}
38+
39+
// === /component.js ===
40+
// <|export class [|{| defId: 1 |}Component|] {
41+
// constructor() {
42+
// this.id_ = Math.random();
43+
// }
44+
// id() {
45+
// return this.id_;
46+
// }
47+
// }|>
48+
49+
// === /spatial-navigation.js ===
50+
// /** <|@import { [|{| defId: 2 |}Component|] } from './component.js'|> */
51+
//
52+
// export class SpatialNavigation {
53+
// /**
54+
// --- (line: 5) skipped ---
55+
56+
// === Details ===
57+
[
58+
{
59+
"defId": 0,
60+
"containerKind": "",
61+
"containerName": "",
62+
"kind": "alias",
63+
"name": "(alias) class Component\nimport Component",
64+
"displayParts": [
65+
{
66+
"text": "(",
67+
"kind": "punctuation"
68+
},
69+
{
70+
"text": "alias",
71+
"kind": "text"
72+
},
73+
{
74+
"text": ")",
75+
"kind": "punctuation"
76+
},
77+
{
78+
"text": " ",
79+
"kind": "space"
80+
},
81+
{
82+
"text": "class",
83+
"kind": "keyword"
84+
},
85+
{
86+
"text": " ",
87+
"kind": "space"
88+
},
89+
{
90+
"text": "Component",
91+
"kind": "aliasName"
92+
},
93+
{
94+
"text": "\n",
95+
"kind": "lineBreak"
96+
},
97+
{
98+
"text": "import",
99+
"kind": "keyword"
100+
},
101+
{
102+
"text": " ",
103+
"kind": "space"
104+
},
105+
{
106+
"text": "Component",
107+
"kind": "aliasName"
108+
}
109+
]
110+
},
111+
{
112+
"defId": 1,
113+
"containerKind": "",
114+
"containerName": "",
115+
"kind": "class",
116+
"name": "class Component",
117+
"displayParts": [
118+
{
119+
"text": "class",
120+
"kind": "keyword"
121+
},
122+
{
123+
"text": " ",
124+
"kind": "space"
125+
},
126+
{
127+
"text": "Component",
128+
"kind": "className"
129+
}
130+
]
131+
},
132+
{
133+
"defId": 2,
134+
"containerKind": "",
135+
"containerName": "",
136+
"kind": "alias",
137+
"name": "(alias) class Component\nimport Component",
138+
"displayParts": [
139+
{
140+
"text": "(",
141+
"kind": "punctuation"
142+
},
143+
{
144+
"text": "alias",
145+
"kind": "text"
146+
},
147+
{
148+
"text": ")",
149+
"kind": "punctuation"
150+
},
151+
{
152+
"text": " ",
153+
"kind": "space"
154+
},
155+
{
156+
"text": "class",
157+
"kind": "keyword"
158+
},
159+
{
160+
"text": " ",
161+
"kind": "space"
162+
},
163+
{
164+
"text": "Component",
165+
"kind": "aliasName"
166+
},
167+
{
168+
"text": "\n",
169+
"kind": "lineBreak"
170+
},
171+
{
172+
"text": "import",
173+
"kind": "keyword"
174+
},
175+
{
176+
"text": " ",
177+
"kind": "space"
178+
},
179+
{
180+
"text": "Component",
181+
"kind": "aliasName"
182+
}
183+
]
184+
}
185+
]

0 commit comments

Comments
 (0)