From 687aab169b4929b466cf83d67b9335b94132dcd8 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Sun, 29 Sep 2024 15:38:51 +0530 Subject: [PATCH] nvim: Enable LSP for Elixir --- nvim/.config/nvim/after/ftplugin/elixir.lua | 4 ++++ nvim/.config/nvim/lua/lsp-utils.lua | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 nvim/.config/nvim/after/ftplugin/elixir.lua diff --git a/nvim/.config/nvim/after/ftplugin/elixir.lua b/nvim/.config/nvim/after/ftplugin/elixir.lua new file mode 100644 index 0000000..a450c02 --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/elixir.lua @@ -0,0 +1,4 @@ +local lsp_utils = require('lsp-utils') +local elixir_config = lsp_utils.elixir_config() + +vim.lsp.start(elixir_config) diff --git a/nvim/.config/nvim/lua/lsp-utils.lua b/nvim/.config/nvim/lua/lsp-utils.lua index 35b9c7a..2d9067a 100644 --- a/nvim/.config/nvim/lua/lsp-utils.lua +++ b/nvim/.config/nvim/lua/lsp-utils.lua @@ -163,6 +163,20 @@ function M.deno_config() } end +function M.elixir_config() + local root_files = { 'mix.exs' } + local root_directory = get_root_directory(root_files) + + return { + name = "elixirls", + cmd = { "elixir-ls" }, + capabilities = default_capabilities, + root_dir = root_directory, + filetypes = { 'elixir', 'eelixir', 'heex', 'surface' }, + single_file_support = true, + } +end + function M.gopls_config() local root_files = { 'go.mod', 'go.work', '.git' } local root_directory = get_root_directory(root_files)