feat(lsp): switch to official Elixir LSP

This commit is contained in:
Oliver Ladner 2025-09-01 07:04:38 +02:00
commit c00d5b0b15

View file

@ -1,22 +1,7 @@
---@type vim.lsp.Config
--- 'root_dir' is chosen like this:
--- if two or more directories containing `mix.exs` were found when searching
--- directories upward, the second one (higher up) is chosen, with the
--- assumption that it is the root of an umbrella app. Otherwise the directory
--- containing the single mix.exs that was found is chosen.
--- https://github.com/elixir-lang/expert/blob/main/pages/installation.md#neovim
return {
-- cmd when installing with Mason
-- Had to install elixir and asdf (homebrew)
-- Then ran `mix local.hex` to upgrade Hex
cmd = { vim.env.HOME .. "/.local/share/nvim/mason/packages/elixir-ls/language_server.sh" },
-- cmd = { "/Users/oliver.ladner/.local/share/nvim/mason/packages/elixir-ls/language_server.sh" },
filetypes = { "elixir", "eelixir", "heex", "surface" },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
local matches = vim.fs.find({ "mix.exs" }, { upward = true, limit = 2, path = fname })
local child_or_root_path, maybe_umbrella_path = unpack(matches)
local root_dir = vim.fs.dirname(maybe_umbrella_path or child_or_root_path)
on_dir(root_dir)
end,
root_markers = { "mix.exs", ".git" },
cmd = { "expert" },
}