Runtime Manual/Developer Tooling/REPL, CDP Debugging & Language Server (REPL, Debug & LSP)
REPL, CDP Debugging & Language Server (REPL, Debug & LSP)
Upgraded Rustyline REPL, Chrome DevTools Protocol remote debugging, and LSP 3.17 server
High developer velocity requires rich interactive exploration, visual breakpoint debugging, and intelligent IDE completion. Amber delivers three integrated systems:
- Interactive REPL (
amber repl): Powered by Rustyline with smart multiline detection and persistent command history; - CDP Debugger (
amber debug/--inspect): Standard Chrome DevTools Protocol compatible endpoint; - Language Server (
amber lsp): LSP 3.17 compliant server providing real-time diagnostics, formatting, and hover docs.
1. Modern Interactive REPL (amber repl)
Launch the REPL from the command line:
code
$ amber repl
1.1 Features
- Smart Multiline Block Detection: Automatically shifts to a continuation prompt (
...) when detecting open braces{, unclosed parentheses(, brackets[, or template strings`; - Persistent History: Automatically saves command history across sessions to
~/.amber_historywith up/down arrow recall; - Full Line Editing: Emacs-style keybindings, cursor movement, word skipping, and deletion;
- Built-in Directives:
.help: View help information;.clear: Clear the console and reset context;.exit: Exit the session cleanly (or pressCtrl+D).
2. Chrome DevTools Protocol Debugging (amber debug)
Amber implements the standard Chrome DevTools Protocol (CDP). You can attach Chrome DevTools or VS Code to set breakpoints, step through code, and inspect scopes.
2.1 Starting a Debugging Session
code
# Start and pause on the first statement awaiting debugger
$ amber debug app.ts
# Or with flag
$ amber run --inspect-brk app.ts
Console output:
code
Debugger listening on ws://127.0.0.1:9229/ws
Visit chrome://inspect in Google Chrome to connect.
Waiting for debugger connection before executing code...
2.2 Connecting in Chrome
- Open
chrome://inspectin Google Chrome or Chromium; - Under Remote Target, locate your running Amber target;
- Click inspect to launch dedicated DevTools;
- Set breakpoints, step over (
F10), step into (F11), and inspect call stacks and variables.
3. Language Server Protocol (amber lsp)
Amber includes a Language Server Protocol (LSP 3.17) daemon for editors such as VS Code, Neovim, Helix, and Sublime Text.
3.1 Running the Server
code
$ amber lsp
3.2 Implemented Capabilities
textDocument/publishDiagnostics: Pushes AST diagnostics and syntax errors in real-time as you type;textDocument/formatting: Callsamber fmtfor zero-config document formatting;textDocument/hover: Provides rich Markdown tooltips and type signatures foramber:ai,Tensor,LLM, andAgentPipeline.