I see in VSCode you can click the little lightbulb on the side, but in neovim+coc I can't seem to figure it out. I've tried both "coc-codeaction" and "coc-fix-current" and it tells me it's not available for each.
coc-codeaction and coc-codeaction-selected usually work for me. Some refactoring tools don't work when TH is present.
I'm not using template Haskell or even any weird language extensions. Do these other tools need to be installed separately? Are there more verbose error messages?
By some refactoring tools I mean things provided by hie. Last time I checked it was not being able to get typechecked module or something like that.
Is apply-refact not provided by hie? I'm pretty sure I saw it installing. This is the file I'm editing: https://github.com/mr/ftp-client/blob/master/ftp-client/src/Network/FTP/Client.hs
Like I said, it's not too interesting. When installing I just ran
stack ./install.hs hie-8.6.5
stack ./install.hs build-data
Using coc.nvim too, so here i am. With last hie and ghc 8.6.5.
I don't have action (light bulb) in vscode either.
Suppose some simple test as
main :: IO ()
main = putStrLn ("hello")
Diagnostics show redundant brackets with hlint help as it should, but there is no action (refactoring) to remove them. So it is not neovim problem. And other lsp plugin for vim like LanguageClient-neovim actually can use actions to remove this brackets.
Any ideas?
@mr Did you fix this by any chance?
Some investigation:
hlint src/Lib.hs --refactor --refactor-options="--inplace" returns error
hlint: Could not find refactor
Tried with: refactor
CallStack (from HasCallStack):
error, called at src/HLint.hs:251:20 in hlint-2.1.26-IuMN8edws1DBXpGceL1aAV:HLint
So seems apply-refactor don't integrated into hlint. Still weird that other plugins can apply refactoring.
More investigations.
Have installed explicitly apply-refact, this fixes hlint --refactor itself, but there is still no Action to automatically fix it inside vscode or vim with con.nvim. But as i mentioned earlier - LanguageClient-neovim can use such action to automatically fix hlint suggestions.
Sadly I haven't come up with any solution and have just been editing the old fashioned way
Ok, with rebuilding last hie i now have all actions that README describes (add missing packages, apply hlint hints etc).
@mr Are you able to get diagnostics first? The hint code actions come from the diagnostics, so you'll need to put your cursor underneath it first before calling coc-codeaction