Open sagehane opened 2 days ago
I can reproduce this, though I surprisingly never have before just by chance.
The hook this plugin installs is not specific to the type of file being read. I am not sure (having not looked into it) if there would be a more appropriate way to install the hook that was more targeted, but I am sure this can be worked around in your implementation of that callback at least.
Try changing your save hook to something like:
local function save_hook(action)
if not action or not action.title then
return
end
local code_action = require('idris2.code_action')
local filters = code_action.filters
local introspect = code_action.introspect_filter
...
end
Due to my ignorance of pretty much everything involved (Lua, Neovim, this repo), I have no idea what that's supposed to do. But hey, at least it's definitely work for me. Both this LSP and haskell-language-server code actions work now as I would expect.
New config:
local code_action = require('idris2.code_action')
local filters = code_action.filters
local introspect = code_action.introspect_filter
local function save_hook(action)
-- https://github.com/ShinKage/idris2-nvim/issues/33#issuecomment-2425178847
if not action or not action.title then
return
end
if introspect(action) == filters.MAKE_CASE
or introspect(action) == filters.MAKE_WITH then
return
end
vim.cmd('silent write')
end
Edit: I presume I should keep this issue open until the README is fixed?
Sorry beforehand if this is a dumb question and I'm just using the LSP wrong.
I'm using https://www.lazyvim.org/ as my package manager for Neovim and here's my
~/.config/nvim/lua/plugins/idris2.lua
file:Now, when trying some other LSP code action with
:lua vim.lsp.buf.code_action()
, I get an error.Sample Haskell file with haskell-language-server:
Error message as reported to
:messages
: