vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.56k stars 373 forks source link

Autocomplete in imports not working for .vue files #4380

Closed Dan-Y-Ko closed 1 month ago

Dan-Y-Ko commented 1 month ago

Vue version

3.4.21

Link to minimal reproduction

https://github.com/Dan-Y-Ko/vue-bugs

Steps to reproduce

ScreenShot ScreenShot

What is expected?

When I type in the path, autocomplete for the components folder appears, after that HelloWorld.vue should show up.

What is actually happening?

No autocomplete

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700K
    Memory: 15.09 GB / 31.79 GB
  Binaries:
    Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
    npm: 10.1.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (123.0.2420.97)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    vue: ^3.4.21 => 3.4.27

Any additional comments?

All other files are recognized, but for some reason .vue files aren't.

RayGuo-ergou commented 1 month ago

I can reproduce this with any of my vue workspace that only folders are recognized by the lsp

image ^ Only with lsp label is from the server, others are from another plugin.

But @Dan-Y-Ko you can get a work around for now to type the name of the component e.g.

import HellowWorld ...

You would get auto complete this way image

Dan-Y-Ko commented 1 month ago

I can reproduce this with any of my vue workspace that only folders are recognized by the lsp

image ^ Only with lsp label is from the server, others are from another plugin.

But @Dan-Y-Ko you can get a work around for now to type the name of the component e.g.

import HellowWorld ...

You would get auto complete this way image

I'm not getting autocomplete with this method either

Dan-Y-Ko commented 1 month ago

Ok, I found something (at least in my case), that might help. I see this is an issue when using script setup. If I don't use that, it works fine...so it seems like an issue with script setup?

johnsoncodehk commented 1 month ago

Fixed by https://github.com/volarjs/volar.js/commit/c2d7405611a1ccb018cab89939c28f1a1c81d829.