Skip to content

Commit b56ad8b

Browse files
committed
chore: vendor credo-language-server binary
1 parent 8ccb696 commit b56ad8b

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

bin/credo-language-server

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env elixir
2+
3+
System.no_halt(true)
4+
5+
{%{credo: {_, :credo, credo_version, _, _, _, _, _}}, _} = Code.eval_file("./mix.lock")
6+
7+
Mix.install([
8+
{:credo_language_server, "0.0.1"},
9+
{:credo, credo_version}
10+
])
11+
12+
Application.ensure_all_started(:credo_language_server)

lua/elixir/credo/init.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ function M.setup(opts)
2626

2727
vim.lsp.start {
2828
name = "Credo",
29-
cmd = { "mix", "credo.lsp", "--stdio" },
29+
-- cmd = vim.lsp.rpc.connect('127.0.0.1', 9000),
30+
cmd = { opts.bin, "--stdio" },
3031
settings = {},
3132
root_dir = vim.fs.dirname(file),
3233
on_attach = opts.on_attach or function() end,

lua/elixir/init.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,18 @@ M.elixirls = {}
1010
M.elixirls.settings = elixirls.settings
1111
M.elixirls.open_output_panel = elixirls.open_output_panel
1212

13+
M.credo = {}
14+
15+
M.credo.default_bin = vim.fn.fnamemodify(debug.getinfo(1).short_src, ":h")
16+
.. "/../../bin/credo-language-server"
17+
1318
function M.setup(opts)
1419
opts = opts or {}
1520

21+
if opts.credo and not opts.credo.bin then
22+
opts.credo.bin = M.credo.default_bin
23+
end
24+
1625
mix.setup()
1726
projectionist.setup()
1827
elixirls.setup(opts.elixirls or {})

0 commit comments

Comments
 (0)