Skip to content

Commit 43c2288

Browse files
authored
fix: only start credo if it finds a mix.exs with credo in it (#68)
1 parent 09eaf34 commit 43c2288

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

lua/elixir/credo/init.lua

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,22 @@ 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
27+
if file then
28+
local cmd
29+
if type(opts.port) == "number" then
30+
cmd = vim.lsp.rpc.connect("127.0.0.1", opts.port)
31+
else
32+
cmd = { opts.cmd, "--stdio" }
33+
end
3334

34-
vim.lsp.start {
35-
name = "Credo",
36-
cmd = cmd,
37-
settings = {},
38-
root_dir = vim.fs.dirname(file),
39-
on_attach = opts.on_attach or function() end,
40-
}
35+
vim.lsp.start {
36+
name = "Credo",
37+
cmd = cmd,
38+
settings = {},
39+
root_dir = vim.fs.dirname(file),
40+
on_attach = opts.on_attach or function() end,
41+
}
42+
end
4143
end,
4244
})
4345
end

0 commit comments

Comments
 (0)