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

:RustLsp renderDiagnostic floating window behavior #603

Closed
rywng opened this issue Dec 4, 2024 · 1 comment
Closed

:RustLsp renderDiagnostic floating window behavior #603

rywng opened this issue Dec 4, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@rywng
Copy link
Contributor

rywng commented Dec 4, 2024

Feature description

Hello, I have two issues with the command:

  1. In current implementation, running it again without arguments (:RustLsp renderDiagnostic) only cycles forward but not backwards, which is not really convenient and the functionality can be replaced by either nvim's built ins like vim.diagnostic.goto_next() and vim.diagnostic.goto_prev() or 3rd party plugins like :Telescope diagnostics. This is also talked about in Is it possible to cycle to prev instead of next? #599
  2. If you run :RustLsp renderDiagnostic current, it shows up the diagnostic window with a option to "open in split", but running the command again wont focus on the window, and afaik there's now way to actually access the "open in split" menu:
    image

For reference, in nvim's built in lsp commands, for example if you press K on a symbol, on the first time it would open up a popup:
image

and the second time you press it will focus the pop up and allow you to navigate inside the menu:

image

So I would suggest removing the cycle option, and enable users to focus the pop up menu when running the command twice, like many other lsp commands.

@rywng rywng added the enhancement New feature or request label Dec 4, 2024
@mrcjkb
Copy link
Owner

mrcjkb commented Dec 4, 2024

Hey 👋

As you mentioned, your first issue is a duplicate of #599, so let's remove that from this issue and adjust the title.

Regarding your second issue:

The renderDiagnostic command uses vim.lsp.util.open_floating_preview, which is different from Neovim's hover windows (which is what you are referring to with "pressing K on a symbol").
You can use <C-w>w (ctrl+w+w) and Neovim's various other window navigation keymaps, (<C-w>h, <C-w>j, etc.) to navigate to the hover window.
Given the difference and the fact that you can navigate to the diagnostic window, I don't think implementing an equivalent to "pressing K twice" is really worth the added code complexity (but I'm open to being proven wrong via a PR 😄).

That being said, it's probably worth adding a <Plug> mapping, like the one for the hover action command.

I'll close this for now. Please feel free to open a PR if you would like the K+K-like behaviour, e.g. by running the command a second time, without any arguments.

@mrcjkb mrcjkb closed this as not planned Won't fix, can't repro, duplicate, stale Dec 4, 2024
@rywng rywng changed the title improving :RustLsp renderDiagnostic Pressing :RustLsp renderDiagnostic twice should open the diagnostic window Dec 5, 2024
@rywng rywng changed the title Pressing :RustLsp renderDiagnostic twice should open the diagnostic window :RustLsp renderDiagnostic floating window behavior Dec 5, 2024
rywng added a commit to rywng/rustaceanvim that referenced this issue Dec 5, 2024
BREAKING CHANGE: Running :rustLsp explainError will now only explain
error on current line, users are suggested to use
vim.diagnostic.goto_prev() and vim.diagnostic.goto_next() for
navigation, as stated in issue
mrcjkb#603 and
mrcjkb#599
rywng added a commit to rywng/rustaceanvim that referenced this issue Dec 5, 2024
BREAKING CHANGE: Running :rustLsp explainError will now only explain
error on current line, users are suggested to use
vim.diagnostic.goto_prev() and vim.diagnostic.goto_next() for
navigation, as stated in issue
mrcjkb#603 and
mrcjkb#599
rywng added a commit to rywng/rustaceanvim that referenced this issue Dec 5, 2024
BREAKING CHANGE: Running :rustLsp explainError will now only explain
error on current line, users are suggested to use
vim.diagnostic.goto_prev() and vim.diagnostic.goto_next() for
navigation, as stated in issue
mrcjkb#603 and
mrcjkb#599
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants