Migrating from rust-tools.nvim #122
mrcjkb
announced in
Announcements
Replies: 1 comment
-
|
thanks so much :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey 👋
On January 3rd, 2024, rust-tools.nvim was archived, with a recommendation to switch to this plugin.
For anyone who was sent over here, I've decided to create this migration guide.
lazy.nvim users
For lazy.nvim users, I recommend using this LazyVim PR as a reference.
Main differences compared to rust-tools.nvim
Here is a summary of the most important changes:
setupfunction in order for this plugin to function.It works out of the box.
vim.g.rustaceanvimtable.It is pretty much equivalent to the table you would pass into
require('rust-tools').setup { }.See the readme's advanced configuration section and
:h rustaceanvim.configfor more details.
rt = require('rust-tools')API, and the commands are namespaced.See the readme's Usage section.
For example, the commands
:RustRunnables,:RustDebuggables,:RustExpandMacro, etc.become
:RustLsp runnables,:RustLsp debuggables,:RustLsp expandMacro.This doesn't pollute the command namespace and allows the plugin to provide completions for subcommands.
From Lua, you can access these commands with:
vim.cmd.RustLsp('subcommand')vim.cmd.RustLsp { 'subcommand', 'arg1', 'arg2', ... }if it has arguments:RustLsp explainError,which displays a hover window with explanations from the rust error codes index over error diagnostics (if they have an error code).
See the readme for more features.
codelldborlldbfrom your path, or if you use mason.nvim, from the mason registy,and generate a working configuration for you.
Keymaps
There are various ways you can set your keymaps:
after/ftplugin/rust.luafile.on_attachfunction, similar to how you are used to from rust-tools/lspconfig.The config field is
vim.g.rustaceanvim.server.on_attach.LspAttachautocmd.Known caveats and fixes
With Neovim 0.9, you can use the lsp-inlayhints.nvim or inlay-hints.nvim plugin.
This is something you may need to watch out for, especially if you use mason-lspconfig. In this case, you may need to disable it explicitly.
:checkhealth rustaceanvimwill print an error message if thelspconfig.rust_analyzerconfiguration has been set up.Alternatives
Here are some alternatives in case you don't like the changes:
which supports all the standard LSP features.
If you don't need DAP support, or any of rust-analyzer's non-standard LSP features, this may be enough.
It doesn't implement many features of this plugin, but also implements some featues that this one doesn't.
For example, "View Memory Layout".
It can also be used to complement this plugin or the nvim-lspconfig configuration.
Support
Don't hesitate to
Ask a question if you have any issues migrating
Open an issue
if you think you have found a bug.
Note that this plugin also has a detailed troubleshooting guide.
Cheers 😄
And of course, a big thank you to @simrat39 for his awesome rust-tools.nvim plugin!
Beta Was this translation helpful? Give feedback.
All reactions