Files
LazyVim/lua/lazyvim/plugins/extras/lang/elixir.lua
George Guimarães f94a0591b3 feat(elixir): add elixirls code actions (#4148)
This is a refactoring of #3846  with the changes:

- Use `Lazyvim.lsp.execute` on keymaps to make everything simpler;
- Remove expandMacro. 

Closes #3846

---------

Co-authored-by: Ahmed Kamal <ahmed@moon-i.com.au>
2024-07-23 00:11:30 +02:00

89 lines
2.2 KiB
Lua

return {
recommended = function()
return LazyVim.extras.wants({
ft = { "elixir", "eelixir", "heex", "surface" },
root = "mix.exs",
})
end,
{
"neovim/nvim-lspconfig",
opts = {
servers = {
elixirls = {
keys = {
{
"<leader>cp",
function()
local params = vim.lsp.util.make_position_params()
LazyVim.lsp.execute({
command = "manipulatePipes:serverid",
arguments = { "toPipe", params.textDocument.uri, params.position.line, params.position.character },
})
end,
desc = "To Pipe",
},
{
"<leader>cP",
function()
local params = vim.lsp.util.make_position_params()
LazyVim.lsp.execute({
command = "manipulatePipes:serverid",
arguments = { "fromPipe", params.textDocument.uri, params.position.line, params.position.character },
})
end,
desc = "From Pipe",
},
},
},
},
},
},
{
"nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "elixir", "heex", "eex" } },
},
{
"nvim-neotest/neotest",
optional = true,
dependencies = {
"jfpedroza/neotest-elixir",
},
opts = {
adapters = {
["neotest-elixir"] = {},
},
},
},
{
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
local nls = require("null-ls")
opts.sources = vim.list_extend(opts.sources or {}, {
nls.builtins.diagnostics.credo.with({
condition = function(utils)
return utils.root_has_file(".credo.exs")
end,
}),
})
end,
},
{
"mfussenegger/nvim-lint",
optional = true,
opts = function(_, opts)
opts.linters_by_ft = {
elixir = { "credo" },
}
opts.linters = {
credo = {
condition = function(ctx)
return vim.fs.find({ ".credo.exs" }, { path = ctx.filename, upward = true })[1]
end,
},
}
end,
},
}