Open tubzby opened 1 year ago
try
opts = function()
return {
tools = {...}
}
end
or
config = function() {
require('rust-tools').setup({tools = {...}})
}
Thanks @songww , now I can see rust-tools is loaded in lazyvim.
But I when opened a RUST project, there's no inlay hints and the RustEnableInlayHints command shows "Not an editor command".
I have no idea, It works fine for me.
Thanks @songww , now I can see rust-tools is loaded in lazyvim.
But I when opened a RUST project, there's no inlay hints and the RustEnableInlayHints command shows "Not an editor command".
Another option: https://github.com/lvimuser/lsp-inlayhints.nvim#rust
@polyzen thanks. Can anyone point a way out to debug or check the logs?
BTW, I'm using kickstart with some other plugins.
Thanks @songww , now I can see rust-tools is loaded in lazyvim. But I when opened a RUST project, there's no inlay hints and the RustEnableInlayHints command shows "Not an editor command".
Another option: https://github.com/lvimuser/lsp-inlayhints.nvim#rust
lsp-inlayhints.nvim works for me!
In case anybody else comes to this, I find out that rust-tools is in conflict with mason|mason_lsp rust-analyzer.
In case anybody else comes to this, I find out that rust-tools is in conflict with mason|mason_lsp rust-analyzer.
It works fine for me.
@tubzby FYI:
return {
{
"simrat39/rust-tools.nvim",
dependencies = { "neovim/nvim-lspconfig", "nvim-lua/plenary.nvim", "mfussenegger/nvim-dap" },
opts = function()
local extension_path = vim.env.HOME .. "/.local/share/nvim/mason/packages/codelldb/extension/"
local codelldb_path = extension_path .. "adapter/codelldb"
local liblldb_path = extension_path .. "lldb/lib/liblldb.dylib"
return {
dap = { adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path) },
}
end,
},
}
@54corbin Thanks!
Tried your configuration with mason codelldb, seems codelldb is dependent on "bash-debug-adapter" and "bash-debug-adapter" failed while installing:
"bash-debug-adapter" was successfully installed.
...son-nvim-dap.nvim/lua/mason-nvim-dap/automatic_setup.lua:8: loop or previous error loading module 'mason-nvim-dap.mappings.configurations'
Press ENTER or type command to continue
I added the following to a new file called rust-tools.lua
in the plugins folder and it makes inlay hints work out of the box. I have rust-analyzer
already installed in my system.
return {
{
"simrat39/rust-tools.nvim",
opts = function(_, _)
require("rust-tools").setup({})
end,
},
}
And don't forget to install the dependency after you add it to the config. I did at first. 🙃
Thanks, tried everything. Only works if I remove rust-analyzer from mason and download a rust-analyzer to PATH.
I have pushed my vim config to https://github.com/tubzby/conf.nvim in case anyone else can do an in-depth digging.
For those using AstroNvim (which now uses lazy), there is a specific recipe that works: https://astronvim.com/Recipes/advanced_lsp#rust-rust-toolsnvim
Finally, it works out by adding these lines to mason_lspconfig setup_handlers:
mason_lspconfig.setup_handlers {
function(server_name)
require('lspconfig')[server_name].setup {
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
}
end,
["rust_analyzer"] = function()
require("rust-tools").setup {}
end
}
return { "simrat39/rust-tools.nvim", ft = "rust", opts = { ....
return { "simrat39/rust-tools.nvim", ft = "rust", opts = { ....
load rust-tools.nvim when you load a .rs file
I added a few lines in my init.lua . it doesn't work without any error messages:
But if I paste the all the lines in the configuration sections of Readme, it will display some error message: