haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.66k stars 355 forks source link

Add import code action is unavailable in 1.1.0 (Neovim/Coc) #1786

Closed gregorias closed 3 years ago

gregorias commented 3 years ago

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

haskell-language-server version: 1.1.0.0 (GHC: 8.10.4) (PATH: /usr/bin/haskell-language-server-wrapper) (GIT hash: f1c096927186a93d8e3ccd4fe8385cc1b070350b)
Tool versions found on the $PATH
cabal:          3.2.0.0
stack:          2.5.1
ghc:            8.10.4

Which OS do you use: Manjaro Which lsp-client do you use: Neovim/Coc.nvim Describe your project (alternative: link to the project): https://github.com/gregorias/hledupt

Steps to reproduce

None yet, sorry. I've tried compiling hls from source to bisect commits and maybe pinpoint the culprit change, but I could get the build to work. Let me know if you need more information.

Expected behaviour

With hls 1.0.0, I get code actions that suggest adding imports if a name is missing:

Screenshot from 2021-05-02 14-16-21

Actual behaviour

With the update to hls 1.1.0, the code action no longer appears:

Screenshot from 2021-05-02 14-16-59

Include debug information

Paste the logs from the lsp-client, e.g. for VS Code

LSP logs: ``` ## versions vim version: NVIM v0.5.0-dev+1282-gfbe18d9ca node version: v16.0.0 coc.nvim version: 0.0.80-89a2dc8fc8 coc.nvim directory: /home/grzesiek/.config/nvim/plugged/coc.nvim term: tmux platform: linux ## Log of coc.nvim 2021-05-02T14:22:34.815 INFO (pid:418110) [services] - registered service "languageserver.haskell" 2021-05-02T14:22:34.817 INFO (pid:418110) [services] - haskell state change: stopped => starting 2021-05-02T14:22:34.944 INFO (pid:418110) [services] - registered service "jedi" 2021-05-02T14:22:34.956 INFO (pid:418110) [plugin] - coc.nvim 0.0.80-89a2dc8fc8 initialized with node: v16.0.0 after 211ms 2021-05-02T14:22:34.960 INFO (pid:418110) [language-client-index] - Language server "languageserver.haskell" started with 418131 2021-05-02T14:22:35.719 INFO (pid:418110) [services] - haskell state change: starting => running 2021-05-02T14:22:35.722 INFO (pid:418110) [services] - service languageserver.haskell started 2021-05-02T14:22:40.395 INFO (pid:418110) [attach] - receive notification: highlight [] 2021-05-02T14:22:40.929 INFO (pid:418110) [attach] - receive notification: highlight [] 2021-05-02T14:22:41.091 INFO (pid:418110) [attach] - receive notification: codeActionRange [ 220, 220, 'quickfix' ] 2021-05-02T14:22:43.802 INFO (pid:418110) [attach] - receive notification: showInfo [] ``` ```
gregorias commented 3 years ago

I've fixed the issue. I've been using :CocFix which shows only quickfix actions. After I've switched to using :CocAction, I get the "add import" again.

I presume that the changed behaviour stems from removing "add import" from quickfix actions.