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

Open
tobiasdiez opened this issue May 21, 2023 · 12 comments · May be fixed by #124
Open

Volar packages renamed #98

tobiasdiez opened this issue May 21, 2023 · 12 comments · May be fixed by #124
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

@so1ve so1ve linked a pull request Feb 27, 2024 that will close this issue
@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!

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
Development

Successfully merging a pull request may close this issue.

6 participants