Crates.io | bacon-ls |
lib.rs | bacon-ls |
version | 0.3.0 |
source | src |
created_at | 2024-05-17 22:49:59.955751 |
updated_at | 2024-05-21 11:19:56.516425 |
description | Bacon Language Server |
homepage | https://github.com/crisidev/bacon-ls |
repository | https://github.com/crisidev/bacon-ls |
max_upload_size | |
id | 1243779 |
size | 3,464,434 |
LSP Server wrapper for the exceptional Bacon exposing textDocument/diagnostic and workspace/diagnostic capabilities.
See bacon-ls
🐽 blog post: https://lmno.lol/crisidev/bacon-language-server
bacon-ls
🐽 is meant to be easy to include in your IDE configuration.
bacon-ls
🐽 does not start bacon
for you, it requires it running in another terminaltextDocument/diagnostic
and workspace/diagnostic
bacon-ls
to nvim-lspconfig - https://github.com/neovim/nvim-lspconfig/pull/3160bacon
and bacon-ls
to mason.nvim - https://github.com/mason-org/mason-registry/pull/5774bacon-ls
to LazyVim Rust extras - https://github.com/LazyVim/LazyVim/pull/3212First, install Bacon and bacon-ls
🐽
❯❯❯ cargo install --locked bacon bacon-ls
Configure Bacon export-locations settings with bacon-ls
🐽 export format:
[export]
enabled = true
path = ".bacon-locations"
line_format = "{kind}:{path}:{line}:{column}:{message}"
The language server can be configured using the appropriate LSP protocol and supports the following values:
locationsFile
Bacon export filename, default .bacon-locations
.waitTimeSeconds
Maximum time in seconds the LSP server waits for Bacon to
update the export file before loading the new diagnostics, default 10
.return {
{
"neovim/nvim-lspconfig",
opts = {
diagnostics = {
update_in_insert = true,
},
servers = {
rust_analyzer = { enable = false },
bacon_ls = {
enable = true
settings = {
-- locationsFile = ".locations",
-- waitTimeSeconds = 5
},
},
},
},
},
{
"mrcjkb/rustaceanvim",
opts = {
default_settings = {
["rust-analyzer"] = {
diagnostics = { enable = false },
checkOnSave = { enable = false },
},
},
},
},
}
NeoVim requires nvim-lspconfig to be configured and rust-analyzer diagnostics must be turned off for Bacon-Ls 🐽 to properly function.
bacon-ls
is part of nvim-lspconfig
from commit
6d2ae9f
and it can be configured like any other LSP server works best when
vim.diagnostics.Opts.update_in_insert
is set to true
.
require("lspconfig.configs").bacon_ls.setup({
autostart=true,
settings = {
-- locationsFile = ".locations",
-- waitTimeSeconds = 5
},
})
For rust-analyzer
, these 2 options must be turned off:
rust-analyzer.checkOnSave.enable = false
rust-analyzer.diagnostics.enable = false
bacon-ls
🐽 reads the diagnostics location list generated
by Bacon's export-locations
and exposes them on STDIO over the LSP protocol to be consumed
by the client diagnostics.
It requires Bacon to be running alongside to ensure regular updates of the export locations.
The LSP client reads them as response to textDocument/diagnostic
and workspace/diagnostic
.
bacon-ls
🐽 has been inspired by typos-lsp.