Commit ea5dfc9
fix(ts-plugin): narrow Go to Definition results to tokens declared in the current module (#364)
When `namedExports: false`, Go to Definition for tokens imported via
`@value val from './other.module.css'` additionally returned the
re-export location (the `@value ... from ...` line) alongside the
original definition. Re-export locations aren't declarations and
shouldn't show up as definitions.
For definitions pointing into a CSS module, keep only those that match
a token in `cssModule.localTokens` — the set of tokens actually
declared in that module. Zero-length spans (module-level references
such as `import styles from '...'`) are preserved as an exception.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent e1f2983 commit ea5dfc9
3 files changed
Lines changed: 33 additions & 60 deletions
File tree
- .changeset
- packages/ts-plugin
- e2e-test/feature
- src/language-service/feature
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 4 additions & 40 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
230 | | - | |
231 | 229 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | 230 | | |
240 | 231 | | |
241 | 232 | | |
242 | 233 | | |
243 | 234 | | |
244 | 235 | | |
245 | 236 | | |
246 | | - | |
| 237 | + | |
247 | 238 | | |
248 | 239 | | |
249 | 240 | | |
250 | 241 | | |
251 | 242 | | |
252 | 243 | | |
253 | | - | |
254 | | - | |
255 | 244 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | 245 | | |
264 | 246 | | |
265 | 247 | | |
266 | 248 | | |
267 | 249 | | |
268 | 250 | | |
269 | 251 | | |
270 | | - | |
| 252 | + | |
271 | 253 | | |
272 | 254 | | |
273 | 255 | | |
274 | 256 | | |
275 | 257 | | |
276 | 258 | | |
277 | | - | |
278 | | - | |
279 | 259 | | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | 260 | | |
288 | 261 | | |
289 | 262 | | |
290 | 263 | | |
291 | 264 | | |
292 | 265 | | |
293 | 266 | | |
294 | | - | |
| 267 | + | |
295 | 268 | | |
296 | 269 | | |
297 | 270 | | |
298 | 271 | | |
299 | 272 | | |
300 | 273 | | |
301 | | - | |
302 | | - | |
303 | 274 | | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | 275 | | |
312 | 276 | | |
313 | 277 | | |
314 | 278 | | |
315 | 279 | | |
316 | 280 | | |
317 | 281 | | |
318 | | - | |
| 282 | + | |
319 | 283 | | |
320 | 284 | | |
321 | 285 | | |
| |||
Lines changed: 24 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
14 | 23 | | |
15 | | - | |
16 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
17 | 28 | | |
18 | | - | |
19 | | - | |
20 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
21 | 34 | | |
22 | 35 | | |
23 | 36 | | |
24 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
25 | 41 | | |
26 | 42 | | |
27 | 43 | | |
28 | 44 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | 45 | | |
| 46 | + | |
| 47 | + | |
45 | 48 | | |
| 49 | + | |
46 | 50 | | |
47 | 51 | | |
48 | 52 | | |
| |||
0 commit comments