Skip to content

Comments

Use tsserver to drive vue-typescript-plugin (fix Vue file completion)#1791

Open
Cheaterman wants to merge 1 commit intoycm-core:masterfrom
Cheaterman:vue-tsserver
Open

Use tsserver to drive vue-typescript-plugin (fix Vue file completion)#1791
Cheaterman wants to merge 1 commit intoycm-core:masterfrom
Cheaterman:vue-tsserver

Conversation

@Cheaterman
Copy link

@Cheaterman Cheaterman commented Sep 11, 2025

Everything in the title ; as it currently is, completion in *.vue files is not working - not at all out of the box, and very broken if trying to use modern vue-language-server the same way one used to use volar or vls - I'm not 100% sure but despite it being the same project as volar/vls (or a fork), I suspect it really expects to be driven through tsserver nowadays - this seems to work perfectly without the user even needing to change anything in their .vimrc.


This change is Reviewable

EDIT: I'm sure in an ideal world there would be a fully separate build.py argument for Vue, so that we wouldn't need to "pollute" the tsserver/package.json file with Vue-specific stuff, but I figured it might be overkill and doesn't make a whole lot of difference anyway (~4MB in node_modules).

@puremourning
Copy link
Member

how can I test this simply? I don't vue

@puremourning
Copy link
Member

I tried the test app in ycm-core/lsp-examples repo and got this:

Screenshot 2025-10-16 at 20 50 49 Screenshot 2025-10-16 at 20 50 21

@Cheaterman
Copy link
Author

Cheaterman commented Jan 28, 2026

I think the package.json in the lsp-examples repo needs the very same changes I put here, lemme take a look.

EDIT: So, the snippet.vim seems no longer necessary ; I didn't need to edit anything in the example other than adding the missing tsconfig.json - VLS is now dead in favor of @vue/typescript-plugin, including for non-typescript-enabled codebases ; see my before and after screenshots attached, and the associated PR to the lsp-examples repo here.

Before :
scrot_006

After :
scrot_009

More screenshots with extra usage examples EDIT2 : Just one more screenshot for good luck : scrot_010

EDIT3: And in fact a couple more just to demonstrate that it works both with TypeScript enabled and disabled :
Auto-completing with TypeScript disabled (same as above screenshot, except no lang="ts") :
scrot_011

Making an invalid TypeScript call to String.prototype.replace() doesn't show any issues in JS mode :
scrot_012

But obviously TypeScript isn't happy about it :
scrot_013

Thanks for your patience 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants