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

Duplicate completion response using hybridMode = false #5105

Closed
DanielViberg opened this issue Jan 2, 2025 · 5 comments
Closed

Duplicate completion response using hybridMode = false #5105

DanielViberg opened this issue Jan 2, 2025 · 5 comments

Comments

@DanielViberg
Copy link

DanielViberg commented Jan 2, 2025

Vue - Official extension or vue-tsc version

@vue/[email protected] [email protected]

VSCode version

Vue version

@vue/[email protected]

TypeScript version

[email protected]

System Info

System:                                                                                                                     
    OS: Linux 6.8 Debian GNU/Linux 12 (bookworm) 12 (bookworm)                                                                
    CPU: (16) x64 AMD Ryzen 7 PRO 5850U with Radeon Graphics                                                                  
    Memory: 35.70 GB / 42.93 GB                                                                                               
    Container: Yes                                                                                                            
    Shell: 5.2.15 - /bin/bash                                                                                                 
  Binaries:                                                                                                                   
    Node: 20.18.0 - ~/sources/tools/node-v20.18.0-linux-x64/bin/node                                                          
    npm: 10.8.2 - ~/sources/tools/node-v20.18.0-linux-x64/bin/npm                                                             
  Browsers:                                                                                                                   
    Brave Browser: 131.1.73.104                                                                                               
    Chrome: 131.0.6778.204

package.json dependencies

No response

Steps to reproduce

Using https://github.com/yegappan/lsp and this config:

name: vue-ls,
 filetype: [vue],
 path: vue-language-server,
 args: [--stdio],
 initializationOptions: {
 typescript: {
 tsdk: xxx/node/lib/node_modules/typescript/lib
 },
 vue: {
 hybridMode: false
 }
 },
 workspaceConfig: {
 html: {
 format: {
 wrapAttributes: force-aligned
 }
 }
 }
 },

The completion response contains multiple duplicates:
2025-01-02-12-46-09

What is expected?

Only one instance of each completion.

What is actually happening?

Multiple of the same completion item.

Link to minimal reproduction

No response

Any additional comments?

I've observed in other lsp clients that use hybridMode: true eliminates this issue. vuels + tsls is not supported yet in https://github.com/yegappan/lsp so it is preferred that hybridMode: true would work as intended instead.

@DanielViberg

This comment was marked as outdated.

@RayGuo-ergou
Copy link
Contributor

Hi I think you have both volar and typescript lsp running at the same time when setting the hybrid mode to false.

When hybrid mode is disabled, volar will try to create its own instance of tsserver to handle javascript/typescript. Thus if you attach both lsp to a buffer it will have duplicated completion items

e.g. My reproduction while setting hybrid mode to false and also attach a typescript lsp.

image

@DanielViberg
Copy link
Author

Hello, i did indeed have ts-ls configured for js and ts files (cant see it running though). I tried disabling ts-ls but observed similar results. Shouldn't the ts server show up on htop if its running alongside vue-ls?

@RayGuo-ergou
Copy link
Contributor

tsserver would not show up in any process monitor software, because volar wraps tsserver in its process if set hybrid mode to false.

Just like when you running ts-ls, you would not see any process named as tsserver. (ts-ls also a wrapper around tsserver)

If you want to use hybridMode=false, usually you want to complete remove any typescript lsp (e.g. ts-ls, vtsls), and attach volar to javascript/typescript buffers. The reason is that the ts/js file in your vue project has to be able to recognize vue files. ( That's basically why v2 uses the new hybrid approach)

https://github.com/vuejs/language-tools?tab=readme-ov-file#community-integration

Expand the neovim part, This might help you as the fundamentals are all the same.

And btw I think whatever lsp client you are using, it should support hybrid mode because after all it's just an option passing to ts-ls.

@RayGuo-ergou
Copy link
Contributor

And if you can also try to log lsp payloads to see where are the response come from would be helpful.

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

No branches or pull requests

2 participants