jan-xyz / lsp-preview.nvim

A Neovim plugin that allows previewing of LSP changes.
GNU General Public License v3.0
4 stars 0 forks source link

merge action selector with action preview #2

Open pidgeon777 opened 7 months ago

pidgeon777 commented 7 months ago

In the current implementation, when running a code action with preview, first you have to select the wished action, then you have another Telescope prompt displaying the preview. Finally, you have to press Enter to confirm the action.

It would be nice to add an option so that, as soon as you run the code action with preview command, the preview is displayed directly for each of the available actions, and pressing Enter would confirm the selected action.

Regarding the rename command, you could maybe use the Telescope prompt as new name input, showing the preview in Telescope:

jan-xyz commented 7 months ago

That's necessary because most workspaceEdits consist of a list of TextEdits and you can select and choose to apply with <tab>. It will become more useful once I figure out how to best do the UX for displaying, previewing and selecting the individual TextEdits.

See also my comment here: https://github.com/jan-xyz/lsp-preview.nvim/issues/1#issuecomment-2024718914

pidgeon777 commented 7 months ago

A Neovim UI library has recently been released here, in case you find it useful:

https://www.reddit.com/r/neovim/comments/1bkb981/introducing_nuicomponents_a_library_that/

jan-xyz commented 7 months ago

Yes! That looks much more flexible than telescope! I will have a look, I was mostly running into telescope's limitations when working on the TextEdit selection. Let's see.

For later reference the documentation: https://nui-components.grapp.dev/

jan-xyz commented 7 months ago

Another note: I am planning to stay as close as possible for now to the standard implementation in Neovim for those functions to benefit from upstream bug fixes and improvements. It also means that I don't have control over the UX for inputting the new name in rename or the list of code actions. That all comes from Neovim. Currently, I'm only patching an internal method that would apply all changes and TextEdits without asking the user for selection. I might also change that to gain more control in the future for now my main concern is getting the preview and TextEdit selection right.