yining / vim-rustcexplain

view `rustc --explain` from inside Vim
2 stars 2 forks source link

make vim-rustcexplain work with trouble.nvim #3

Open dlyongemallo opened 2 weeks ago

dlyongemallo commented 2 weeks ago

I use the Trouble plugin for neovim to edit Rust code. One of its features is a pretty diagnostics list. It would be nice to be able to use vim-rustcexplain to show help on the error shown in the current line:

Screenshot from 2024-06-14 09-43-49

I've currently implemented a hack which calls RustcExplain, but this requires moving the cursor to the error code.

vim.keymap.set("n", "<LocalLeader>e", function()
    vim.cmd([[
        let errcode=expand("<cword>")
        exec "RustcExplain " . errcode
    ]])
end)

It would be much nicer to be able to do this from anywhere on the line, but a direct call to rustcexplain#OpenExplainPopup() results in no error code found.

yining commented 2 weeks ago

hi @dlyongemallo

I will get back to you on this soon.