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

use vim.ui.select and vim.ui.input #138

Closed
snaggen opened this issue Jan 8, 2024 · 4 comments · Fixed by #185
Closed

use vim.ui.select and vim.ui.input #138

snaggen opened this issue Jan 8, 2024 · 4 comments · Fixed by #185
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@snaggen
Copy link

snaggen commented Jan 8, 2024

Feature description

It seems that dialogs like lua vim.cmd.RustLsp('codeAction') doesn't use vim.ui.select, which makes custom input like
https://github.com/stevearc/dressing.nvim and https://github.com/nvim-telescope/telescope-ui-select.nvim, not work.

So, it would be nice if the code actions could (and other relevant parts) could use vim.ui.select (and vim.ui.input when that is appropriate).

@snaggen snaggen added the enhancement New feature or request label Jan 8, 2024
@snaggen
Copy link
Author

snaggen commented Jan 8, 2024

For the code action this can be easily worked around by simply using

vim.keymap.set({ 'n', 'v' }, 'ga', vim.lsp.buf.code_action, { silent = true, buffer = bufnr })

But I think this feature request is relevant, since the documentation promotes RustLsp('codeAction')

@mrcjkb
Copy link
Owner

mrcjkb commented Jan 8, 2024

Hey 👋

rust-analyzer provides code actions with additional "group" information. :RustLsp codeAction makes use of that. Afaik, vim.ui.select cannot be used to support groups.

I could do the following:

  • Fall back to the default handler if there are no grouped code actions available.
  • Add this information to the readme.

I'm attending an unconference until Jan 12th, so I might not get around to it until then.

PRs are more than welcome, of course 😃

@mrcjkb mrcjkb added help wanted Extra attention is needed good first issue Good for newcomers labels Jan 8, 2024
@JeanMertz
Copy link
Contributor

Do you have a list or a link to documentation describing those "groups"? I tried finding them on https://rust-analyzer.github.io/manual.html, but couldn't.

I also switched to using vim.lsp.buf.code_action (since I use dressing.nvim), but if I'm missing out on valuable actions that are hidden behind a group, I'd probably go back to the custom implementation, even if it often throws me off a bit as I switch between implementations (e.g. when not in a Rust buffer).

@mrcjkb
Copy link
Owner

mrcjkb commented Jan 12, 2024

It's an experimental feature: https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/lsp-extensions.md#codeaction-groups

You shouldn't be missing out on hidden actions with Neovim's built-in code actions.
The :RustLsp codeAction command is inherited from rust-tools.nvim. I don't really use it myself, and haven't ever felt like I'm missing out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants