Offline copy, generated from danieltuzes.github.io/structile — some content there may have moved on since this was downloaded.

VS Code extension

Opens .json, .py (Python-repr), and .xml files in a VS Code custom editor — the same viewer engine as the standalone page and the Python library, rendered as packed spatial boxes instead of an indented tree.

It is not registered as the default editor for those extensions (.py in particular is obviously source code most of the time) — you open it explicitly, per file.

Install

Not yet on the VS Code Marketplace — install the .vsix manually:

  1. Download structile-0.8.2.vsix.
  2. In VS Code: Ctrl+Shift+P -> Extensions: Install from VSIX...
  3. Pick the downloaded file.

To update later, download a newer .vsix from this page (when one is posted here) and repeat step 2 — VS Code replaces the old version.

Opening a file with the viewer

Replace the current tab (Open With… / Reopen Editor With…):

  1. Find the file in the Explorer sidebar, or in an already-open tab.
  2. Right-click it and choose Open With… (not currently open) or Reopen Editor With… (already open as text).
  3. Pick Structile from the picker.

Or from the command palette, with the file already open: Ctrl+Shift+P -> Reopen Editor With… -> Structile.

Keep the source open and add the viewer beside it — the equivalent of VS Code's own Markdown: Open Preview to the Side: with a .json/.py/ .xml file open as text, press Ctrl+K V, use the preview icon at the top-right of its editor tab, or Ctrl+Shift+P -> Structile: Open Preview to the Side. The source stays where it is and the viewer opens in the column beside it, with two-way sync between them.

Selection, collapse/fold, and edits stay in sync

With the source open beside the graph (Open Preview to the Side), .json/.py files stay synced in both directions, live:

.xml files have no character-position mapping back to the source text, so sync for those is graph-only (no highlight/fold sync).

Opening other file extensions

Only .json/.py/.xml are wired up out of the box. To open a different extension with this viewer — say, a .cfg file that's actually XML underneath — two settings work together, in your User or Workspace settings.json (Ctrl+Shift+P -> Preferences: Open User Settings (JSON)):

"workbench.editorAssociations": {
  "*.cfg": "structile.editor"
},
"structile.extensionFormats": {
  ".cfg": "xml"
}

The first (a built-in VS Code setting) tells VS Code which editor to open that glob pattern with; the second tells the extension itself which format that file actually is.

XML via an interpreter

XML isn't a fixed schema — the viewer needs a small caller-supplied JavaScript interpreter script to say what the tags and attributes in a given file actually mean. See Writing and distributing interpreters for the full guide; two ways to attach one to a file here, checked in order:

  1. A sibling file: config.xml -> config.interpreter.js right next to it. Wins outright if present.
  2. The structile.interpreter setting, as a fallback — a single path or an array of candidates tried in order:

json "structile.interpreter": [ "interpreters/schema_a.js", "interpreters/schema_b.js" ]

Neither present -> the file still opens, with a warning, and waits for one.

Shipping interpreters for a whole team

Two settings above work for one person on one machine — see Writing and distributing interpreters for the two ways to ship a schema to everyone at once (a VS Code extension contribution, or a trusted-workspace-only project folder), plus Structile: Show Interpreter Resolution and Structile: List Contributed Interpreters for debugging which one actually won.

Known limitations