English | 简体中文
Compile TSQX geometry files to high-quality PDF diagrams via Asymptote, with live preview, syntax highlighting, and auto-compile — all inside VS Code.
- Live Preview — Click the preview icon in the editor title bar to compile and view the PDF side-by-side.
- Auto-Compile on Save — Enabled by default. Every time you save a
.tsqxfile, the PDF is recompiled and refreshed automatically. - Syntax Highlighting — Full TextMate grammar for
.tsqxfiles: comments, point definitions, draw commands, built-in functions, Asymptote color names, and operators. - TXT File Support — Right-click any
.txtfile and choose Set Current File as TSQX to get full TSQX support. - Inline Diagnostics — Compilation errors and warnings appear directly in the editor's Problems panel.
- Status Bar — Shows compilation status and auto-compile toggle (click to switch on/off).
- Configurable Paths — Point the extension at custom
tsqxandasyexecutables if they aren't on$PATH.
- Open a
.tsqxfile - Click the preview icon (⧉) in the editor toolbar
- The compiled PDF opens in a side panel — edit, save, and it refreshes automatically
| Tool | Install |
|---|---|
| tsqx | pip install tsqx or pip install -e . from this repo |
| Asymptote | brew install asymptote (macOS) / apt install asymptote (Linux) / Windows installer |
| VS Code | ≥ 1.109.0 |
| Command | Shortcut | Description |
|---|---|---|
| TSQX: Preview TSQX Figure | Cmd+Shift+Alt+V / Ctrl+Shift+Alt+V |
Compile and open PDF preview |
| TSQX: Compile TSQX File | Cmd+Shift+B / Ctrl+Shift+B |
Compile to ASY and PDF |
| TSQX: Open Generated ASY | — | Open the generated .asy file beside the editor |
| TSQX: Diagnose Toolchain | — | Check tsqx / asy commands, versions, and current extension settings |
| TSQX: Toggle Auto Compile on Save | — | Enable / disable auto-compile |
| TSQX: Set Current File as TSQX | — | Mark a .txt file as TSQX |
npm ci
npm run compile
npm run lint
npm testFor a real local smoke test against the installed tsqx and asy toolchain:
npm run smoke:compile -- /path/to/file.tsqxExample:
npm run smoke:compile -- /Users/leyudame/Documents/tsqx/examples/figures/fig1.tsqxRelease workflow details are documented in docs/RELEASE.md.
tsqx -p < input.tsqx > output.asy— generates Asymptote sourceasy output.asy— compiles to PDF- The PDF is opened (or refreshed) in VS Code's built-in viewer
The extension adds a TSQX panel to the Activity Bar (left sidebar) with quick-access buttons:
- Compile Current File — run the tsqx → asy → pdf pipeline
- Preview PDF — open the PDF in a side panel
- Toggle Auto-Compile — switch auto-compile on save on/off
- Set File as TSQX — mark a
.txtfile for TSQX support
git clone https://github.com/yzdame/tsqx-compiler.git
cd tsqx-compiler
npm install
npm run compile # build once
npm run watch # rebuild on change
# Press F5 in VS Code to launch the Extension Development Hostnpx vsce package
# Produces tsqx-compiler-x.x.x.vsix
{ "tsqx.autoCompileOnSave": true, // auto-compile on save (default: true) "tsqx.autoCompileDelay": 1000, // delay in ms before auto-compile after save "tsqx.compilationTimeout": 30, // max seconds per compilation "tsqx.tsqxPath": "tsqx", // path to tsqx executable "tsqx.asyPath": "asy", // path to Asymptote executable "tsqx.extraTsqxArgs": "-p" // extra CLI args (e.g. "-p" for preamble, "-s 200" for size) }