-
-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Support bacon lsp in pack-rust #1308
Labels
enhancement
New feature or request
Comments
This shouldnt be added to the rust pack. It can be its own pack if needed |
Tried to add this to a bacon pack, but didnt get it to work. |
vim.g.astronvim_rust_diagnostics = "bacon-ls"
local diagnostics = vim.g.astronvim_rust_diagnostics or "rust-analyzer"
return {
{
"AstroNvim/astrolsp",
---@type AstroLSPOpts
opts = function(_, opts)
-- add this
if diagnostics ~= "rust-analyzer" then require("astrocore").list_insert_unique(opts.servers, { "bacon_ls" }) end
return vim.tbl_deep_extend("force", opts, {
handlers = {
rust_analyzer = false,
},
---@diagnostic disable: missing-fields
config = {
bacon_ls = {
init_options = {
updateOnSave = true,
updateOnSaveWaitMillis = 1000,
updateOnChange = false,
},
},
rust_analyzer = {
settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
loadOutDirsFromCheck = true,
buildScripts = {
enable = true,
},
},
-- Add clippy lints for Rust if using rust-analyzer
checkOnSave = diagnostics == "rust-analyzer",
-- Enable diagnostics if using rust-analyzer
diagnostics = {
enable = diagnostics == "rust-analyzer",
},
procMacro = {
enable = true,
ignored = {
["async-trait"] = { "async_trait" },
["napi-derive"] = { "napi" },
["async-recursion"] = { "async_recursion" },
},
},
files = {
excludeDirs = {
".direnv",
".git",
".github",
".gitlab",
"bin",
"node_modules",
"target",
"venv",
".venv",
},
},
},
},
},
},
})
end,
},
{
"WhoIsSethDaniel/mason-tool-installer.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "codelldb" })
if diagnostics ~= "rust-analyzer" then
require("astrocore").list_insert_unique(opts.ensure_installed, { "bacon" })
end
end,
}
} |
and after open rust project, run in terminal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature related to a problem?
Refer to
Bacon
:https://github.com/crisidev/bacon-ls?tab=readme-ov-file#manual
Refer to
Lazyvim
:https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/extras/lang/rust.lua
Describe the new feature
Baconls is faster than rust-analyzer in analysis. I hope it can be supported.
Additional context
No response
The text was updated successfully, but these errors were encountered: