mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat(rust) add bacon-ls and improve debugging
This commit is contained in:
parent
a33eabddd9
commit
022ea2c709
1 changed files with 36 additions and 3 deletions
|
|
@ -1,3 +1,13 @@
|
|||
if lazyvim_docs then
|
||||
-- LSP Server to use for Rust.
|
||||
-- Set to "bacon-ls" to use bacon-ls instead of rust-analyzer.
|
||||
-- only for diagnostics. The rest of LSP support will still be
|
||||
-- provided by rust-analyzer.
|
||||
vim.g.lazyvim_rust_diagnostics = "rust-analyzer"
|
||||
end
|
||||
|
||||
local diagnostics = vim.g.lazyvim_rust_diagnostics or "rust-analyzer"
|
||||
|
||||
return {
|
||||
recommended = function()
|
||||
return LazyVim.extras.wants({
|
||||
|
|
@ -37,7 +47,13 @@ return {
|
|||
{
|
||||
"williamboman/mason.nvim",
|
||||
optional = true,
|
||||
opts = { ensure_installed = { "codelldb" } },
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, { "codelldb" })
|
||||
if diagnostics == "bacon-ls" then
|
||||
vim.list_extend(opts.ensure_installed, { "bacon", "bacon-ls" })
|
||||
end
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -64,8 +80,14 @@ return {
|
|||
enable = true,
|
||||
},
|
||||
},
|
||||
-- Add clippy lints for Rust.
|
||||
checkOnSave = true,
|
||||
-- Add clippy lints for Rust if using rust-analyzer
|
||||
checkOnSave = {
|
||||
enable = diagnostics == "rust-analyzer",
|
||||
},
|
||||
-- Enable diagnostics if using rust-analyzer
|
||||
diagnostics = {
|
||||
enable = diagnostics == "rust-analyzer",
|
||||
},
|
||||
procMacro = {
|
||||
enable = true,
|
||||
ignored = {
|
||||
|
|
@ -79,6 +101,14 @@ return {
|
|||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
-- Configure dap with codelldb
|
||||
local package_path = require("mason-registry").get_package("codelldb"):get_install_path()
|
||||
opts.dap = {
|
||||
adapter = require("rustaceanvim.config").get_codelldb_adapter(
|
||||
package_path .. "/codelldb",
|
||||
package_path .. "/extension/lldb/lib/liblldb.dylib"
|
||||
),
|
||||
}
|
||||
vim.g.rustaceanvim = vim.tbl_deep_extend("keep", vim.g.rustaceanvim or {}, opts or {})
|
||||
if vim.fn.executable("rust-analyzer") == 0 then
|
||||
LazyVim.error(
|
||||
|
|
@ -94,6 +124,9 @@ return {
|
|||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
bacon_ls = {
|
||||
enabled = diagnostics == "bacon-ls",
|
||||
},
|
||||
taplo = {
|
||||
keys = {
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue