ec5984762b
ci / build (ubuntu) (push) Has been cancelled
ci / unit + fmt (push) Has been cancelled
ci / examples (push) Has been cancelled
ci / goldens + tools (push) Has been cancelled
ci / apps (push) Has been cancelled
ci / selfhost smoke (push) Has been cancelled
ci / macos smoke (push) Has been cancelled
ci / windows smoke (push) Has been cancelled
ci / CI gate (push) Has been cancelled
selfhost-loop / bootstrap determinism (push) Has been cancelled
- Type `?`/`!` as Result/Option Ok payload (not always int); fix unwrap C types - LSP 0.18 document formatting (bux fmt) + VS Code format-on-save - Macro `:type` generics (Array_New<$t>) and operators-only tt paste - Ship runtime_freestanding.c + BUX_RUNTIME=freestanding + smokes/examples
90 lines
3.1 KiB
Markdown
90 lines
3.1 KiB
Markdown
# Bux Language Support for VS Code
|
|
|
|
Syntax highlighting, snippets, editor defaults, and **Language Server Protocol** integration for the [Bux](https://github.com/katehonz/bux) programming language.
|
|
|
|
## Features
|
|
|
|
| Area | What you get |
|
|
|------|----------------|
|
|
| **Syntax** | Keywords, types, `f"..."` interpolation, raw `` `...` `` strings, C-strings, macros (`macro!` / `name!()`), attributes (`@[Checked]`), numbers (hex/bin/oct + suffixes), lifetimes |
|
|
| **Snippets** | `main`, `func`, `struct`, `enum`, `match`, `interface`, `extend`, `macro`, `checked`, … |
|
|
| **LSP** | **Live error underlines** (red squiggles on edit), **Format Document** (same as `bux fmt`), completion, hover, go-to-definition, references, rename, document/workspace symbols, call hierarchy, type hierarchy, go-to-implementation |
|
|
| **Editor** | Bracket colorization, smart indent / on-enter, fold regions (`// region`), **format-on-save** default for `[bux]` |
|
|
| **Build** | `buxc` problem matcher for Tasks |
|
|
|
|
## Requirements
|
|
|
|
1. **VS Code** ≥ 1.85
|
|
2. **`bux-lsp`** binary (from this repo):
|
|
|
|
```bash
|
|
# from the Bux repository root
|
|
make lsp
|
|
# → tools/bux-lsp
|
|
```
|
|
|
|
The extension auto-discovers the server in this order:
|
|
|
|
1. Setting `bux.lsp.path` (absolute, relative, or command name)
|
|
2. `tools/bux-lsp` under any workspace folder (and parent folders for monorepos)
|
|
3. `bux-lsp` on your `PATH`
|
|
|
|
## Install (development)
|
|
|
|
```bash
|
|
cd vscode
|
|
npm install
|
|
npm run compile
|
|
|
|
# Launch Extension Development Host: F5 in VS Code,
|
|
# or install the folder as an extension:
|
|
code --install-extension .
|
|
# or package:
|
|
npx @vscode/vsce package
|
|
code --install-extension bux-lang-0.2.0.vsix
|
|
```
|
|
|
|
Symlink into your extensions dir (Linux):
|
|
|
|
```bash
|
|
ln -sfn "$(pwd)/vscode" ~/.vscode/extensions/bux-lang.bux-lang-0.2.0
|
|
```
|
|
|
|
## Commands
|
|
|
|
| Command | Description |
|
|
|---------|-------------|
|
|
| **Bux: Restart Language Server** | Stop and start `bux-lsp` |
|
|
| **Bux: Stop Language Server** | Disconnect the client |
|
|
| **Bux: Show Output Channel** | Open the Bux log |
|
|
|
|
Status bar item **Bux** (left): click to restart. Red = missing binary / start failure.
|
|
|
|
## Settings
|
|
|
|
| Setting | Default | Description |
|
|
|---------|---------|-------------|
|
|
| `bux.lsp.enabled` | `true` | Master switch for the language server |
|
|
| `bux.lsp.path` | `"bux-lsp"` | Path or command for the server binary |
|
|
| `bux-lsp.trace.server` | `off` | LSP wire trace (`off` / `messages` / `verbose`) |
|
|
|
|
## LSP capabilities (bux-lsp)
|
|
|
|
Provided by `tools/lsp_server.nim` (see `make lsp` / `make test-lsp`):
|
|
|
|
- `textDocument/completion`, `hover`, `definition`, `references`, `rename`
|
|
- `documentSymbol`, `workspace/symbol`
|
|
- Call hierarchy, type hierarchy, `implementation`
|
|
- Diagnostics on open/save (via analyzer / `buxc`)
|
|
|
|
## Troubleshooting
|
|
|
|
1. Status bar shows **error** → run `make lsp` and ensure `tools/bux-lsp` exists and is executable.
|
|
2. **Bux: Show Output Channel** for client logs.
|
|
3. Set `"bux-lsp.trace.server": "verbose"` for JSON-RPC traffic.
|
|
4. Confirm language mode is **Bux** for `.bux` files (status bar language indicator).
|
|
|
|
## License
|
|
|
|
MIT — same as the Bux project.
|