Auto import doesn't work at first attempt, I need to delete and re-type component name, also doesn't add to `components`
Auto import doesn't work at first attempt, I need to delete and re-type component name. And also doesn't add an object to components:
https://github.com/vuejs/language-tools/assets/5052406/a808f185-0a77-4f77-ab19-eab4381e1f4b
Please upgrade to the latest version and check if components.d.ts is generated correctly. If the error still happens, please share a minimal reproduction project. Thanks!
Please upgrade to the latest version and check if
components.d.tsis generated correctly. If the error still happens, please share a minimal reproduction project. Thanks!
How can I verify that components.d.ts has been generated correctly?
components.d.ts is not generated since I disabled it in Nuxt settings autoImport: false,. I import components implicitly.
I just checked again and it imports component, however it's not using aliases and instead imports with relative path. Also for Options API it doesn't add component to components:{}. Which makes this less usable. I switched to WebStorm it can import properly, with aliases and adds to components:{}
I am guessing this due to getComponentNames is not triggered or delayed on first entry into the workspace.
In VS Code, entering a component name automatically triggers auto-import. However, in Neovim, I need to add a space after <, then delete the space, and only after that will auto-import suggestions appear when typing the component name.
I do think it's a matter of time, not input event. E.g. if you open a vue file, wait for few second, then it should show.
Probably due to vue lsp has to wait for tsserver to be ready. Astro lsp has the same issue and I would guess it also a tsserver plugin so same thing.
For vscode, it takes like 100 days to load, when you can open a file I think things already loaded which explained why it takes soooooo long.
I’ve tried opening the Vue file and waiting for a while, but typing < followed by the component name still doesn’t trigger auto-import suggestions. The suggestions only appear if I insert a space after <, delete the space, and then type the component name.
interesting it does work for me as I am also a neovim user, but I use nvim-cmp instead of blink. Maybe that makes the different?
interesting it does work for me as I am also a neovim user, but I use nvim-cmp instead of blink. Maybe that makes the different?
After I switched from blink.cmp to nvim-cmp, it started working normally.
I asked about this in a blink.cmp issue, and the author responded with this explanation.
nvim-cmpmakes a request when typing the trigger character<and then seems to send another request after typing any alphanumeric character (Hin your case), so it ends up hiding the issue. But the LSP spec expects the completion plugin to filter on the client side after typingH, rather than making a new request afaict, so this is still an LSP issue.
So at this point, I'm not really sure what's actually causing the problem.