Skip to content

Commit 7d6db92

Browse files
committed
fixup! feat: :Elixir command with subcommands and completions
1 parent 451925e commit 7d6db92

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

lua/elixir/init.lua

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ local define_user_command = function()
3636
local subcommand = args:next()
3737
if "uninstall" == subcommand then
3838
vim.fn.delete(nextls.default_bin)
39-
vim.notify(
40-
string.format("Uninstalled Next LS from %s", nextls.default_bin),
41-
vim.lsp.log_levels.INFO
42-
)
39+
vim.notify(string.format("Uninstalled Next LS from %s", nextls.default_bin), vim.lsp.log_levels.INFO)
4340
else
4441
not_found = true
4542
end
@@ -80,14 +77,12 @@ function M.setup(opts)
8077
opts.credo.version = utils.latest_release("elixir-tools", "credo-language-server")
8178
end
8279

80+
local nextls_auto_update
8381
if not opts.nextls.cmd then
8482
opts.nextls.cmd = nextls.default_bin
83+
nextls_auto_update = true
8584
end
8685

87-
-- if opts.nextls.enable and not opts.nextls.version then
88-
-- opts.nextls.version = utils.latest_release("elixir-tools", "next-ls")
89-
-- end
90-
9186
mix.setup()
9287
projectionist.setup()
9388
if enabled(opts.elixirls.enable) then
@@ -99,7 +94,7 @@ function M.setup(opts)
9994
end
10095

10196
if opts.nextls.enable == true then
102-
nextls.setup(opts.nextls)
97+
nextls.setup(vim.tbl_extend("force", opts.nextls, { auto_update = nextls_auto_update }))
10398
end
10499
end
105100

lua/elixir/nextls/init.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ function M.setup(opts)
1515
group = nextls_group,
1616
callback = function(event)
1717
local cmd = event.data.cmd
18+
local auto_update = event.auto_update
1819
local options = event.data.opts
1920
local root_dir = event.data.root_dir
2021
vim.lsp.start({
2122
name = "NextLS",
2223
cmd = cmd,
2324
cmd_env = {
2425
NEXTLS_VERSION = options.version,
25-
NEXTLS_AUTO_UPDATE = true,
26+
NEXTLS_AUTO_UPDATE = auto_update,
2627
},
2728
settings = {},
2829
capabilities = options.capabilities or vim.lsp.protocol.make_client_capabilities(),
@@ -72,6 +73,7 @@ function M.setup(opts)
7273
data = {
7374
root_dir = root_dir,
7475
cmd = cmd,
76+
auto_update = opts.auto_update,
7577
opts = opts,
7678
},
7779
})

0 commit comments

Comments
 (0)