diff options
author | Mathias Fussenegger <f.mathias@zignar.net> | 2022-08-23 22:39:34 +0200 |
---|---|---|
committer | Mathias Fussenegger <f.mathias@zignar.net> | 2022-08-28 14:07:53 +0200 |
commit | 7d3e4aee6a11f0bd4c53b0dcb18a496b5fdd32b2 (patch) | |
tree | 57f703c3d3bdba898f24a5eab22bf626fbbfca04 /runtime/lua/vim/lsp.lua | |
parent | f9641d1ac6bae58a42572ce3bfa34d62d5f22619 (diff) | |
download | rneovim-7d3e4aee6a11f0bd4c53b0dcb18a496b5fdd32b2.tar.gz rneovim-7d3e4aee6a11f0bd4c53b0dcb18a496b5fdd32b2.tar.bz2 rneovim-7d3e4aee6a11f0bd4c53b0dcb18a496b5fdd32b2.zip |
refactor(lsp): encapsulate rpc uv handle
To prepare for different transports like TCP where the handle won't have
a kill method.
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r-- | runtime/lua/vim/lsp.lua | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index fd64c1a495..5986f5a5e8 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -1464,14 +1464,13 @@ function lsp.start_client(config) --- you request to stop a client which has previously been requested to --- shutdown, it will automatically escalate and force shutdown. --- - ---@param force (bool, optional) + ---@param force boolean|nil function client.stop(force) - local handle = rpc.handle - if handle:is_closing() then + if rpc.is_closing() then return end if force or not client.initialized or graceful_shutdown_failed then - handle:kill(15) + rpc.terminate() return end -- Sending a signal after a process has exited is acceptable. @@ -1480,7 +1479,7 @@ function lsp.start_client(config) rpc.notify('exit') else -- If there was an error in the shutdown request, then term to be safe. - handle:kill(15) + rpc.terminate() graceful_shutdown_failed = true end end) @@ -1492,7 +1491,7 @@ function lsp.start_client(config) ---@returns (bool) true if client is stopped or in the process of being ---stopped; false otherwise function client.is_stopped() - return rpc.handle:is_closing() + return rpc.is_closing() end ---@private |