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
This commit is contained in:
Gregory Anders 2022-05-22 13:21:44 -06:00 committed by GitHub
parent 52623ce935
commit 378615b8ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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