Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,28 @@ Then, add the following to your Neovim configuration:
vim.lsp.enable('cookbook')
```

### VS Code (Unreleased)

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:

```sh
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.

**Note**: This extension is a work in progress and is not in the Marketplace yet. If you try it out, we'd love feedback!

### Other Editors

Any editor that implements the Language Server Protocol should be compatible with Codebook. To get started, follow the [installation instructions](#installation), then 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`:
Expand Down
2 changes: 2 additions & 0 deletions editors/vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
*.vsix
7 changes: 7 additions & 0 deletions editors/vscode/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.github/
.gitignore
.vscode/
.vscode-test/
src/
tsconfig.json
bun.lock
7 changes: 7 additions & 0 deletions editors/vscode/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2025 @blopker

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 changes: 29 additions & 0 deletions editors/vscode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Codebook VS Code Extension (Unreleased)

**Note** This extension is a work in progress and is not released on the VS Code marketplace yet. However, it is functional. Follow the Development instructions to install if you'd like to provide feedback!

This extension wires the Codebook language server into VS Code so code-specific
spell check diagnostics and quick fixes appear automatically.

## Features

- Automatically launches `codebook-lsp` for supported languages.
- Downloads, caches, and updates the Codebook language server without requiring any manual installation.
- Supports custom binary locations and optional pre-release builds via
`codebook.*` settings.

## Development

```
cd editors/vscode
bun install # or npm install / pnpm install
bun run build # or npm run build
bun run package # builds dist/ and emits a .vsix via vsce
```

The emitted JavaScript lives in `dist/` and can be loaded into VS Code via the
`Extension Tests / Run Extension` launch configuration or by using the bundled
`vsce` CLI via `bun run package`.

Set `codebook.logLevel` to `debug` to see verbose logs from the language server
inside the `Codebook` output channel.
729 changes: 729 additions & 0 deletions editors/vscode/bun.lock

Large diffs are not rendered by default.

106 changes: 106 additions & 0 deletions editors/vscode/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"name": "codebook-vscode",
"displayName": "Codebook Spell Checker",
"description": "A fast, code-aware spell checker.",
"version": "0.0.1",
"publisher": "blopker",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/blopker/codebook"
},
"bugs": {
"url": "https://github.com/blopker/codebook/issues"
},
"homepage": "https://github.com/blopker/codebook",
"engines": {
"vscode": "^1.80.0"
},
"categories": [
"Linters",
"Other"
],
"extensionKind": [
"workspace"
],
"activationEvents": [
"onLanguage:c",
"onLanguage:cpp",
"onLanguage:css",
"onLanguage:elixir",
"onLanguage:go",
"onLanguage:html",
"onLanguage:haskell",
"onLanguage:java",
"onLanguage:javascript",
"onLanguage:latex",
"onLanguage:lua",
"onLanguage:markdown",
"onLanguage:php",
"onLanguage:plaintext",
"onLanguage:python",
"onLanguage:ruby",
"onLanguage:rust",
"onLanguage:toml",
"onLanguage:typescript",
"onLanguage:typst",
"onLanguage:zig",
"onLanguage:csharp"
],
"main": "./dist/extension.js",
"scripts": {
"build": "tsc -p .",
"watch": "tsc -w -p .",
"package": "bun run build && vsce package --no-dependencies",
"publish": "bun run build && vsce publish --no-dependencies"
},
"contributes": {
"commands": [
{
"command": "codebook.restart",
"title": "Codebook: Restart Language Server"
}
],
"configuration": {
"title": "Codebook",
"properties": {
"codebook.binaryPath": {
"type": "string",
"default": "",
"description": "Absolute path to an existing codebook-lsp binary. Leave empty to allow the extension to manage the download."
},
"codebook.enablePrerelease": {
"type": "boolean",
"default": false,
"description": "Allow downloading pre-release builds when managing the language server binary."
},
"codebook.logLevel": {
"type": "string",
"enum": [
"error",
"warn",
"info",
"debug"
],
"default": "info",
"description": "Value assigned to the RUST_LOG environment variable for the language server."
}
}
}
},
"dependencies": {
"@types/adm-zip": "^0.5.7",
"@types/tar": "^6.1.13",
"@types/which": "^3.0.4",
"adm-zip": "^0.5.12",
"tar": "^6.2.1",
"vscode-languageclient": "^9.0.1",
"which": "^4.0.0"
},
"devDependencies": {
"@types/node": "^20.12.7",
"@types/vscode": "^1.80.0",
"@vscode/vsce": "^3.7.0",
"typescript": "^5.4.0"
}
}
Loading