You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
If you do need to change the default configuration, you can set the vim.g.rustaceanvim table.
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.config
for more details.
This plugin no longer depends on nvim-lspconfig.
There is no 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
This plugin's CI only tests with Neovim 0.9 and Neovim nightly. As a result, I cannot guarantee compatibility with older versions of Neovim.
Since forking, I've added some new features, for example :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.
For DAP, this plugin will automatically pick up codelldb or lldb from your path, or if you use mason.nvim, from the mason registy,
and generate a working configuration for you.
Codebase improvements
Type annotations + static type checking in CI
Various bug fixes
Keymaps
There are various ways you can set your keymaps:
In a after/ftplugin/rust.lua file.
In an on_attach function, similar to how you are used to from rust-tools/lspconfig.
The config field is vim.g.rustaceanvim.server.on_attach.
I have removed inlay hints from this plugin. They will be built-in in Neovim 0.10.
With Neovim 0.9, you can use the lsp-inlayhints.nvim or inlay-hints.nvim plugin.
Because this plugin doesn't depend on nvim-lspconfig, using its rust-analyzer configuration may cause conflicts with this 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 rustaceanvim will print an error message if the lspconfig.rust_analyzer configuration has been set up.
Alternatives
Here are some alternatives in case you don't like the changes:
nvim-lspconfig has a basic configuration for rust-analyzer,
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.
ferris.nvim, which doesn't automatically set up the LSP client.
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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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:
setup
function in order for this plugin to function.It works out of the box.
vim.g.rustaceanvim
table.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.config
for 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.
codelldb
orlldb
from 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.lua
file.on_attach
function, similar to how you are used to from rust-tools/lspconfig.The config field is
vim.g.rustaceanvim.server.on_attach
.LspAttach
autocmd.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 rustaceanvim
will print an error message if thelspconfig.rust_analyzer
configuration 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