Auto import of Astro's navigate() in VS Code defaults to astro/dist/transitions/router #866
Replies: 2 comments
-
Actually the Stackblitz default does work - I swear I tried it a few times 🙄. Bug still applies. |
Beta Was this translation helpful? Give feedback.
-
Unfortunately, you can't really control the ordering of that list inside the project itself, it has to be done in the tooling. That's why it shows higher in Astro files, because we control all the tooling there. The way to fix this in Here: , instead of using Volar's all-in-one method for making the plugin, we should do all the decoration ourselves, like Vue does here: https://github.com/vuejs/language-tools/blob/e3fc9b97a74e6e50bf2c9bde81cb43e8ca3fa7bc/packages/typescript-plugin/index.ts#L17.We should implement a For the exact changes to do to the sortText, we can refer to this code: If anyone is interested in sending a PR, let me know and I'll provide more details / I'm happy to answer more questions. |
Beta Was this translation helpful? Give feedback.
-
Astro Info
If this issue only occurs in one browser, which browser is a problem?
N/A
Describe the Bug
I know this is pretty minor, but when using VS Code's auto importing to import navigate() in a React component, the default option is astro/dist/transitions/router instead of astro:transitions/client, which throws the following error:
The error is not super clear, and it's a very easy mistake to make.
The default option is correct inside .astro files, but obviously there is not much use for it there:
What's the expected result?
The
navigate
fromastro:transitions/client
to take higher priority in the list.In the Stackblitz example, it defaults to 'astro/virtual-modules/transitions-router.js', which doesn't throw an error but also just doesn't work.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-baf1mz?file=src%2Fcomponents%2FReactComponent.tsx
Participation
Beta Was this translation helpful? Give feedback.
All reactions