Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Getting Started

This chapter covers environment setup and the shortest path from clone to a running language server.

Prerequisites

ToolPurpose
pixiManages Rust, Node (for the VS Code extension), and build tasks
GitClone 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):

  1. Build the LSP binary: pixi run build
  2. Open the extension folder: editors/vscode
  3. Install JS dependencies: npm install
  4. Press F5 to launch an Extension Development Host with the SPICE extension loaded
  5. Open demo.cir and 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:

EditorConfiguration
Neovimlspconfig custom server block with cmd = { "spice-lsp" }
Helix[language-server.spice-lsp] in languages.toml
ZedExtension or lsp settings (once published)

File extensions to associate: .cir, .sp, .spf, .net, .ckt, .inc, .lib (dialect-dependent).

If you are new to the repo, follow this order:

  1. Read Principles — know what is in and out of scope
  2. Use Demo and testing — verify each layer before adding features
  3. Read Architecture — understand where new code belongs
  4. Skim Dialect reference and net semantics — hover corpus and connectivity plans
  5. Skim Include and library resolution — cross-file model/subckt resolution

Next steps