VS Code & Positron
The keel-vscode extension provides full Keel language support for Visual Studio Code and Positron.
Features
Syntax Highlighting
The extension provides two layers of syntax highlighting:
- TextMate grammar — Baseline highlighting for keywords, types, strings, numbers, operators, and comments
- Tree-sitter semantic tokens — Context-aware highlighting via
web-tree-sitterwith incremental parsing, providing accurate token boundaries for keywords, functions, variables, types, properties, parameters, comments, strings, numbers, operators, and constructors
Language Server Support
- Intelligent Code Completion — Context-aware suggestions for functions, types, variables, and module members
- Hover Documentation — Type signatures, documentation, and examples on hover
- Diagnostics — Real-time error detection
- Go to Definition — Navigate to symbol definitions with Ctrl+Click
- Find All References — Find all usages of a symbol (Shift+F12)
- Rename Symbol — Safely rename symbols across your codebase (F2)
- Document Symbols — Navigate code structure via Outline view (Ctrl+Shift+O)
- Workspace Symbols — Search for symbols across your project (Ctrl+T)
- Code Lens — Reference counts above function definitions
- Signature Help — Parameter hints while typing function calls
- Code Folding — Fold functions, case expressions, and blocks
Code Formatting
- Format Document — Format with
Shift+Alt+F - Format on Save — Automatically format files when saving (enabled by default)
Interactive Development
REPL Integration
Keel: Start REPL— Launch an interactive REPL in the terminalKeel: Send Selection to REPL— Execute selected code withCtrl+Enter- Persistent state across evaluations (configurable via
keel.repl.persistentProcess) - Auto-starts REPL when opening
.klfiles (in VS Code; Positron uses the Jupyter kernel instead)
Jupyter Notebook Support
- Create
.ipynbnotebooks and select the Keel kernel - Interactive cell execution with persistent state
- Rich output rendering (HTML tables for DataFrames, JSON for Records)
- Code completion and hover documentation in notebook cells
- Interrupt long-running computations
Requires the Jupyter kernel to be installed separately.
Script Execution
Keel: Run File— Execute the current Keel file and view output in the Keel output panel
Data Science Features
- DataFrame Viewer — Interactive HTML table rendering with sortable columns, row filtering, pagination, and column statistics (min/max/mean)
- Variable Tracking — Automatically tracks REPL variables and displays them in an expandable tree view with nested Records, Lists, and DataFrames
- Stdlib Auto-import —
List,String,Math,DateTime,IO,Http,Json,DataFrame,Result,Maybeavailable by default in notebooks - Type Inspection — View types and values with Shift+Tab
Installation
1. Install the Extension
From VSIX (Current Method)
- Download the latest
.vsixfile from the releases page - In VS Code/Positron: Extensions → "..." menu → Install from VSIX
- Select the downloaded
.vsixfile
From Marketplace (Coming Soon)
Search for "Keel" in the VS Code Extensions marketplace.
2. Install Keel Toolchain
The extension requires the Keel CLI for language server, formatting, and REPL features.
Recommended: Unified CLI
cargo install --git https://codeberg.org/Keel/keel-cli
This provides keel lsp, keel fmt, keel repl, and keel run in a single binary.
Optional: Jupyter Kernel
For notebook support, install the kernel separately:
cargo install --git https://codeberg.org/Keel/keel-jupyter-kernel
install-keel-kernel
Requires Python and Jupyter to be installed.
Alternative: Individual Tools
If you prefer to install tools separately:
cargo install --git https://codeberg.org/Keel/keel-lsp # Language server (required)
cargo install --git https://codeberg.org/Keel/keel-fmt # Formatter (optional)
cargo install --git https://codeberg.org/Keel/keel-repl # REPL (optional)
Configuration
Configure via VS Code settings (Preferences → Settings → search "keel"):
General
| Setting | Default | Description |
|---|---|---|
keel.cli.path | keel | Path to the keel CLI executable |
keel.lsp.path | keel | Path to keel executable (for language server) |
keel.formatter.path | keel | Path to keel executable (for formatter) |
keel.formatter.formatOnSave | true | Automatically format on save |
keel.repl.path | keel | Path to keel executable (for REPL) |
keel.trace.server | off | LSP trace level: off, messages, verbose |
REPL
| Setting | Default | Description |
|---|---|---|
keel.repl.persistentProcess | true | Use persistent REPL process to maintain state |
keel.repl.captureTimeout | 30000 | Timeout for REPL execution in milliseconds |
keel.repl.outputSettleTime | 300 | Time in ms to wait for output to settle |
keel.repl.trackVariables | true | Track and display REPL variables |
keel.repl.variablesRefreshMode | auto | When to refresh variables: auto or manual |
keel.repl.introspectionMode | auto | REPL introspection: auto, force, or disable |
Data Viewer
| Setting | Default | Description |
|---|---|---|
keel.dataViewer.maxRows | 10000 | Maximum rows to load in DataFrame viewer |
keel.dataViewer.pageSize | 100 | Rows per page in DataFrame viewer |
keel.dataViewer.warningThreshold | 1000000 | Warn before loading DataFrames larger than this |
Variable View
| Setting | Default | Description |
|---|---|---|
keel.variableView.maxDepth | 5 | Maximum nesting depth for variable tree |
keel.variableView.maxChildren | 100 | Maximum children per tree node |
keel.variableView.lazyLoading | true | Load children on demand (when expanded) |
Positron
| Setting | Default | Description |
|---|---|---|
keel.repl.usePositronPreview | true | Display tabular results in Positron preview pane |
keel.repl.previewMaxRows | 1000 | Max rows in preview tables |
keel.repl.useWebview | true | Use webview for interactive previews |
keel.runtime.useKernel | true | Use Jupyter kernel for Positron runtime |
keel.runtime.kernelPath | "" | Custom Jupyter kernel path |
Custom Paths
If keel is not in your PATH:
{
"keel.cli.path": "/usr/local/bin/keel"
}
Or configure individual tool paths when using standalone tools:
{
"keel.lsp.path": "/usr/local/bin/keel-lsp",
"keel.formatter.path": "/usr/local/bin/keel-fmt",
"keel.repl.path": "/usr/local/bin/keel-repl"
}
Usage
Basic Editing
- Open a
.klfile - Start typing — completion, hover, and diagnostics work automatically
- Use Ctrl+Click to navigate to definitions
- View document structure in the Outline panel (Ctrl+Shift+O)
Interactive Development with REPL
- Open a
.klfile - Run command:
Keel: Start REPL - Select code and press
Ctrl+Enterto execute - Results appear immediately in the REPL terminal
Jupyter Notebooks
- Create or open a
.ipynbfile - Select "Keel" as the kernel
- Write Keel code in cells
- Run cells with
Shift+Enter - DataFrames render as interactive HTML tables
Keyboard Shortcuts
| Shortcut | Command | Description |
|---|---|---|
Ctrl+Enter (Cmd+Enter on Mac) | Send to REPL | Execute selection or current line |
Ctrl+Shift+O | Go to Symbol | Navigate document symbols |
Ctrl+T | Go to Symbol in Workspace | Search all symbols |
F2 | Rename Symbol | Rename across files |
F12 | Go to Definition | Jump to definition |
Shift+F12 | Find All References | Show all references |
Shift+Alt+F | Format Document | Format with keel-fmt |
Commands
| Command | Description |
|---|---|
Keel: Start REPL | Open a new REPL terminal |
Keel: Send Selection to REPL | Execute code in the REPL |
Keel: Run File | Execute the current file |
Keel: Show Variables | Display tracked REPL variables |
Keel: Refresh Variables | Refresh the variables view |
Keel: Clear Variables | Clear all tracked variables |
Keel: View DataFrame | Open a DataFrame in the data viewer |
Keel: Restart Language Server | Restart the LSP server |
Positron-Specific Features
This extension is fully compatible with Positron, Posit's next-generation data science IDE.
Runtime Integration
The extension registers as a Positron language runtime, providing native integration with Positron's data science features via the Jupyter kernel protocol.
Variable Pane Integration
Variables and their types are automatically tracked and displayed in Positron's variable pane via Jupyter kernel introspection. Falls back to heuristic tracking when the kernel is not available.
Data Explorer
DataFrames can be opened in Positron's built-in data explorer with:
- Column schemas and type information
- Column statistics (null count, min, max, mean, median, std dev)
- Sortable and filterable data views
- Pagination for large datasets
Enhanced Notebook Experience
Positron provides a richer notebook experience with:
- Side-by-side code and output
- Interactive plots
- Integrated variable inspector
- Console integration
Troubleshooting
"Failed to start Keel Language Server"
Cause: keel CLI is not found in your PATH.
Solution:
- Install
keel-cli:cargo install --git https://codeberg.org/Keel/keel-cli - Or configure the full path in settings:
keel.cli.path
Verify: Run keel lsp --help in your terminal.
"Formatter not found" or Format on Save Not Working
Cause: keel CLI is not installed or not in PATH.
Solution:
- Install
keel-cli, or - Configure the path:
keel.formatter.path, or - Disable format-on-save:
keel.formatter.formatOnSave: false
Verify: keel fmt --help
Jupyter Kernel Not Available
Cause: Keel kernel is not installed.
Solution:
cargo install --git https://codeberg.org/Keel/keel-jupyter-kernel
install-keel-kernel
jupyter kernelspec list # Verify installation
Completion/Hover Not Working
Causes:
- LSP server failed to start
- File is not saved (LSP only analyzes saved files)
- Syntax errors in the file
Solutions:
- Check the "Keel" output panel for errors
- Save the file (Ctrl+S)
- Fix syntax errors shown as red squiggles
- Restart the language server:
Keel: Restart Language Server
Debugging LSP Issues
Enable verbose logging:
{
"keel.trace.server": "verbose"
}
Check the "Keel" output panel (View → Output → select "Keel").