Skip to content

Conversation

@Jak-Ch-ll
Copy link
Contributor

@Jak-Ch-ll Jak-Ch-ll commented Aug 22, 2025

Problem

After updating the Vue Language Server to version 3 I ran into the error "Could not find ts_ls or vtsls lsp client, required by vue_ls." at startup. It did not happen every time but most of the time. After playing around with as part of the discussion vuejs/language-tools#5603, I found out that it only happens when I have the lsp configurations in /after/lsp. If I configure everything in the same file the issue does not seem to occur.

I presume that there is some kind of race condition going on which either does not or is far less likely to happen with a single configuration file.

Solution

In any case since I'm probably not the only one using the /after/lsp style of configuration, I think it makes sense to have some kind of solution within lspconfig.

I added a retry into the handler that allows some time for the typescript ls to attach.

Additional notes

  • If there is clean way of having one language server wait for another I would be all ears
  • I also made a small refactor which I can split into its own PR if desired

Problem:
The current logic used unnecessary table merging even though there is
only one element expected anyway.

Solution:
Just use index accessing and `or`
Problem:
The current `on_init` of `vue_ls` requiers `vtsls` or `ts_ls` to already be
attached, which is not always guaranteed.

Solution:
Add a retry mechanism that reruns the logic for some time to give the
other ls a chance to catch up.
@justinmk
Copy link
Member

Thanks. configs really should not be implemented bespoke "retry" logic, hopefully this can be simplified after vim.async is available.

@justinmk justinmk merged commit 16878c7 into neovim:master Aug 22, 2025
6 checks passed
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