Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: 💡 Light bulb on code actions 💡 #2011

Open
David-Else opened this issue Apr 7, 2022 · 7 comments
Open

Feature Request: 💡 Light bulb on code actions 💡 #2011

David-Else opened this issue Apr 7, 2022 · 7 comments
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@David-Else
Copy link
Contributor

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!

@David-Else David-Else added the C-enhancement Category: Improvements label Apr 7, 2022
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Apr 7, 2022
@archseer
Copy link
Member

archseer commented Apr 8, 2022

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

@sudormrfbin
Copy link
Member

sudormrfbin commented Apr 8, 2022

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.

@David-Else
Copy link
Contributor Author

David-Else commented Apr 8, 2022

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

@matklad
Copy link
Contributor

matklad commented Dec 20, 2022

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 💡 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 💡 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

@matklad
Copy link
Contributor

matklad commented Dec 20, 2022

UI-wise, a less noisy option is to show 💡 in the modline.

@David-Else
Copy link
Contributor Author

@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 :)

@matklad
Copy link
Contributor

matklad commented Jul 6, 2024

No, I am not planning to do any actual work in this area :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

5 participants