Editor Setup (VS Code)
The Shape Language extension for VS Code provides syntax highlighting and full LSP integration.
Install the Extension
Section titled “Install the Extension”Open VS Code and either:
- Search “Shape Language” in the Extensions panel (
Ctrl+Shift+X) - Or run from the command line:
code --install-extension shape-lang.shape-langLSP Setup
Section titled “LSP Setup”The extension needs shape-lsp on your PATH for full language support (completions, diagnostics, hover, go-to-definition, semantic tokens).
If shape-lsp is not installed, the extension will detect this on first activation and offer to install it automatically via cargo install shape-lsp. Click “Install via cargo” in the notification.
To install manually:
cargo install shape-lspWhat You Get
Section titled “What You Get”Without the LSP (extension only):
- Syntax highlighting (TextMate grammar)
- Bracket matching and auto-closing
- Code folding
- Comment toggling (
Ctrl+/) .shapefile association
With the LSP (extension + shape-lsp):
- Real-time diagnostics (errors and warnings) — both push (
publishDiagnostics) and pull (textDocument/diagnostic) - Completions with type information, including method-chain completions after
. - Hover documentation on identifiers, types, and methods
- Signature help on call sites (
(,,triggers) - Go-to-definition (
F12), declaration, type-definition, implementation - Find references (cross-file) + document highlights
- Rename symbol (cross-file) with prepare-rename
- Document symbols (outline view) + workspace symbols
- Call hierarchy (incoming/outgoing calls)
- Code actions (quickfixes; extract-fn; extract-var)
- Code lens (test runners + trait implementation counts)
- Semantic token highlighting (range + delta)
- Inlay hints (types, parameter names, chain types — see settings below)
- Folding ranges + document links
Inlay Hint Settings
Section titled “Inlay Hint Settings”All settings live under the shape.* namespace. Add them to settings.json
(workspace or user). The inlay-hint master is ON by default; Shape-unique
opt-in categories are OFF by default so the editor stays uncluttered:
| Setting | Default | Description |
|---|---|---|
shape.inlayHints.enable | true | Master toggle. False suppresses every category. |
shape.inlayHints.typeHints | true | Inferred type hints on let bindings. |
shape.inlayHints.parameterHints | true | Parameter-name hints at call sites. |
shape.inlayHints.variableTypeHints | true | Inferred variable types where elided. |
shape.inlayHints.returnTypeHints | true | Inferred return-type hints on fn declarations. |
shape.inlayHints.chainHints | true | Intermediate-type hints on method-chain expressions. |
shape.inlayHints.bindingStorageClass.enable | false (opt-in) | Shape-unique: surfaces the compiler’s BindingStorageClass (Direct / UniqueHeap / SharedCow / SharedAtomic / SharedAtomicMut) inline. Rendered with [… approx] because the authoritative classifier lives in the bytecode compiler. |
Example settings.json enabling the storage-class hint:
{ "shape.inlayHints.bindingStorageClass.enable": true}Verify Setup
Section titled “Verify Setup”- Open any
.shapefile - Check the status bar — you should see
Shape Language Serverrunning - Hover over a function or type to verify LSP hover works
- Introduce a deliberate syntax error and verify red squiggles appear
Troubleshooting
Section titled “Troubleshooting”No LSP features
Section titled “No LSP features”- Verify
shape-lspis on your PATH: runshape-lsp --versionin your terminal - Check the Output panel (
Ctrl+Shift+U) and select “Shape Language Server” for error messages - Restart the extension:
Ctrl+Shift+P→ “Developer: Reload Window”
Update shape-lsp
Section titled “Update shape-lsp”cargo install shape-lsp --forceThen reload VS Code.