haskell-language-server icon indicating copy to clipboard operation
haskell-language-server copied to clipboard

Add a code action provider for the eval plugin (existing code lens)

Open michaelpj opened this issue 5 years ago • 8 comments

At the moment it's only a code lens, but it could be a code action too.

In lsp-mode this means it shows up when you explicitly show code lenses, but not in the sideline that shows code actions. So I actually thought it was broken (although arguably this just shows that I don't know lsp-mode well enough :sweat_smile:).

michaelpj avatar Oct 13 '20 10:10 michaelpj

https://github.com/emacs-lsp/lsp-haskell/issues/89

This also means that the eval plugin doesn't work with emacs lsp-mode

jmorag avatar Oct 13 '20 17:10 jmorag

It does work, it just only works as a code lens. So you need to run lsp-lens-show to make the lenses show up. That's the way lsp-mode does code lenses vs code actions. Maybe we should open an issue there about improving the discoverability of code lenses.

michaelpj avatar Oct 13 '20 17:10 michaelpj

When I click the code lens, it doesn't insert the value of the evaluation, it just crashes with

(error "BadDependency "GhcSessionDeps"")
LSP :: Please open an issue in lsp-mode for implementing `21444:eval:evalCommand'.

@michaelpj does it insert the evaluation for you?

jmorag avatar Oct 13 '20 17:10 jmorag

Yes, it works fine. I think you have a server issue that's unrelated to this one, I suggest opening another issue with the reproduction instructions.

michaelpj avatar Oct 13 '20 17:10 michaelpj

There is other issue asking to have code lenses as code actions: #550

jneira avatar Dec 16 '21 10:12 jneira

I think it would be nice if all code lens providers also provided equivalent code actions.

michaelpj avatar Dec 16 '21 11:12 michaelpj

we could do it generically in hls-plugin-api, i hope

jneira avatar Dec 16 '21 12:12 jneira

This would be a great thing to have.

I have chosen to disable code lenses since I find it clutters the code (granularity of settings for enabling code lenses in various contexts is limited, so electing to turn them off completely for the moment), however, this currently means I can't use the eval plugin.

carlwr avatar Jul 11 '24 11:07 carlwr