Language support for Eclexia - the Economics-as-Code programming language with shadow pricing and resource awareness.
-
Keywords:
fn,let,if,match,resource,adaptive,shadow -
Annotations:
@requires,@provides,@builtin,@test,@bench -
Dimensional literals:
10J,5kWh,100gCO2,2.5kg·m²/s² -
Comments: Line (
//) and block (/* */)
-
Diagnostics: Real-time syntax and type errors
-
Hover: Symbol information with types and documentation
-
Go to Definition: Jump to symbol definitions
-
Find References: Find all usages of a symbol
-
Completion: Context-aware code completion with keywords
-
Document Symbols: Outline view of functions, types, and constants
-
Rename: Rename symbols across files
-
Formatting: Auto-format Eclexia code
-
Eclexia compiler: Install from eclexia repository
-
The
eclexiabinary must be in your PATH
-
Download the latest
.vsixfile from releases -
In VSCode, press
Ctrl+Shift+Pand run “Extensions: Install from VSIX…” -
Select the downloaded
.vsixfile
Configure the extension in VSCode settings (Ctrl,+):
{
"eclexia.lsp.path": "eclexia",
"eclexia.lsp.trace": "off"
}-
Eclexia: Restart Server (
Ctrl+Shift+P→ “Eclexia: Restart Server”)-
Restart the LSP server (useful after updating Eclexia)
-
Create a file example.ecl:
/// Calculate optimal algorithm based on carbon intensity.
adaptive fn optimize_sort(data: [Int]) -> [Int] {
@requires(10kWh, 5s)
@provides(sorted_data: [Int])
fast: {
// Use quicksort when carbon intensity is low
quicksort(data)
}
slow: {
// Use heapsort when carbon intensity is high (more energy-efficient)
heapsort(data)
}
}
resource energy {
dimension: Energy,
budget: 100kWh,
shadow: compute_carbon_price(),
}The extension will provide: - ✅ Syntax highlighting for adaptive,
resource, @requires, @provides - ✅ Dimensional literal
highlighting (10kWh, 5s, 100kWh) - ✅ Hover information on
optimize_sort - ✅ Completion for keywords and symbols - ✅
Real-time diagnostics for errors
-
Check PATH: Verify
eclexiais in your PATH:which eclexia # Linux/Mac where eclexia # Windows
-
Check Version: Ensure you have a recent version:
eclexia --version
-
View Logs: Enable tracing in settings:
{ "eclexia.lsp.trace": "verbose" }Then check the “Eclexia Language Server” output panel.
-
Restart Server: Run “Eclexia: Restart Server” command