Skip to content

Commit 09eaf34

Browse files
committed
feat: connect to credo via port
1 parent c766f60 commit 09eaf34

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ local elixirls = require("elixir.elixirls")
8787

8888
elixir.setup {
8989
credo = {
90-
cmd = "path/to/credo-language-server",
90+
port = 9000, -- connect via TCP with the given port. mutually exclusive with `cmd`
91+
cmd = "path/to/credo-language-server", -- path to the executable. mutually exclusive with `port`
9192
on_attach = function(client, bufnr)
9293
-- custom keybinds
9394
end

lua/elixir/credo/init.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,16 @@ function M.setup(opts)
2424
file = nil
2525
end
2626

27+
local cmd
28+
if type(opts.port) == "number" then
29+
cmd = vim.lsp.rpc.connect("127.0.0.1", opts.port)
30+
else
31+
cmd = { opts.cmd, "--stdio" }
32+
end
33+
2734
vim.lsp.start {
2835
name = "Credo",
29-
-- cmd = vim.lsp.rpc.connect('127.0.0.1', 9000),
30-
cmd = { opts.cmd, "--stdio" },
36+
cmd = cmd,
3137
settings = {},
3238
root_dir = vim.fs.dirname(file),
3339
on_attach = opts.on_attach or function() end,

0 commit comments

Comments
 (0)