From 378615b8ee9440edb9ab7c71d847d03d52c61b2f Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Sun, 22 May 2022 13:21:44 -0600 Subject: [PATCH] fix(lsp): do not detach LSP servers on Windows #18703 Detaching the process seems to have unintended side effects on Windows, so only do it by default on non-Windows platforms. Ref: https://github.com/neovim/nvim-lspconfig/issues/1907 Closes https://github.com/neovim/nvim-lspconfig/pull/1913 --- runtime/lua/vim/lsp/rpc.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua index 2dcafc92bc..ad2498fb6f 100644 --- a/runtime/lua/vim/lsp/rpc.lua +++ b/runtime/lua/vim/lsp/rpc.lua @@ -4,6 +4,8 @@ local log = require('vim.lsp.log') local protocol = require('vim.lsp.protocol') local validate, schedule, schedule_wrap = vim.validate, vim.schedule, vim.schedule_wrap +local is_win = uv.os_uname().version:find('Windows') + ---@private --- Checks whether a given path exists and is a directory. ---@param filename (string) path to check @@ -321,7 +323,7 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params) local spawn_params = { args = cmd_args, stdio = { stdin, stdout, stderr }, - detached = true, + detached = not is_win, } if extra_spawn_params then spawn_params.cwd = extra_spawn_params.cwd