vuejs / language-tools

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

fix(language-core): refer absolute path of global types file #4924

Closed depressedX closed 4 weeks ago

depressedX commented 1 month ago

fix https://github.com/vuejs/language-tools/issues/4860

Check the detail info here https://github.com/vuejs/language-tools/issues/4860#issuecomment-2406554626

Solution

Change globalTypes reference to absolute path:

before:

/// <reference types=".vue-global-types/vue_3.4_false.d.ts" />

after:

/// <reference types="/absolute/path/to/.vue-global-types/vue_3.4_false.d.ts" />
pkg-pr-new[bot] commented 1 month ago

Open in Stackblitz

vue-component-meta

``` pnpm add https://pkg.pr.new/vuejs/language-tools/vue-component-meta@4924 ```

vue-component-type-helpers

``` pnpm add https://pkg.pr.new/vuejs/language-tools/vue-component-type-helpers@4924 ```

@vue/language-core

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-core@4924 ```

@vue/language-plugin-pug

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-plugin-pug@4924 ```

@vue/language-server

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-server@4924 ```

vue-tsc

``` pnpm add https://pkg.pr.new/vuejs/language-tools/vue-tsc@4924 ```

@vue/language-service

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-service@4924 ```

@vue/typescript-plugin

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/typescript-plugin@4924 ```

commit: ccf6506

depressedX commented 1 month ago

@KazariEX noticed you've fixed serveral issues about globalTypes. So could you help checking these changes?

KazariEX commented 1 month ago

Can we centralize the operations of obtaining path and writing data in the same function setupGlobalTypes?

Mivik commented 3 weeks ago

For me this fix introduced the exact same problem instead of fixing it. Downgrading to vue-tsc 2.1.6 resolves the issue for me.

error TS2688: Cannot find type definition file for '/path/to/project/node_modules/.vue-global-types/vue_3.5_false.d.ts'.

30 /// <reference types="/path/to/project/node_modules/.vue-global-types/vue_3.5_false.d.ts" />
depressedX commented 3 weeks ago

For me this fix introduced the exact same problem instead of fixing it. Downgrading to vue-tsc 2.1.6 resolves the issue for me.

error TS2688: Cannot find type definition file for '/path/to/project/node_modules/.vue-global-types/vue_3.5_false.d.ts'.

30 /// <reference types="/path/to/project/node_modules/.vue-global-types/vue_3.5_false.d.ts" />

Could you provide more details to reproduce your error?

Mivik commented 3 weeks ago

global

Minimal reproducible project: https://github.com/Mivik/vue-lang-tool-reproduce

NicolasPL64 commented 3 weeks ago

Hopefully this gets pushed soon. I cannot use GitHub Actions for Ubuntu because of this bug.