Skip to content

Commit 4644c05

Browse files
authored
feat: configure credo-langauge-server version (#104)
1 parent 126fce7 commit 4644c05

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ elixir.setup {
9494
credo = {
9595
port = 9000, -- connect via TCP with the given port. mutually exclusive with `cmd`
9696
cmd = "path/to/credo-language-server", -- path to the executable. mutually exclusive with `port`
97+
version = "0.1.0-rc.1", -- version of credo-language-server to install and use. defaults to 0.0.5
9798
on_attach = function(client, bufnr)
9899
-- custom keybinds
99100
end

bin/credo-language-server

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
#!/usr/bin/env elixir
1+
#!/usr/bin/env elixir --sname undefined
22

33
System.no_halt(true)
44

5-
{%{credo: {_, :credo, credo_version, _, _, _, _, _}}, _} = Code.eval_file(System.get_env("CREDO_MIX_LOCK_PATH", "./mix.lock"))
6-
7-
Mix.install([
8-
{:credo_language_server, "0.0.5"},
9-
{:credo, credo_version}
10-
])
5+
Mix.install([ {:credo_language_server, System.get_env("CREDO_LSP_VERSION")}, ])
116

127
Application.ensure_all_started(:credo_language_server)

lua/elixir/credo/init.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ function M.setup(opts)
4747
vim.lsp.start {
4848
name = "Credo",
4949
cmd = cmd,
50-
cmd_env = { CREDO_MIX_LOCK_PATH = file },
50+
cmd_env = {
51+
CREDO_LSP_VERSION = opts.version
52+
53+
},
5154
settings = {},
5255
root_dir = vim.fs.dirname(file),
5356
on_attach = opts.on_attach or function() end,

lua/elixir/init.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ M.credo.default_bin = (
1616
vim.fn.fnamemodify(debug.getinfo(1).source, ":h") .. "/../../bin/credo-language-server"
1717
):gsub("^@", "")
1818

19+
M.credo.default_version = "0.0.5"
20+
1921
local enabled = function(value)
2022
return value == nil or value == true
2123
end
@@ -30,6 +32,10 @@ function M.setup(opts)
3032
opts.credo.cmd = M.credo.default_bin
3133
end
3234

35+
if not opts.credo.version then
36+
opts.credo.version = M.credo.default_version
37+
end
38+
3339
mix.setup()
3440
projectionist.setup()
3541
if enabled(opts.elixirls.enable) then

0 commit comments

Comments
 (0)