Files
LazyVim/lua/lazyvim/plugins/extras/lang/elixir.lua
George Guimarães 2fcd4cdc5f feat(elixir): add support for livebook files (*.livemd) (#4184)
Livebook is a subset of Markdown, so we can safely use markdown's
treesitter for it.

Co-authored-by: Iordanis Petkakis <dpetka2001@users.noreply.github.com>
2024-11-08 14:10:11 +01:00

100 lines
2.5 KiB
Lua

return {
recommended = function()
return LazyVim.extras.wants({
ft = { "elixir", "eelixir", "heex", "surface", "livebook" },
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 = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "elixir", "heex", "eex" })
vim.treesitter.language.register("markdown", "livebook")
end,
},
{
"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,
},
{
"MeanderingProgrammer/render-markdown.nvim",
optional = true,
ft = function(_, ft)
vim.list_extend(ft, { "livebook" })
end,
},
}