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. Non-Clifford gates are drawn natively; see Tsim support for view-specific 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.

By default, hold Ctrl (or Cmd on macOS) while scrolling to zoom. Plain scrolling pans, except in single-layer slice views where it changes layers. Left-button dragging pans in either mode.
To zoom with plain scrolling instead, open VS Code Settings and set Stim: Svg Zoom Mode to scroll, or add this to your user or workspace settings:
"stim.svgZoomMode": "scroll"This applies immediately to open SVG viewers, including .dem matching graphs. In this mode, use the layer controls or keyboard to change slice layers. Set the value back to ctrlScroll to restore the default. Interactive 3D viewers are unaffected.
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.
All of these instructions render directly in 2D timeline and time-slice views, including controlled gates and Pauli-product rotations. Rotation angles are in half-turns (multiply by π for radians). Older circuits that encode Tsim gates in Stim tags are still supported.
Autocomplete, hover documentation, and signature help cover the complete gate table, including non-Clifford instructions and aliases such as R_PAULI and U.
Detector slices and matching graphs require Clifford circuits and report errors for native non-Clifford gates. Gates written in the older tagged form (for example S[T] or I[R_X(theta=0.25*pi)]) stay tagged in these views, so they render as their Clifford stand-ins. The 3D timeline also renders all of these gates, including rotation angles and controlled-gate connections. TPP, TPP_DAG, R_XX, R_YY, R_ZZ, and R_PAULI/RPP are visualization-only instructions; this extension does not expose a circuit simulator.
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++). The QuEra Stim fork is vendored as a submodule at third_party/Stim, pinned to the revision recorded by Git.
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 tests
npm run test:viewer # SVG viewer interaction and settings testsThe UI suite uses VS Code Extension Tester and Mocha to drive a real VS Code window with Selenium. It packages and installs the extension into an isolated test profile, then exercises .stim, .tsim, and .dem files, SVG controls, zoom/pan, and error recovery on save.
With Node.js 22+ and a graphical desktop, run:
npm ci
npm run test:uiOn headless Linux, use xvfb-run -a npm run test:ui. The first run downloads the VS Code and ChromeDriver versions selected in extester.config.json; later runs reuse those downloads. Your normal VS Code profile and extensions are not modified. Test files are copied into .ui-tests/workspace before editing.
The suite intentionally excludes CDN-dependent 3D views and OS clipboard integration. Failures produce screenshots, DOM snapshots, and VS Code/WebDriver logs under .ui-tests/; CI uploads these as the ui-test-diagnostics artifact. Runtime downloads and test artifacts are ignored by Git and excluded from the VSIX.
GitHub Actions tests and packages the extension, attaches the VSIX to a GitHub release, and publishes the same package to Open VSX and the VS Code Marketplace. Complete the one-time publisher setup first.
Update package.json and package-lock.json to the next numeric major.minor.patch version, commit and push the changes, then push the matching tag. For example, for version 0.1.1:
git tag v0.1.1
git push origin v0.1.1The workflow rejects tags that do not match the package version. Registry publishing runs in independent jobs; rerun failed jobs after resolving any authentication errors. Already published versions are skipped. A manual run on a branch only builds a VSIX unless the Marketplace setup check is selected; that check authenticates without publishing. VSIX files must not be committed.
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.