Also available for Neovim: lila.nvim
Live C++ Coding in VS Code
LilaCode is a VS Code extension for real-time, interactive live coding of C++ directly in your editor. It connects to the Lila REPL server, an incremental Clang/LLVM JIT compiler, and evaluates code with near-zero latency (~1ms, designed for 1 buffer/frame cycle).
Lila is MayaFlux's embedded live coding engine: an LLVM 21+ backed C++ JIT interpreter that compiles and executes arbitrary C++ code at runtime with sub-buffer latency. LilaCode brings this into VS Code, closing the gap between writing code and running it.
- Instant feedback : execute code in milliseconds without recompiling
- Exploratory development : iterate on algorithms, DSP, and graphics pipelines interactively
- Deterministic latency : 1 buffer/frame cycle, designed for real-time systems
- Full C++ capability : execute any valid C++20 code, access all linked libraries
- Persistent state : modifications layer onto previous evaluations; your session accumulates
Live coding is a fundamentally different way to work, closer to the exploratory, feedback-driven workflows of Lisp and SuperCollider, but with C++'s performance and MayaFlux's real-time guarantees.
- Evaluate Line : execute a single line (
Ctrl+Alt+E) - Evaluate Selection : run highlighted code (
Ctrl+Alt+S) - Evaluate Buffer : execute the entire file (
Ctrl+Alt+B) - Evaluate Node : run semantic code blocks, experimental (
Ctrl+Alt+N) - Eval Highlight : sent code flashes in the editor so you always know what was dispatched
- MayaFluxHost : connect directly to a host process without
lila_server - MayaFlux Docs :
Ctrl+Alt+Dopens the Doxygen page for the symbol under cursor - Live Output : see compilation results, errors, and output in the integrated console
- Real-Time Status : monitor connection state at a glance
- Session Persistence : state accumulates across evaluations
Search for "LilaCode" in the VS Code Extensions marketplace and install, or download the .vsix from Releases and install via Ctrl+Shift+P > "Extensions: Install from VSIX...".
Lila ships as part of MayaFlux. The easiest way to install MayaFlux and get a project set up for live coding is Weave, the MayaFlux installer and project creator.
Install MayaFlux:
Download and launch Weave from Releases and choose Install MayaFlux. Weave handles the full installation including dependencies and environment setup.
Create a project with live coding:
Once MayaFlux is installed, open Weave again and choose Create Project. Check Enable Live Coding (Lila) before creating. This configures your project's CMake to link MayaFlux::MayaFluxHost, which is what enables the Lila JIT in your process.
After building your project, lila_server will be available and LilaCode can connect to it.
1. Open a C++ file
int x = 10;
int y = 20;2. Send code to Lila
Evaluate line by line with Ctrl+Alt+E, or select multiple lines and press Ctrl+Alt+S.
3. See results
The "Lila" output panel shows successful evaluations, compilation errors with Clang diagnostics, and any printed output.
State persists across evaluations within a session:
int counter = 0; // Evaluate oncecounter++;
std::cout << counter << std::endl; // Prints: 1This lets you build up complex systems incrementally.
Projects created with live coding enabled link MayaFlux::MayaFluxHost, which embeds the Lila JIT directly in your running process. You can connect LilaCode to that process instead of using a separate lila_server binary.
Run Lila: Connect to MayaFluxHost from the command palette and enter host:port. This is the typical workflow for MayaFlux projects, letting you evaluate code against your live audio/visual state:
#include "MayaFlux/MayaFlux.hpp"
auto sine = vega.Sine(200) | Audio[{0, 1}] ;
sine->set_frequency(300); // Change pitch while the process is running| Command | Shortcut | Description |
|---|---|---|
lila.startServer |
Start the Lila REPL server | |
lila.stopServer |
Stop the server and disconnect | |
lila.restartServer |
Restart the server | |
lila.connect |
Manually connect to a running server | |
lila.connectHost |
Connect directly to a MayaFluxHost at host:port | |
lila.disconnect |
Disconnect from the server | |
lila.evalLine |
Ctrl+Alt+E |
Evaluate the current line |
lila.evalSelection |
Ctrl+Alt+S |
Evaluate selected code |
lila.evalBuffer |
Ctrl+Alt+B |
Evaluate the entire file |
lila.evalNode |
Ctrl+Alt+N |
Evaluate a semantic code block (experimental) |
lila.showOutput |
Show the Lila output panel | |
lila.clearOutput |
Clear the output console | |
lila.showStatus |
Display connection and server status | |
lila.openDocs |
Ctrl+Alt+D |
Open MayaFlux docs for symbol under cursor |
Access all commands via Ctrl+Shift+P and type "Lila".
{
"lila.host": "127.0.0.1",
"lila.port": 9090,
"lila.serverPath": "lila_server",
"lila.autoStartServer": true,
"lila.autoConnect": true
}If lila_server is not in your PATH, set the full path in lila.serverPath.
lila_server -p 9090 -v -l DEBUG-p, --port <port>-- server port (default: 9090)-v, --verbose-- enable verbose logging-l, --level <level>-- log level: TRACE, DEBUG, INFO, WARN, ERROR, FATAL-h, --help-- show help
On activation, LilaCode fetches the MayaFlux symbol index from the documentation site. Place your cursor on any MayaFlux symbol and press Ctrl+Alt+D to open its Doxygen page in your browser. Works in standalone .cpp files without a full project setup.
- Extension Activation : loads on command or when opening
.cppfiles - Server Launch (optional) : start
lila_serverviaLila: Start Server, or skip if using MayaFluxHost - Client Connection : establishes a TCP connection (default:
127.0.0.1:9090) - Code Submission : sends C++ code over TCP
- JIT Compilation : server uses Clang's incremental compiler
- Execution : compiled code runs in-process with access to all linked libraries
- Result Return : output, errors, and results stream back to VS Code
- Disconnected (○) : not connected
- Connecting (○) : attempting connection
- Connected (✓) : ready to evaluate
- Error (✗) : connection failed
Each Lila session maintains a symbol table, compiled code history, and execution context. State from one evaluation is available to the next, enabling incremental development.
- Compilation latency : ~1ms per evaluation (LLVM JIT cached)
- Execution latency : typically under 1ms for simple operations
- Buffer cycle : designed for 1 buffer/frame timing (~21-42ms at typical buffer sizes)
- Memory : incremental compilation minimizes allocations; restart server to reset state
Check that lila_server is in your PATH:
which lila_serverIf not found, set lila.serverPath in VS Code settings, or run manually to check for errors:
lila_server -v -l DEBUG- Run
Lila: Show Status - Verify
lila.hostis127.0.0.1 - Try a different port if 9090 is in use
- Run
Lila: Restart Server - Check View > Output > Lila
- Check the Lila output console for error messages
- Verify C++ syntax (Clang reports diagnostics directly)
- Ensure required headers are available
- Try a minimal test:
int x = 42; - Restart the server and reconnect
Common causes:
- Missing includes : add
#includedirectives or check PCH setup in server logs - Undefined symbols : symbols from prior evals should persist; restart server if not
- Type errors : verify C++20 syntax and template instantiations
- Linker errors : ensure libraries are linked to the Lila server binary
- Local connections only (
127.0.0.1) - No persistent sessions between editor restarts (state resets when server stops)
- No debugger integration yet (planned)
- No symbol introspection UI yet (planned)
- Large evaluations may have noticeable compile time
- Output console does not render ANSI color from server responses
- Breakpoint debugging
- Symbol introspection with hover
- REPL history browser
- Multi-file sessions
- Performance profiling output
- Remote and collaborative sessions
Issues, feature requests, and contributions welcome on GitHub.
GNU General Public License v3.0. See LICENSE for full terms.
LilaCode: Live C++ coding without barriers. Execute, iterate, explore.
For more on the MayaFlux philosophy and vision, see the main project README.