mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat(rust): allow user to extend rust-tools with opts
Also avoids calling rust-tools's `setup()` twice.
This commit is contained in:
parent
23b55f1bba
commit
1884f6e0e8
1 changed files with 8 additions and 3 deletions
|
|
@ -42,7 +42,11 @@ return {
|
||||||
-- Correctly setup lspconfig for Rust 🚀
|
-- Correctly setup lspconfig for Rust 🚀
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
dependencies = { "simrat39/rust-tools.nvim" },
|
dependencies = {
|
||||||
|
"simrat39/rust-tools.nvim",
|
||||||
|
-- Avoid calling setup twice if user supplies `opts`
|
||||||
|
config = function() end,
|
||||||
|
},
|
||||||
opts = {
|
opts = {
|
||||||
servers = {
|
servers = {
|
||||||
-- Ensure mason installs the server
|
-- Ensure mason installs the server
|
||||||
|
|
@ -66,7 +70,8 @@ return {
|
||||||
local codelldb_path = extension_path .. "adapter/codelldb"
|
local codelldb_path = extension_path .. "adapter/codelldb"
|
||||||
local liblldb_path = vim.fn.has("mac") == 1 and extension_path .. "lldb/lib/liblldb.dylib"
|
local liblldb_path = vim.fn.has("mac") == 1 and extension_path .. "lldb/lib/liblldb.dylib"
|
||||||
or extension_path .. "lldb/lib/liblldb.so"
|
or extension_path .. "lldb/lib/liblldb.so"
|
||||||
local rust_tools_opts = {
|
local user_rust_tools_opts = require("lazyvim.util").opts("rust-tools.nvim")
|
||||||
|
local rust_tools_opts = vim.tbl_deep_extend("force", user_rust_tools_opts, {
|
||||||
dap = {
|
dap = {
|
||||||
adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path),
|
adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path),
|
||||||
},
|
},
|
||||||
|
|
@ -106,7 +111,7 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
}
|
})
|
||||||
require("rust-tools").setup(rust_tools_opts)
|
require("rust-tools").setup(rust_tools_opts)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue