Closed tchoutri closed 1 year ago
Hi. Thanks for reporting this.
For some reason, with the minimal config, the nightly build of Neovim doesn't seem to output error messages when setting a keymap fails. So it just fails silently, making this quite hard to debug.
The config you pasted doesn't actually call the haskell-tools.setup()
function, but I'm guessing that was by accident...
Here are the errors I found in your config:
vim.lsp.diagnostic
has been deprecated for a while, and moved to vim.diagnostic
. The vim.lsp.diagnostic
functions no longer exist in recent Neovim versions.
I would recommend setting keymaps for vim.diagnostic
globally, as there are many non-LSP related plugins that can make use of this feature (e.g. neotest, nvim-lint, ...).
The syntax has changed a bit. See :h diagnostic
for details.
The line
keymap.set('n', '<space>wl', print(vim.inspect(vim.lsp.buf.list_workspace_folders())), opts)
should be
keymap.set("n", "<space>wl", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts)
For some strange reason, it only works when I move def_opts = {...}
and keymap = vim.keymap
(at the top of the minimal config) into the on_attach
function.
It's as if they're not captured by the function, which should normally not be the case in Lua.
My guess is that packer's startup
function somehow clears the scope so that nothing from outside of on_attach
can be captured?
The config you pasted doesn't actually call the haskell-tools.setup() function, but I'm guessing that was by accident...
Well-spotted. I recently saw that the README had changed since last time I looked at it, and .setup
was replaced by .start_or_attach
. I thought that on_attach
would be the equivalent callback for in-packer configuration? :)
You can still call setup
if you want to configure in packer's startup
.
start_or_attach
is meant to be used in ftplugin/haskell.lua
(in which case it will only be called if you open a Haskell file). Here's the announcement with all the details :)
I'll close this for now, assuming it's solved. Please reopen if you're still having issues :)
Neovim version (nvim -v)
NVIM v0.9.0-dev+1009-gf1816f9ee
Operating system/version
Fedora 37
Output of
haskell-language-server-wrapper --version
haskell-language-server version: 1.9.1.0 (GHC: 9.4.4)
How to reproduce the issue
Expected behaviour
Any kind of output or message.
Actual behaviour
nvim has a little spike of CPU consumption (from 0.0% to 0.7%) but nothing happens on the UI.
Log files
No response
The minimal config used to reproduce this issue.