feat(lsp): switch to official Elixir LSP
This commit is contained in:
parent
df89a338ec
commit
c00d5b0b15
1 changed files with 3 additions and 18 deletions
|
|
@ -1,22 +1,7 @@
|
||||||
---@type vim.lsp.Config
|
---@type vim.lsp.Config
|
||||||
--- 'root_dir' is chosen like this:
|
--- https://github.com/elixir-lang/expert/blob/main/pages/installation.md#neovim
|
||||||
--- 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.
|
|
||||||
return {
|
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" },
|
filetypes = { "elixir", "eelixir", "heex", "surface" },
|
||||||
root_dir = function(bufnr, on_dir)
|
root_markers = { "mix.exs", ".git" },
|
||||||
local fname = vim.api.nvim_buf_get_name(bufnr)
|
cmd = { "expert" },
|
||||||
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,
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue