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

renderDiagnostic several issues #193

Closed
Amleto opened this issue Jan 28, 2024 · 5 comments
Closed

renderDiagnostic several issues #193

Amleto opened this issue Jan 28, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Amleto
Copy link

Amleto commented Jan 28, 2024

Neovim version (nvim -v)

v0.10.0

Operating system/version

win10 (win terminal, cmd.exe)

Output of :checkhealth rustaceanvim

rustaceanvim: require("rustaceanvim.health").check()

Checking for Lua dependencies ~
- WARNING dap not installed. Needed for debugging features [mfussenegger/nvim-dap](https://github.com/mfussenegger/nvim-dap)

Checking external dependencies ~
- OK rust-analyzer: found 
- OK Cargo: found 
- OK rustc: found 
- OK lldb: found 

Checking config ~
- OK No errors found in config.

Checking for conflicting plugins ~
- OK No conflicting plugins detected.

How to reproduce the issue

Prepare a rust project with single main file:

// consumes the vec
fn consume<T>(_v: Vec<T>) {

}

fn main() {
    let v = vec![1,2,3];
    consume(v);
    consume(v);
}

From the cargo project root:

PART ONE

export NVIM_DATA_MINIMAL=$(mktemp -d)
export NVIM_APP_NAME="nvim-minimal"
nvim -u minimal.lua
:e src/main.rs
(:w if analyzer doesnt show diagnostics)
:RustLsp renderDiagnostic

PART TWO (just continue, no need to restart)

Rename `v` in the `consume` function def to `_v`.
:w
gg
(`:make build` can be done, makes no difference)
:RustLsp renderDiagnostic

Expected behaviour

PART ONE

If the naming warning should even be found by render-diagnostic then the cursor should jump to the diagnostic location and open the float window.

PART TWO

I expect the float to show the combined information about the use-after-move error

Actual behaviour

PART ONE

Float window opens, cursor moves (causing the float window to close - it flashes up for a fraction of a second).

PART TWO

Nothing happens.

The minimal config used to reproduce this issue.

local config_path = vim.fn.stdpath('config')
vim.opt.rtp:remove(config_path)

-- Ignore default plugins
local data_path = vim.fn.stdpath('data')
local pack_path = data_path .. '/site'
vim.opt.packpath:remove(pack_path)

-- bootstrap lazy.nvim
data_path = assert(os.getenv('NVIM_DATA_MINIMAL'), '$NVIM_DATA_MINIMAL environment variable not set!')
local lazypath = data_path .. '/lazy/lazy.nvim'
local uv = vim.uv
  ---@diagnostic disable-next-line: deprecated
  or vim.loop
if not uv.fs_stat(lazypath) then
  vim.fn.system {
    'git',
    'clone',
    '--filter=blob:none',
    'git@github.com:folke/lazy.nvim.git',
    '--branch=stable',
    lazypath,
  }
end
vim.opt.rtp:prepend(lazypath)

local lazy = require('lazy')

lazy.setup({
  {
    'mrcjkb/rustaceanvim',
    version = '^3',
    init = function()
      -- Configure rustaceanvim here
      vim.g.rustaceanvim = {}
    end,
    ft = { 'rust' },
  },
  -- Add any other plugins needed to reproduce the issue.
  -- see https://github.com/folke/lazy.nvim#-lazynvim for details.
}, { root = data_path, state = data_path .. '/lazy-state.json', lockfile = data_path .. '/lazy-lock.json' })
@Amleto Amleto added the bug Something isn't working label Jan 28, 2024
@mrcjkb
Copy link
Owner

mrcjkb commented Jan 28, 2024

Hey 👋

Thanks for the detailed report! Fix is on the way 😄

@Amleto
Copy link
Author

Amleto commented Jan 28, 2024

Oh sweet, that was responsive!

Look forward to trying this out.

Btw I couldn't manage to 'get into' the render diagnostic float by calling the command twice. Not sure if that is a related or separate issue.

@mrcjkb
Copy link
Owner

mrcjkb commented Jan 28, 2024

Btw I couldn't manage to 'get into' the render diagnostic float by calling the command twice. Not sure if that is a related or separate issue.

Yep, explainError and renderDiagnostic will cycle to the next explainable error/renderable diagnostic if you call the command again.
Entering the float by calling the command twice is currently exclusive to hovers. That's handled by Neovim, not this plugin.

I might look into implementing that if I have some more time (it would definitely be more consistent).
Currently, I use <C-w><C-w> to switch to the float window.

@mrcjkb
Copy link
Owner

mrcjkb commented Jan 28, 2024

Fixed with d0cec19 (version 4.0.3)

@mrcjkb mrcjkb closed this as completed Jan 28, 2024
@Amleto
Copy link
Author

Amleto commented Jan 28, 2024

Btw I couldn't manage to 'get into' the render diagnostic float by calling the command twice. Not sure if that is a related or separate issue.

Yep, explainError and renderDiagnostic will cycle to the next explainable error/renderable diagnostic if you call the command again. Entering the float by calling the command twice is currently exclusive to hovers. That's handled by Neovim, not this plugin.

I might look into implementing that if I have some more time (it would definitely be more consistent). Currently, I use <C-w><C-w> to switch to the float window.

Thanks, that's good to know!

And thanks for the fix 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants