PostScript Programming Language

A Visual Studio Code extension for PostScript (Ghostscript): syntax highlighting, language server, code snippets, and a debugger that runs PostScript files with Ghostscript.
Works in VS Code as well as VSCodium, Eclipse Theia and other editors that use the Open VSX registry.
Installation
VS Code — install from the Marketplace, or from the command line:
code --install-extension yingquelou.postscriptsnippets
VSCodium / Theia / Gitpod (Open VSX) — install from Open VSX, or from the command line:
codium --install-extension yingquelou.postscriptsnippets
Both registries receive the exact same VSIX. The extension is bundled with esbuild and ships all of its dependencies, so nothing extra is downloaded at install time.
Ghostscript is still required — see Requirements.
Features
- Language support — Grammar and language configuration for
.ps and .eps files (aliases: PostScript, GhostScript).
- Syntax highlighting — PostScript source highlighting via
source.postscript scope.
- Document outline — Outline / document symbols (arrays, dictionaries, procedures, strings, names, numbers) provided by the built-in PostScript Language Server. Mark-consuming operators (
cleartomark, pdfmark) keep the operands collected since their mark as children instead of being reported as an unclosed array.
- Go to Definition & Workspace Symbols — A token-level index of
/name … def pairs across the workspace; definitions in an unsaved buffer are offered before the copy on disk.
- Ghostscript Validation —
PostScript: Validate with Ghostscript runs the file (or its whole build unit, when postscript.config.json declares one) through the real interpreter and reports the failure where it happened. Clean runs, quit, structured and human-readable errors are told apart, and a leftover mark is reported separately from a clean stack.
- Build Trace —
PostScript: Generate Build Trace replays the configured build with run shadowed and writes .postscript/build-trace.json; stderr order is the real execution order, nested run included.
- Code snippets — Snippets for operators and errors.
- Debugger — Run and debug PostScript with Ghostscript, with breakpoints, step operations, and debug console output.
- PostScript Compilation — Compile PostScript files directly from the editor with a toolbar button or command.
- Project Configuration — Define project-specific settings, dependencies, build arguments, and custom Ghostscript paths via
postscript.config.json.
- Intelligent Completion — Smart code completion with enhanced sorting, subsequence matching, and snippet integration.
- Enhanced Ghostscript Detection — Improved auto-detection with validation and fallback strategies for reliable Ghostscript integration.
Requirements
Ghostscript installed and available on PATH, or specify the full path in settings. It is used by the debugger, by Validate with Ghostscript, and by Generate Build Trace.
Automatic detection order:
- Windows:
gswin64c → gswin32c → gs
- macOS/Linux:
gs
Quick Usage
- Open
.ps or .eps file
- Use Outline view for document structure
- Press
F5 to start debugging with Ghostscript
- Click the compile button in the editor toolbar to compile PostScript
- Create a
postscript.config.json in your project root for custom build configuration
- Run
PostScript: Validate with Ghostscript from the Command Palette to check the file against the interpreter
- Run
PostScript: Generate Build Trace to record the real execution order of the build
If a project clears marks with an operator the defaults do not know about (Ghostscript's own pdfwrite sources use error and .dicttomark), list it in postscript.parser.markConsumingOperators.
📚 Documentation Links