Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

codebook

> 编程语言
Open source

An unholy spell checker for code

858 stars0 likes1 views
WebsiteGitHub

About

An unholy spell checker for code

Please give a ⭐ if you find Codebook useful!

About

Codebook is a spell checker for code. It binds together the venerable Tree Sitter and the fast spell checker Spellbook. Included is a Language Server for use in (theoretically) any editor. Everything is done in Rust to keep response times snappy and memory usage low.

No configuration needed. Codebook will automatically detect the language you are editing and mark issues for you. Codebook will try to only mark issues for words that you create, where they are initially defined.

However, if you are looking for a traditional spell checker for prose, Codebook may not be what you are looking for. For example, capitalization issues are handled loosely and grammar checking is out of scope.

To see the motivations behind Codebook, read this blog post.

Goals

Spell checking is complicated, and opinions about how it should be done, especially for code, differ. This section is about the trade-offs that steer decisions.

Privacy

No remote calls for spell checking or analytics. Once dictionaries are cached, Codebook needs to be usable offline. Codebook will never send the contents of files to a remote server.

Don't be annoying

Codebook should have high signal and low noise. It should only highlight words that users have control over. For example, a misspelled word in an imported function should not be highlighted as the user can't do anything about it.

As a consequence, Codebook only marks issues for terms where they are defined, and not where they are used. Correcting both the definition (flagged by Codebook) and all subsequent uses should be done by other language specific tooling - usually available as a LSP for that language.

Efficient

All features will be weighed against their impact on CPU and memory. Codebook should be fast enough to spell check on every keystroke on even low-end hardware.

Features

Code-aware spell checking

Codebook will only check the parts of your code where a normal linter wouldn't. Comments, string literals and variable definitions for example. Codebook knows how to split camel case and snake case variables, and makes suggestions in the original case.

Language Server

Codebook comes with a language server. Originally developed for the Zed editor, this language server can be integrated into any editor that supports the language server protocol.

Dictionary Management

Codebook comes with a dictionary manager, which will automatically download and cache dictionaries.

Hierarchical Configuration

Codebook uses a hierarchical configuration system with global (user-level) and project-specific settings, giving you flexibility to set defaults and override them as needed per project.

Supported Languages

✅ Good to go: C, Go, Java, JavaScript, Lua, Markdown, Odin, Plain Text, Python, Ruby, Rust, TOML, TypeScript, Zig

⚠️ Supported, needs more testing (help us improve!): Astro, Bash, C#, C++, CSS, Dart, Elixir, Erlang, Haskell, HTML, Just, LaTeX, OCaml, PHP, Svelte, Swift, Typst, VHDL, Vue, YAML

If Codebook is not marking issues you think it should, please file a GitHub issue!

Installation

If you are a Zed user, you may skip this step and consult the Zed section of this document. Otherwise, you will need to install the codebook-lsp binary and make it available on your $PATH. You have a number of options to do this.

Manual download

  1. Download the latest release for your architecture from the releases page.
    • Prebuilt archives are published for macOS (x86_64, aarch64), Linux (x86_64, aarch64), and Windows (x86_64, arm64).
    • Windows artifacts are provided as .zip files; macOS and Linux artifacts are .tar.gz.
  2. Extract the binary from the archive, and move it somewhere on your system $PATH.
  • ~/.local/bin/codebook-lsp
  • /usr/bin/codebook-lsp
  • Etc...

eget

You can install the latest release using eget:

bash
eget blopker/codebook

Arch Linux

You can install the Codebook LSP using pacman:

bash
pacman -S codebook-lsp

Cargo

You can also install the Codebook LSP using Cargo:

bash
cargo install codebook-lsp

Homebrew

You can install the Codebook LSP using Homebrew:

bash
brew install codebook-lsp

To install directly from the GitHub repository:

bash
cargo install --git https://github.com/blopker/codebook codebook-lsp

From source

You may also build codebook from source by cloning the repository and running make build.

Integrations

Zed

Codebook is the most popular spell checker for Zed! To install, go to the Extension tab in Zed and look for "Codebook". Done!

Note: The version that Zed displays in the extension menus is for the Zed Extension, and not the LSP version (this repo). The extension will automatically update the LSP. If that updater is broken for some reason, try uninstalling the extension and reinstalling.

Remote development (SSH/WSL2): When Zed opens a remote project, the extension runs on the remote host and downloads the LSP there. Restricted or flaky network access on the remote (a common WSL2 issue) can break that download. The extension always prefers a codebook-lsp binary found on the $PATH, so installing it on the remote host (see Installation) sidesteps the downloader entirely.

If quickfix code actions are not showing up for specific languages, ensure your settings.json file includes the special "...", or "codebook", value in any language_servers values defined:

json
"languages": {
  "Python": {
    "language_servers": ["pyright", "ruff", "..."],
    // OR
    "language_servers": ["pyright", "ruff", "codebook"],
    "format_on_save": "on"
  }
},

Helix

Codebook can also be enabled for the Helix editor by adding the LSP to the languages.toml configuration file.

Ensure that codebook-lsp is installed into your $PATH (see Installation).

Then, add into the Helix languages.toml configuration file:

toml
[language-server.codebook]
command = "codebook-lsp"
args = ["serve"]

# Example use in markdown:
[[language]]
name = "markdown"
language-servers = ["codebook"]

This can be verified with:

bash
hx --health markdown

Suggestions will appear in files opened, and space-mode a key binding can be used to accept suggestions.

Neovim

nvim-lspconfig includes a configuration for Codebook.

Ensure that codebook-lsp is installed into your $PATH (see Installation).

Install nvim-lspconfig if you have not already. Then, add the following to your Neovim configuration:

bash
vim.lsp.enable('codebook')

VS Code

Not yet in the Marketplace. The extension is a work in progress. Install it locally from source if you want to try it. Feedback welcome!

A VS Code extension lives in editors/vscode. The extension manages the codebook-lsp binary for you, starts it with the right flags, and exposes a few configuration toggles (codebook.binaryPath, codebook.enablePrerelease, and codebook.logLevel).

To try it locally:

bash
cd editors/vscode
bun install       # or npm install
bun run build
bun run package   # or npm run package
code --install-extension codebook-vscode-*.vsix

Once the extension is installed it will activate automatically for every supported language.

Other Editors

Any editor that implements the Language Server Protocol should be compatible with Codebook. After installing Codebook, consult your editor's documentation to learn how to configure and enable a new language server. For your reference, the following command starts the server such that it listens on STDIN and emits on STDOUT:

bash
codebook-lsp serve

CLI (Lint)

Unstable. The CLI ships with codebook-lsp today, but its flags and output are experimental and subject to breaking changes. Feedback welcome!

Codebook can also be used as a standalone command-line spell checker, which is useful for CI pipelines, pre-commit hooks, or one-off checks.

bash
# Check specific files
codebook-lsp lint src/main.rs src/lib.rs

# Check all files in a directory (recursive)
codebook-lsp lint src/

# Show spelling suggestions
codebook-lsp lint --suggest src/

# Only report each misspelled word once across all files
codebook-lsp lint --unique src/

The exit code is 0 if all files are clean, 1 if any spelling errors are found, and 2 if there were unreadable files, invalid UTF-8, etc.

You can also add words to the dictionary from the command line, the same way the "Add to dictionary" editor action does:

bash
# Add words to the project config (codebook.toml), creating it if needed
codebook-lsp add combobulate frobnicate

# Add words to the global config instead
codebook-lsp add --global combobulate

Configuration

Codebook supports both global and project-specific configuration. Configuration files use the TOML format, with project settings overriding global ones.

Global Configuration

The global configuration applies to all projects by default. Location depends on your operating system:

  • Linux/macOS: $XDG_CONFIG_HOME/codebook/codebook.toml or ~/.config/codebook/codebook.toml
  • Windows: %APPDATA%\codebook\codebook.toml or %APPDATA%\Roaming\codebook\codebook.toml

You can override this location if you sync your config elsewhere by providing initializationOptions.globalConfigPath from your LSP client. When no override is provided, the OS-specific default above is used.

Project Configuration

Project-specific configuration is loaded from either codebook.toml or .codebook.toml in the project root. Codebook searches for this file starting from the current directory and moving up to parent directories.

You can override this location by providing initializationOptions.configPath from your LSP client (relative paths are resolved against the workspace root). When the override file does not yet exist, Codebook starts with defaults and creates the file at that path the first time a write happens (e.g., "Add to dictionary"). Auto-discovery is disabled when this override is set.

Note: Codebook picks which config to use on startup. If a config file is manually created or renamed (like switching between codebook.toml and .codebook.toml), restart your editor (or the LSP server) for the new file to be recognized.

Configuration Options

The block below shows all options at their default values. Comments show example values where defaults aren't illustrative.

…

Configuration Precedence

  1. Project configuration overrides global configuration
  2. If use_global = false in project config, global settings are ignored entirely
  3. If no project config exists, global config is used
  4. If neither exists, default settings are used
  5. Any matching [[overrides]] blocks are then layered on top (global first, then project). See Scoped Overrides.

Working with Configurations

  • Words added with "Add to dictionary" are stored in the project configuration
  • Words added with "Add to global dictionary" are stored in the global configuration file
  • Project settings are saved automatically when words are added
  • Configuration files are automatically reloaded when they change

User-Defined Regex Patterns

The ignore_patterns configuration allows you to define custom regex p

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rust

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言