aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lua/lspconfig/server_configurations/elixirls.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/lua/lspconfig/server_configurations/elixirls.lua b/lua/lspconfig/server_configurations/elixirls.lua
index 62b8e168..3172f6a8 100644
--- a/lua/lspconfig/server_configurations/elixirls.lua
+++ b/lua/lspconfig/server_configurations/elixirls.lua
@@ -1,11 +1,14 @@
-local util = require 'lspconfig.util'
-
return {
default_config = {
filetypes = { 'elixir', 'eelixir', 'heex', 'surface' },
root_dir = function(fname)
- return util.root_pattern 'mix.exs'(fname) or util.find_git_ancestor(fname) or vim.loop.os_homedir()
+ 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)
+
+ return root_dir
end,
+ single_file_support = true,
},
docs = {
description = [[
@@ -31,9 +34,11 @@ require'lspconfig'.elixirls.setup{
...
}
```
+
+'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.
]],
default_config = {
- root_dir = [[util.find_git_ancestor(fname) or util.root_pattern 'mix.exs'(fname) or vim.loop.os_homedir()]],
+ root_dir = '{{see description above}}',
},
},
}