-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Astro Info
Astro v5.16.6
Vite v6.4.1
Node v22.21.1
System Linux (x64)
Package Manager npm
Output static
Adapter none
Integrations none
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
The "Find All References" feature fails to locate TypeScript function references in .astro files when using Astro VS Code extension version 2.16.5.
When right-clicking a function exported from a .ts file and selecting "Find All References", it only finds the definition in the TypeScript file but misses any usages in .astro files that import and call that function.
What's the expected result?
- Install the Astro vscode extension (version
2.16.5as of this writing) - Open the code in the following StackBlitz project within vscode: https://stackblitz.com/edit/github-kxub1saw?file=README.md&on=stackblitz
- Open
src/hello.ts, right-click thehello()function, and select Find All References.
Expected
Finds hello() referenced in both src/pages/index.astro and src/hello.ts
Actual
Does not find hello() in src/pages/index.astro...only src/hello.ts
Workaround
Install version 2.15.4 of the Astro vscode extension, reload vscode, and follow the repro steps again. This time it'll find the reference in the .astro file.
Additional Info
Enabling TypeScript Sever tracing:
// .vscode/settings.json
{
"typescript.tsserver.log": "verbose"
}...reveals that astro-ts-plugin-bundle is failing to load:
Info 31 [16:30:03.177] Loading global plugin astro-ts-plugin-bundle
Info 32 [16:30:03.177] Enabling plugin astro-ts-plugin-bundle from candidate paths: /home/rafael/.vscode-server/extensions/astro-build.astro-vscode-2.16.5-linux-x64,/home/rafael/.vscode-server/extensions/github.copilot-chat-0.35.1,/home/rafael/.vscode-server/bin/618725e67565b290ba4da6fe2d29f8fa1d4e3622/extensions/node_modules/typescript/lib/typescript.js/../../..
Info 33 [16:30:03.178] Loading astro-ts-plugin-bundle from /home/rafael/.vscode-server/extensions/astro-build.astro-vscode-2.16.5-linux-x64 (resolved to /home/rafael/.vscode-server/extensions/astro-build.astro-vscode-2.16.5-linux-x64/node_modules)
Info 34 [16:30:03.186] Loading astro-ts-plugin-bundle from /home/rafael/.vscode-server/extensions/github.copilot-chat-0.35.1 (resolved to /home/rafael/.vscode-server/extensions/github.copilot-chat-0.35.1/node_modules)
Info 35 [16:30:03.187] Loading astro-ts-plugin-bundle from /home/rafael/.vscode-server/bin/618725e67565b290ba4da6fe2d29f8fa1d4e3622/extensions/node_modules/typescript/lib/typescript.js/../../.. (resolved to /home/rafael/.vscode-server/bin/618725e67565b290ba4da6fe2d29f8fa1d4e3622/extensions/node_modules/node_modules)
Info 36 [16:30:03.187] Failed to load module 'astro-ts-plugin-bundle' from /home/rafael/.vscode-server/extensions/astro-build.astro-vscode-2.16.5-linux-x64/node_modules: Error: Could not resolve JS module 'astro-ts-plugin-bundle' starting at '/home/rafael/.vscode-server/extensions/astro-build.astro-vscode-2.16.5-linux-x64/node_modules'.
Inspecting the Astro vscode extension directory reveals that astro-ts-plugin-bundle is no longer getting packaged with the .vsix
> ls ~/.vscode-server/extensions/astro-build.astro-vscode-2.16.5-linux-x64/node_modules/
total 24
drwxr-xr-x 3 rafael rafael 4096 Dec 18 15:22 @astrojs
drwxr-xr-x 5 rafael rafael 4096 Dec 18 15:22 prettier
drwxr-xr-x 3 rafael rafael 4096 Dec 18 15:22 prettier-plugin-astro
drwxr-xr-x 3 rafael rafael 4096 Dec 18 15:22 s.color
drwxr-xr-x 3 rafael rafael 4096 Dec 18 15:22 sass-formatter
drwxr-xr-x 3 rafael rafael 4096 Dec 18 15:22 suf-logI believe this was a regression caused by this commit since rm -rf node_modules deletes the node_modules/astro-ts-plugin-bundle, which is no longer restored by npm run build.
Link to Minimal Reproducible Example
Participation
- I am willing to submit a pull request for this issue.