UniDecompiler Pseudocode for VS Code
This extension provides a permissive VS Code language mode for the generic
pseudocode emitted by UniDecompiler.
It intentionally does not try to make the output valid Python, JavaScript,
Lua, Java, or C#. The output is a VM-neutral mixture of function blocks,
structured control flow, low-level labels/gotos, and explicit recovery helpers.
Included features
- TextMate syntax highlighting for the generic pseudocode vocabulary.
- UniDecompiler-aware coloring for function declarations and function-value
references (
<function func_N>), parameters, local/generated variables,
dotted members, constructor/type positions, labels/gotos, recovery helpers,
CFG markers, literals, strings, and comments. The grammar only colors
categories that can be established from syntax; ambiguous names remain
ordinary identifiers.
- Bracket matching and folding for brace-delimited regions.
- Outline entries for functions (labels remain available to navigation but are
intentionally not top-level outline items).
- Same-name definition lookup for functions, parameters, local
let bindings,
and labels.
- Same-name reference lookup for calls, variables, and
goto targets.
- Label declarations and
goto targets use the same symbol range (the
declaration colon is excluded), so Find All References works from either
side without adding labels to the top-level Outline.
- Hover information for indexed names.
- Optional sidecar metadata support. When a matching
<pseudocode-file>.unidec.json is present, hover also shows the mapped VM
instruction, function ID, VM offset, and proven artifact byte range.
- A
VM @offset status-bar item appears while the cursor is inside a mapped
pseudocode range. Click it, or run UniDecompiler: Show VM Instruction Metadata, to display the complete mapped instruction.
UniDecompiler: Refresh Pseudocode Index command.
- Function and VM-instruction navigation, sidecar diagnostics, and a read-only
artifact hex viewer when a proven byte range is available.
- Optional heuristic CFG/structure summaries, workspace search commands, and
configurable CodeLens/multi-file indexing support.
UniDecompiler: Show Heuristic CFG opens a read-only interactive Activity
Bar view with clickable control-flow nodes, direction arrows, and edge kinds.
UniDecompiler: Show Heuristic Structure opens a clickable nested tree.
UniDecompiler: Show Call Graph opens a one-hop callers/current/callees
graph. Clicking a node reveals its source range in the pseudocode editor.
These views update in the background and do not steal focus from Explorer or
Search; only an explicit Show command focuses the requested UniDecompiler
view.
Read-only Hex is an Activity Bar view linked to a proven artifact byte
range. Bytes can navigate back to pseudocode source-map ranges, and selecting
a mapped pseudocode instruction updates the Hex highlight. The artifact is
never modified. If no reliable byte_range exists, the extension does not
guess one. Selecting a pseudocode function updates the view to that
function's first reliable mapping; when the sidecar has byte ranges but no
trusted artifact path, use the explicit Select artifact file action to
choose the original file without any metadata-derived path guess.
The indexer is deliberately tolerant. Compiler-generated names such as
<>1__state, <member>, .ctor, and order_tmp_12 are treated as names.
Unknown syntax remains visible as ordinary text instead of producing parser
errors.
The extension does not send pseudocode, sidecars, artifacts, absolute paths, or
function IDs to a remote service. UI labels shorten path-shaped IDs by default;
full IDs are shown only when unidecompiler.showFullFunctionId is explicitly
enabled by the user. Published extension files contain only the compiled
extension, grammar, configuration, README, and license.
File associations
The language is registered for UniDecompiler's current .pse export suffix,
the legacy .pseudo, .pseudocode, and .unidec suffixes, and files ending
in .pseudocode.txt or .pseudo.txt.
Matching sidecars are grouped under their pseudocode file in Explorer using
VS Code's native file nesting. For example:
Advanced.pse
└── Advanced.pse.unidec.json
This only changes how the files are displayed; it does not rename, merge, or
modify either file. The default nesting can be changed with VS Code's
explorer.fileNesting.* settings if a workspace wants a different layout.
Build locally
npm install
npm run compile
Then press F5 in VS Code with this directory open to launch an Extension
Development Host.
The decompiler can optionally emit a sidecar JSON file next to pseudocode,
named <pseudocode-file>.unidec.json. The extension discovers this file
automatically, validates its schema and SHA-256 binding to the currently open
text, and uses its UTF-16 source ranges for instruction hover details. Missing,
invalid, unsupported, out-of-bounds, dangling, or stale entries are reported
as warnings in Problems while the permissive text index remains the fallback.
The sidecar is never required for syntax highlighting or ordinary same-name
navigation. CFG and structure views are explicitly heuristic and are not
claims about a core AST/CFG.