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

Some sort of filtering on code actions menu #3502

Open
k3d3 opened this issue Aug 22, 2022 · 7 comments · May be fixed by #9875
Open

Some sort of filtering on code actions menu #3502

k3d3 opened this issue Aug 22, 2022 · 7 comments · May be fixed by #9875
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@k3d3
Copy link

k3d3 commented Aug 22, 2022

Describe your feature request

There are some scenarios where there are a lot of code action options available, and the option I want is very far down the list.

This is what I encountered today: I created a new .rs file, and added an Arc. I wanted to use Space+A to use LSP to import it, and this is what showed up:

image

So I use tab to go further down...

image

and further still...

image

and another page of options...

image

until finally I get to the option I'm looking for:

image

I'm not sure what the best UI/UX choice would be for this, but it would be nice if there was some way to filter out or "search" the options, e.g. if I could hit Space+A and then type "imp" to get the import option. As is, if I type "imp" I end up inserting the text "mp" into the document, which I assume is because I'm in normal mode while the modal is up.

Any thoughts on this? For now, it looks like hitting Shift+Tab twice works, so it's not a huge deal in the mean time.

@k3d3 k3d3 added the C-enhancement Category: Improvements label Aug 22, 2022
@archseer
Copy link
Member

Okay in this case you're not talking about autocomplete, but code actions.

@archseer
Copy link
Member

The original UI actually had a small picker for this but I didn't expect the LSP to ever offer this many options so we simplified to a menu

@k3d3
Copy link
Author

k3d3 commented Aug 22, 2022

Ah okay, I figured I got the terminology wrong - I'll modify the title.

@k3d3 k3d3 changed the title Some sort of filtering on autocomplete Some sort of filtering on code actions menu Aug 22, 2022
@the-mikedavis the-mikedavis added the A-helix-term Area: Helix term improvements label Aug 22, 2022
@k3d3
Copy link
Author

k3d3 commented Aug 22, 2022

When you say "the original UI had a small picker," do you mean the UI was something similar to the fuzzy finder used for files?

And yeah, I'm surprised rust-analyzer is offering this many options as well.

Perhaps if any change were to be made, would it be best to only give a larger picker (instead of a menu) if the LSP returns more than, say, 10 items? But in that case, you'd have inconsistency between the two interfaces, which sucks if you don't know which interface will appear beforehand.

@CptPotato
Copy link
Contributor

Perhaps if any change were to be made, would it be best to only give a larger picker (instead of a menu) if the LSP returns more than, say, 10 items? But in that case, you'd have inconsistency between the two interfaces, which sucks if you don't know which interface will appear beforehand.

One general way I could see is to always use a menu (the current behavior) and adding a function/keybind to open the current menu in a picker.

For consistency, this could be used for other menus aswell like auto complete.
But I'm not sure if this will work in all cases where menus are used.

@mdevlamynck
Copy link

It would be awesome to be able to select the action through fuzzy search so a picker would be nice (if that's the correct term).

One general way I could see is to always use a menu (the current behavior) and adding a function/keybind to open the current menu in a picker.

Could that be paired with an option to open the menu in a picker by default? It would be much more comfortable and faster to select the item you want, especially if you know in advance its name (e.g. for import actions) if you can avoid an extra key press.

Or maybe instead of an option a simple remap like space = { a = ["code_action", "open_current_menu_in_picker"] } }.

@pascalkuthe
Copy link
Member

Hi, I have just opened #4134.
That PR sorts code-actions by their categories instead of alphabetically.
Language Severs are usually very aware that they are sending a lot of code-actions and use the kind field of the LSP spec to hint at the client how to sort these, so that the most commonly used actions appear at the top.

While that PR doesn't directly solve the feature request (fuzzy matching on code-actions), it does solve the original usecase: With #4134 the Import 'std::sync::Arc' code-action appears as the first item in the menu.

John-Toohey added a commit to John-Toohey/helix that referenced this issue Mar 14, 2024
@John-Toohey John-Toohey linked a pull request Mar 14, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

6 participants