🐽 Bacon Language Server 🐽
NOTE: bacon-ls 0.5 has breaking changes and will work only with bacon 3.7+. The README for bacon-ls 0.4 can be found here.
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.
- Roadmap to 1.0 - ✅ done 🕖 in progress 🌍 future
- Installation
- Configuration
- Troubleshooting
- How does it work?
- Thanks
Roadmap to 1.0 - ✅ done 🕖 in progress 🌍 future
- ✅ Implement LSP server interface for
textDocument/diagnosticandworkspace/diagnostic - ✅ Manual Neovim configuration
- ✅ Manual LazyVim configuration
- 🕖 Automatic NeoVim configuration
- ✅ Add
bacon-lsto nvim-lspconfig - https://github.com/neovim/nvim-lspconfig/pull/3160 - ✅ Add
baconandbacon-lsto mason.nvim - https://github.com/mason-org/mason-registry/pull/5774 - ✅ Add
bacon-lsto LazyVim Rust extras - https://github.com/LazyVim/LazyVim/pull/3212
- ✅ Add
- ✅ Add compiler hints to Bacon export locations - https://github.com/Canop/bacon/pull/187 https://github.com/Canop/bacon/pull/188
- ✅ Support correct span in Bacon export locations - working from Bacon 3.7
- 🌍 VsCode extension and configuration
- 🌍 Emacs configuration

Installation
Mason.nvim
Both Bacon and Bacon-ls are installable via mason.nvim:
Manual
First, install Bacon and bacon-ls 🐽
Configuration
Configure Bacon export settings with bacon-ls 🐽 export format and proper span support in ~/.config/bacon/prefs.toml:
[]
= [ "cargo", "clippy", "--tests", "--all-targets", "--all-features", "--message-format", "json-diagnostic-rendered-ansi" ]
= "cargo_json"
= true
[]
= true
= "analyzer"
= "{diagnostic.level}:{span.file_name}:{span.line_start}:{span.line_end}:{span.column_start}:{span.column_end}:{diagnostic.message}"
= ".bacon-locations"
NOTE: bacon MUST be running to generate the export locations with the bacon-ls job: bacon -j bacon-ls.
The language server can be configured using the appropriate LSP protocol and supports the following values:
locationsFileBacon export filename (default:.bacon-locations).updateOnSaveTry to update diagnostics every time the file is saved (default: true).updateOnSaveWaitMillisHow many milliseconds to wait before updating diagnostics after a save (default: 1000).updateOnChangeTry to update diagnostics every time the file changes (default: false).
Neovim - LazyVim
vim.. = "bacon-ls"
Neovim - Manual
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..
For rust-analyzer, these 2 options must be turned off:
rust-analyzer.. = false
rust-analyzer.. = false
Vscode
The Vscode extension is not ready yet but should be part of Bacon-ls 0.6.0.
Troubleshooting
bacon-ls 🐽 can produce a log file in the folder where its running by exporting the RUST_LOG variable in the shell:
# or
How does it work?
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.
Thanks
bacon-ls 🐽 has been inspired by typos-lsp.