Closed leandrocp closed 6 months ago
Can you share your config that you think is correct? I'm not familiar with lsp zero so having your config would help verify
I also just realized you opened this in the neovim plugin, I assumed you meant Next LS.
This plugin basically replaces things like lspzero and lspconfig, can you clarify exactly what you mean?
@leandrocp @mhanberg I use LSP Zero and the way I have this setup is:
First make sure that you have the elixir-tools.nvim
installed as well as nextls
from Mason
(if it didn't install automatically already)
Then in the LSP zero config, before the setup call (lsp.setup()
) make sure you disable/skip the Elixir setup like:
lsp.skip_server_setup({ "elixir_ls", "elixirls" }) -- We're setting the new `nextls` server below
Then, AFTER the lsp.setup()
call:
local elixir = require("elixir")
local elixirls = require("elixir.elixirls")
local elixir_on_attach = function(client, bufnr)
local opts = { buffer = true, noremap = true }
on_attach(client, bufnr)
vim.keymap.set("n", "<leader>fp", ":ElixirFromPipe<CR>", opts)
vim.keymap.set("n", "<leader>tp", ":ElixirToPipe<CR>", opts)
vim.keymap.set("v", "<leader>em", ":ElixirExpandMacro<CR>", opts)
end
elixir.setup({
nextls = {
enable = true,
cmd = "/Users/bj/.local/share/nvim/mason/bin/nextls",
on_attach = elixir_on_attach,
init_options = {
experimental = {
completions = { enable = false },
},
},
},
credo = {
enable = true,
},
elixirls = {
cmd = "/Users/bj/.local/share/nvim/mason/bin/elixir-ls",
enable = true, -- this needs to be enabled until `nextls` works with all the features that this does.
settings = elixirls.settings({
fecthDeps = true,
dialyzerEnabled = true,
enableTestLenses = false,
}),
on_attach = elixir_on_attach,
},
})
NOTE: That the on_attach
function is the one that I use for all the servers, and here I'm expanding it to include the custom commands for Elixir like FromPipe
or ToPipe
.
@mhanberg my config is pretty similar to the one posted by @bjufre (thanks!) but I didn't know about lsp.skip_server_setup
, seems like that's the key to make it work well with lspzero
Feel free to close this issue, either way it will be useful for future reference.
I think I got it working with https://github.com/VonHeikemen/lsp-zero.nvim but an official example would be nice. Thanks for this project!