mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
feat(lsp): support connect via named pipes/unix domain sockets (#26032)
Closes https://github.com/neovim/neovim/issues/26031 Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
This commit is contained in:
@@ -3861,6 +3861,39 @@ describe('LSP', function()
|
||||
]]
|
||||
eq(result.method, "initialize")
|
||||
end)
|
||||
it('can connect to lsp server via rpc.domain_socket_connect', function()
|
||||
local tmpfile
|
||||
if is_os("win") then
|
||||
tmpfile = "\\\\.\\\\pipe\\pipe.test"
|
||||
else
|
||||
tmpfile = helpers.tmpname()
|
||||
os.remove(tmpfile)
|
||||
end
|
||||
local result = exec_lua([[
|
||||
local SOCK = ...
|
||||
local uv = vim.uv
|
||||
local server = uv.new_pipe(false)
|
||||
server:bind(SOCK)
|
||||
local init = nil
|
||||
|
||||
server:listen(127, function(err)
|
||||
assert(not err, err)
|
||||
local client = uv.new_pipe()
|
||||
server:accept(client)
|
||||
client:read_start(require("vim.lsp.rpc").create_read_loop(function(body)
|
||||
init = body
|
||||
client:close()
|
||||
end))
|
||||
end)
|
||||
vim.lsp.start({ name = "dummy", cmd = vim.lsp.rpc.domain_socket_connect(SOCK) })
|
||||
vim.wait(1000, function() return init ~= nil end)
|
||||
assert(init, "server must receive `initialize` request")
|
||||
server:close()
|
||||
server:shutdown()
|
||||
return vim.json.decode(init)
|
||||
]], tmpfile)
|
||||
eq(result.method, "initialize")
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('handlers', function()
|
||||
|
||||
Reference in New Issue
Block a user