vuejs / language-tools

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

Add back `reverseConfigFilePriority` #3951

Open segevfiner opened 7 months ago

segevfiner commented 7 months ago

With this now removed, I'm getting the wrong tsconfig.json selected in my Vue projects. By having tsconfig.app.json last and enabling this setting, both the TypeScript server and Volar in Vue files picked tsconfig.app.json, now Volar picks up tsconfig.vitest.json instead (Based on the create-vue template). Please restore this setting or make it the default to match TypeScript server behavior.

johnsoncodehk commented 7 months ago

The Vue language server no longer controls tsconfig selection, because in 2.0 typescript support is implemented through tsserver + @vue/typescript-plugin, which means that now it is all the behavior of tsserver itself.

segevfiner commented 7 months ago

Then how can it be that for a vue file I'm getting tsconfig.vitest.json and for a ts file I'm getting tsconfig.app.json? Something must still cause the behavior to be different for this case?

See also https://github.com/vuejs/language-tools/issues/1815

johnsoncodehk commented 7 months ago

Maybe tsserver behaves differently with external files (the file type of Vue files in tsserver projects), I can't give an exact explanation until I dig deeper. Anyway this is now beyond the control of this codebase.

johnsoncodehk commented 7 months ago

Please track for https://github.com/microsoft/TypeScript/issues/57632

johnsoncodehk commented 7 months ago

@sheetalkamat indicated that this is configurable, I will look into this.

johnsoncodehk commented 7 months ago

VSCode's TS client does not provide a configuration method for extraFileExtensions, so this is currently not configurable in VSCode for Vue.

https://github.com/microsoft/vscode/blob/8aca9a53311890fa54f0459c6ef2e8994d4d8ae4/extensions/typescript-language-features/src/languageFeatures/fileConfigurationManager.ts#L128-L129

andrewbrennanfr commented 7 months ago

Hi - very same issue here 🙋 Here is my example https://github.com/andrewbrennanfr/vue-tsconfig main.ts uses tsconfig.main.json and App.vue uses tsconfig.app.json - completely based on the reverse order. Downgrading & disabling the built in TS features (as was recommended before) solves the issue.

johnsoncodehk commented 7 months ago

This problem cannot be solved on our side, but 2.0.7 has re-introduced the v1 language server, you can upgrade and make sure not to enable Hybird Mode to get consistent behavior with v1.

segevfiner commented 3 months ago

@johnsoncodehk This is still an issue... Can we request the needed API in VS Code so this can be properly solved?

johnsoncodehk commented 3 months ago

I am currently unable to find time to investigate it, but let's keep this issue open in case it sinks.