helix
helix copied to clipboard
Feature Request: 💡 Light bulb on code actions 💡
At the moment there is no way to discover if a code action exists other than moving around pressing space a. In Neovim this simple plugin https://github.com/kosayoda/nvim-lightbulb shows a little lightbulb when there is a code action available on your cursor position.
It would be great to have this in Helix!
We can probably do this in the idle timeout that's also used for completion. Would also be a good place to trigger documentHighlights https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentHighlight
While i like the feature itself, it can also be distracting depending on the scope of code actions sent by the server. rust-analyzer for example has code actions for flipping a binary comparison when the cursor is on a ==, which I wouldn't want be reminded about since it's pretty trivial.
How about a space + t for toggle and place any options that wants toggling there? Something like:
space + t + a toggle lightbulb on code action
space + t + l toggle line numbers
space + t + d toggle lsp diagnostics
While i like the feature itself, it can also be distracting depending on the scope of code actions sent by the server. rust-analyzer for example has code actions for flipping a binary comparison when the cursor is on a ==, which I wouldn't want be reminded about since it's pretty trivial.
Yeah, that's the main UX problem with :bulb: in the limit, there's an infinite amount of assists for all imaginable cases, and it's hard to teach the user what's available.
One idea I had a while back, is to create a tutorial-like experience, with the editor maintaining the set of code actions which the user invoked at least once. That way, a :bulb: is shown only for "new" assists. This allows to both:
- teach new users about all existing assists
- incrementally teach old users about new assists as they get implemented by the language server
UI-wise, a less noisy option is to show :bulb: in the modline.
@matklad A long time has passed since this thread was created, now we have an event system would it be easier to implement the lightbulb, are you still using Helix and is this something you might consider doing a PR for at some point? Just a simple lightbulb with the ability to turn it on and off in the config would be amazing :)
No, I am not planning to do any actual work in this area :)