Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volar packages renamed #98

Closed
tobiasdiez opened this issue May 21, 2023 · 19 comments · Fixed by #129
Closed

Volar packages renamed #98

tobiasdiez opened this issue May 21, 2023 · 19 comments · Fixed by #129
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@tobiasdiez
Copy link

The volar packages have been renamed in vuejs/language-tools#3134. It would be nice if the new vue/typescript package could be supported as well.

@simonhaenisch
Copy link
Owner

I haven't followed up at all with the changes in Volar. Just tried and there seem to be breaking changes at least to the exported types, e.g. I was using

import('@volar/vue-language-core/out/types').LanguageServiceHost

in @volar/vue-typescript version 1.0.9 but that type doesn't exist anymore in the latest version (or the renamed package).

Some help with this issue would be highly appreciated.

@simonhaenisch simonhaenisch added help wanted Extra attention is needed good first issue Good for newcomers labels Jul 11, 2023
@tobiasdiez
Copy link
Author

@simonhaenisch
Copy link
Owner

Yup that's where I got stuck actually, cause it said sth like "requires 4 arguments but only provided 1" and I didn't really have time to figure out what to pass there.

Looking at the interface again now it looks like instead of a getVueCompilerOptions method on the host, you pass them separately when creating the language service. Maybe I'll have some time for this soon, but it'll require a breaking change on my side from what i can tell (not sure why the language-tools didn't have a major bump).

@Shinigami92
Copy link

Shinigami92 commented Aug 2, 2023

@johnsoncodehk Help!

@johnsoncodehk
Copy link
Contributor

johnsoncodehk commented Aug 2, 2023

I think we don't need to support the new @vue/typescript, we are planning to deprecate it in 2.0. Keep using @volar/vue-typescript 1.6 would be fine for now.

On the other hand, @volar/typescript (the base package of @vue/typescript) now has a decorateLanguageService() API, which can add Vue support to the existing TS language service instance instead of using createLanguageService() to create a new one. decorateLanguageService() was originally a 2.0 API, but it has been released early. We can check how to integrate decorateLanguageService() in this repo after 2.0 if needed.

@Shinigami92
Copy link

Shinigami92 commented Dec 29, 2023

@johnsoncodehk Now Vue 3.4 came out and it looks like @volar/typescript v1.6.5 is missing support for defineModel. So I cant upgrade to @vue/typescript v1.8.0 due to be stuck with prettier-plugin-organize-imports

Does your previous statement with 2.0 still count? What is the progress-state?
Can I workaround it for now somehow? Or can I not use the newest Vue features anymore, because I'm stuck in dependencies?


Edit:

image

I just saw that it is "just" an eslint error 🤔 👀
Maybe I can add that in my eslintrc for now, to suppress the error


Edit 2:

My issue will be fixed via: vuejs/eslint-plugin-vue#2130
so nevermind 🙂

@Shinigami92
Copy link

With Volar v2.0, is this the day we can expect new support for it?

@simonhaenisch
Copy link
Owner

I don't work with Vue/Volar at all, so if someone could update me about the current state and ideas how to support it, I'm all ears (:

@so1ve
Copy link

so1ve commented Feb 7, 2024

@simonhaenisch What do you need? :)

@simonhaenisch
Copy link
Owner

Details about how to technically do this with Volar 2:

return require('@volar/vue-typescript').createLanguageService(getVueLanguageServiceHost(filepath, code));

function getVueLanguageServiceHost(path, content) {
const tsconfig = findTsconfig(path);
const vueCompilerOptions = getVueCompilerOptions(tsconfig);
return {
...getTypeScriptLanguageServiceHost(path, content),
getVueCompilationSettings: () => vueCompilerOptions,
/**
* Can return either `require('typescript')` or `require('typescript/lib/tsserverlibrary')`.
*
* @see https://github.com/simonhaenisch/prettier-plugin-organize-imports/pull/60#discussion_r934408179
*
* @returns {any}
*/
getTypeScriptModule: () => ts,
};
}

@so1ve
Copy link

so1ve commented Feb 8, 2024

Ok I'll look into this soon

@arkandias
Copy link

Hi guys, can't do much to help here, just to let you know that your work fixing this issue is greatly appreciated!

@mreduar
Copy link

mreduar commented Jun 11, 2024

Does anyone know of an alternative that works with the latest vue updates?

@ddzy
Copy link

ddzy commented Jun 21, 2024

Guys, any solutions?

@mreduar
Copy link

mreduar commented Jun 21, 2024

Guys, any solutions?

I removed @volar/vue-typescript and @vue/typescript, and it started working fine.

Also as @johnsoncodehk said at vuejs/language-tools#3402

@vue/typescript is an over-encapsulation, we can use @volar/typescript directly.

Besides it is already deprecated in V2. Installing @volar/typescript also works fine.

@Shinigami92
Copy link

I wont like to depend on deprecated packages, cause I wont get updated then with new features related to the replacement of the deprecated package.
Also there is also the VSCode extension that relies on the vue and typescript language servers and I don't want to either have multiple language servers running resulting in potential conflicts nor I wont like to be unable to benefit from newest extension feature relying of new dependencies.

If a package is marked as deprecated, there is a reason for that and it should be worked on.
If @simonhaenisch does not have the time and capacity, maybe there should be an additional maintainer with approval, merge and publish rights, so we can move forward.

@johnsoncodehk
Copy link
Contributor

This is a PR to migrate to @volar/typescript+@vue/language-core: #129

@simonhaenisch
Copy link
Owner

simonhaenisch commented Jul 1, 2024

Published as 4.0.0 🎉

Please try it out and let me know if there are any issues 🙏

@mreduar
Copy link

mreduar commented Jul 1, 2024

Published as 4.0.0 🎉

Please try it out and let me know if there are any issues 🙏

For now it works well with vue-tsc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
8 participants