Syntax highlighting and interactive circuit visualization for Stim and Tsim circuits in .stim and .tsim files, plus .dem detector error models.
Diagrams are produced by Stim's C++ core compiled to WebAssembly and run entirely inside the editor with no Python or native dependencies. Tsim circuits use the extension's existing non-Clifford gate translation; see Tsim support for its visualization limits.
- Syntax highlighting for
.stim,.tsim, and.demfiles, including Tsim's non-Clifford instructions. - Autocomplete, hover documentation, and signature help for Stim gate and annotation names in both
.stimand.tsimfiles. - Circuit visualizer opened from the editor title bar or the
Stim: Visualize Circuitcommand. - Diagram types:
timeline-svg,timeline-3d,timeslice-svg,detslice-svg,detslice-with-ops-svg,matchgraph-svg,matchgraph-3d.
Install Stim by QuEra Computing Inc. from the VS Code Marketplace, or run:
code --install-extension QuEraComputing.vscode-stimFor manual installation, download the VSIX from GitHub Releases and use Extensions: Install from VSIX in VS Code or Cursor.
Open a .stim, .tsim, or .dem file. In the editor title bar, click the 📊-button if visible, or in the ...-menu, select Stim: Visualize Circuit.

Toggle between different visualization types in the visualization panel.

The .stim and .tsim extensions share the same language mode, syntax highlighting, editor features, and circuit visualizer. No file association setting or Python installation is needed.
The grammar highlights all additional instructions currently documented by Tsim: T, T_DAG, TPP, TPP_DAG, R_X, R_Y, R_Z, R_XX, R_YY, R_ZZ, R_PAULI, U3, CCZ, and CCX. Signed decimal and scientific-notation arguments, Pauli-product targets, and instruction tags are highlighted too.
Visualization is not full non-Clifford simulation. The 2D operation views relabel T-family and single-qubit rotation gates; CCZ and CCX are expanded into Clifford+T decompositions. Pauli rotations (R_XX, R_YY, R_ZZ, and R_PAULI) currently appear as tagged SPP operations. Other views, including detector slices and matching graphs, use Clifford stand-ins (for example, T becomes S and single-qubit rotations become identity), so they do not represent the exact non-Clifford circuit. Autocomplete, hover documentation, and signature help currently cover Stim's gate table, not the additional Tsim instructions.
npm install
npm run buildThen press F5 in VS Code to launch an Extension Development Host with the extension loaded, and open a .stim or .tsim file.
The compiled engine (wasm/out/stim_diagram.{js,wasm}) is checked in with LFS, so building it is only needed when changing the binding or updating Stim.
Requirements: the Emscripten SDK on your PATH (em++). Stim's source is vendored as a submodule pinned to v1.16.0.
git submodule update --init
source /path/to/emsdk/emsdk_env.sh
npm run build:wasmThe build compiles Stim plus a small Embind shim (wasm/binding.cpp) that exposes the diagram functions. The extension host loads the module, generates the SVG or 3D HTML, and posts it to the webview, which only renders.
npm run watch # rebuild the extension on change
npm run test:grammar # TextMate grammar tests
npm run test:wasm # WebAssembly engine smoke tests
npm run test:engine # engine wrapper testsVSIX files are built by GitHub Actions and must not be committed. To publish a release, push a version tag:
git tag v0.1.0
git push origin v0.1.0The release workflow packages the extension and attaches the generated VSIX to the GitHub release.
To publish to the VS Code Marketplace, upload that VSIX through the QuEra Computing publisher portal. GitHub releases do not automatically publish to the Marketplace. The package version must match the tag and use a numeric major.minor.patch version.
The interactive 3D viewer loads three.js from a CDN at runtime, so it needs network access. The 2D SVG views work fully offline.
The extension's own code is MIT-licensed; see LICENSE. The bundled Stim engine is licensed under Apache License 2.0; see LICENSE-Stim.txt. Third-party components retain their respective licenses. See NOTICE and the included LICENSE-*.txt files for attribution and license terms.