mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-04-27 11:55:22 +00:00
lsp/presets/elixir-ls: init
This commit is contained in:
parent
fd1bf72c3b
commit
094d56b7ee
2 changed files with 35 additions and 0 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
./basedpyright.nix
|
./basedpyright.nix
|
||||||
./bash-language-server.nix
|
./bash-language-server.nix
|
||||||
./deno.nix
|
./deno.nix
|
||||||
|
./elixir-ls.nix
|
||||||
./elm-language-server.nix
|
./elm-language-server.nix
|
||||||
./emmet-ls.nix
|
./emmet-ls.nix
|
||||||
./fsautocomplete.nix
|
./fsautocomplete.nix
|
||||||
|
|
|
||||||
34
modules/plugins/lsp/presets/elixir-ls.nix
Normal file
34
modules/plugins/lsp/presets/elixir-ls.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.options) mkEnableOption;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
|
||||||
|
cfg = config.vim.lsp.presets.elixir-ls;
|
||||||
|
in {
|
||||||
|
options.vim.lsp.presets.elixir-ls = {
|
||||||
|
enable = mkEnableOption "the Elixir Language Server";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim.lsp.servers.elixir-ls = {
|
||||||
|
enable = true;
|
||||||
|
cmd = [(getExe pkgs.elixir-ls)];
|
||||||
|
root_dir = mkLuaInline ''
|
||||||
|
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
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue