vuejs / language-tools

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

Go to definition always go to the xxx.d.ts file that has "declare module '*.vue'". #4486

Closed Enaium closed 3 months ago

Enaium commented 3 months ago

Vue - Official extension or vue-tsc version

v2.0.21

VSCode version

1.90.2 (user setup)

Vue version

3.4.29

TypeScript version

5.4.5

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (4) x64 AMD Ryzen 3 3200G with Radeon Vega Graphics
    Memory: 4.49 GB / 13.93 GB
  Binaries:
    Node: 20.14.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (126.0.2592.68)
    Internet Explorer: 11.0.22621.3527

Steps to reproduce

  1. create a vue project by yarn create vue

  1. create a shims.d.ts

declare module '*.vue'

  1. remove the lang=ts

  1. reopen vscode

  2. Go to definition

  1. Go to the xxx.d.ts file

Link to minimal reproduction

No response

Any additional comments?

Go to definition will go to the from file when I go to definition by the from file.

so1ve commented 3 months ago

This is expected. To change the behavior just remove that shim file.

Enaium commented 3 months ago

This is expected. To change the behavior just remove that shim file.

This will throw "implicitly has an 'any' type" when I build the project

RayGuo-ergou commented 3 months ago

Not sure if 100% related, but can you try to add export{}?

Enaium commented 3 months ago

Not sure if 100% related, but can you try to add export{}?

Add to the xxx.d.ts?

RayGuo-ergou commented 3 months ago

Yeah probably not what i thought about, it might be the tsconfig, can you try to add "allowJs": true, in your tsconfig.app.json?

under compilerOptions then remove shim.d.ts

Enaium commented 3 months ago

Yeah probably not what i thought about, it might be the tsconfig, can you try to add "allowJs": true, in your tsconfig.app.json?

under compilerOptions then remove shim.d.ts

Thanks