diff options
author | TheLeoP <53507599+TheLeoP@users.noreply.github.com> | 2024-01-02 04:08:36 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-02 10:08:36 +0100 |
commit | 3f788e73b34521f093846d362bf51e68bc9a3827 (patch) | |
tree | d97051ef5dc9d58253de4560a1ae35a112e74560 /test/functional/plugin/lsp_spec.lua | |
parent | 4ee656e4f35766bef4e27c5afbfa8e3d8d74a76c (diff) | |
download | rneovim-3f788e73b34521f093846d362bf51e68bc9a3827.tar.gz rneovim-3f788e73b34521f093846d362bf51e68bc9a3827.tar.bz2 rneovim-3f788e73b34521f093846d362bf51e68bc9a3827.zip |
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>
Diffstat (limited to 'test/functional/plugin/lsp_spec.lua')
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 0026a7caa7..a6b3835dbc 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -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() |