diff options
author | Gregory Anders <greg@gpanders.com> | 2025-01-14 08:19:54 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-14 08:19:54 -0600 |
commit | e8a6c1b02122852da83dc52184e78369598d8240 (patch) | |
tree | 4e3b5c9f33957d81885c7888eb168aa8979a1b29 /runtime/lua/vim/lsp.lua | |
parent | f1c45fc7a4a595e460cd245172a5767bddeb09e9 (diff) | |
download | rneovim-e8a6c1b02122852da83dc52184e78369598d8240.tar.gz rneovim-e8a6c1b02122852da83dc52184e78369598d8240.tar.bz2 rneovim-e8a6c1b02122852da83dc52184e78369598d8240.zip |
fix(lsp): schedule call to vim.lsp.start for async root_dir (#31998)
When `root_dir` is a function it can (and often will) call the provided
callback function in a fast API context (e.g. in the `on_exit` handler
of `vim.system`). When the callback function is executed we should
ensure that it runs vim.lsp.start on the main event loop.
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r-- | runtime/lua/vim/lsp.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 23f4e104d0..7812f31db1 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -513,7 +513,9 @@ local function lsp_enable_callback(bufnr) ---@param root_dir string config.root_dir(function(root_dir) config.root_dir = root_dir - start(config) + vim.schedule(function() + start(config) + end) end) else start(config) |