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

Is it possible to cycle to prev instead of next? #599

Open
svanharmelen opened this issue Dec 1, 2024 · 3 comments
Open

Is it possible to cycle to prev instead of next? #599

svanharmelen opened this issue Dec 1, 2024 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@svanharmelen
Copy link

svanharmelen commented Dec 1, 2024

I have a custom function for moving around warnings and errors which I use for multiple languages. Plugging in rustaceanvim (after just finally moving away from rust-tools 🙈) is super easy by adding an additional elseif like so:

  <snip>
  elseif vim.bo.filetype == 'rust' then
    vim.cmd.RustLsp('renderDiagnostic')
  else
    vim.diagnostic.goto_next()
  end

But I have two of these functions, one for moving to the next as shown above, but another one moving to the previous like this:

  <snip>
  elseif vim.bo.filetype == 'rust' then
    vim.cmd.RustLsp('renderDiagnostic')
  else
    vim.diagnostic.goto_prev()
  end

But in this case when in a Rust file it doesn't actually move to the previous. Is there a way to achieve this? Thanks!

@svanharmelen svanharmelen added the enhancement New feature or request label Dec 1, 2024
@svanharmelen
Copy link
Author

Ow I guess I should have opened a blank issue as this is more a question then a feature request... Unless of course if it currently isn't possible 😉

@mrcjkb
Copy link
Owner

mrcjkb commented Dec 2, 2024

Hey 👋

No, cycling in the opposite direction is currently not possible.
I typically use normal diagnostics to navigate and then have a keymap for vim.cmd.RustLsp {'renderDiagnostic', 'current' } when I want the rendered diagnostic.

@mrcjkb mrcjkb closed this as completed Dec 2, 2024
@mrcjkb mrcjkb reopened this Dec 2, 2024
@mrcjkb mrcjkb added the good first issue Good for newcomers label Dec 2, 2024
@svanharmelen
Copy link
Author

Hmm... That might be a nice workflow for me as well. I'll give it a go... 👍🏻

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 good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants