Getting Started
This chapter covers environment setup and the shortest path from clone to a running language server.
Prerequisites
| Tool | Purpose |
|---|---|
| pixi | Manages Rust, Node (for the VS Code extension), and build tasks |
| Git | Clone and contribute |
You do not need a system-wide Rust install. Pixi provides the toolchain pinned in pixi.toml.
Clone and install
git clone https://github.com/amirhosseindavoody/spice-lsp.git
cd spice-lsp
pixi install
pixi install creates a reproducible environment with the Rust compiler, Node.js, and other dev tools.
Verify the environment
pixi run rustc --version
pixi run cargo --version
Both commands should succeed and report Rust ≥ 1.96.
Build and run
pixi run build
pixi run test
Format a netlist from the CLI:
pixi run format-spice -- test-data/valid/simple-rc.cir
pixi run format-spice -- --check test-data/valid/simple-rc.cir
Run the language server directly (it communicates over stdio — it will appear to hang; that is normal):
pixi run spice-lsp
# Equivalent; accepted because vscode-languageclient passes --stdio:
pixi run cargo run -p spice-lsp -- --stdio
Press Ctrl+C to stop. In an editor, use Format Document once the LSP is connected.
Open sample netlists
In VS Code: run SPICE LSP: Create Demo Folder from the Command Palette. It creates spice-lsp-demo/ in your opened workspace with HSPICE .sp / .lib files for same-file and cross-file go-to-definition (and sets the dialect to HSPICE).
By hand: create or copy a minimal netlist for manual testing:
* demo.cir — Ngspice-style
.title Simple RC
R1 in out 1k
C1 out 0 1u
V1 in 0 DC 1
.tran 1u 1m
.end
Save as demo.cir in the repo root or under test-data/.
Editor integration
VS Code (primary target)
From the Marketplace: install SPICE Language Support, open a .cir (or related) file, and edit.
From source (Extension Development Host):
- Build the LSP binary:
pixi run build - Open the extension folder:
editors/vscode - Install JS dependencies:
npm install - Press F5 to launch an Extension Development Host with the SPICE extension loaded
- Open
demo.cirand confirm diagnostics appear
Full extension setup: VS Code integration.
Other editors
Any editor with generic LSP client support can point at the spice-lsp binary:
| Editor | Configuration |
|---|---|
| Neovim | lspconfig custom server block with cmd = { "spice-lsp" } |
| Helix | [language-server.spice-lsp] in languages.toml |
| Zed | Extension or lsp settings (once published) |
File extensions to associate: .cir, .sp, .spf, .net, .ckt, .inc, .lib (dialect-dependent).
Recommended first contribution path
If you are new to the repo, follow this order:
- Read Principles — know what is in and out of scope
- Use Demo and testing — verify each layer before adding features
- Read Architecture — understand where new code belongs
- Skim Dialect reference and net semantics — hover corpus and connectivity plans
- Skim Include and library resolution — cross-file model/subckt resolution
Next steps
- Architecture — crate layout and data flow
- Build — pixi tasks and CI
- Demo and testing — smoke and integration checks