This guide explains how to test the extension locally during development.
Ensure you have the following installed:
- Node.js (v14 or later)
- GhostScript (provides
ps2pdf) - Poppler (provides
pdftocairoandpdfinfo)
# Check if commands are available
ps2pdf --help
pdftocairo --help
pdfinfo --help-
Install dependencies:
yarn install
-
Compile TypeScript:
yarn compile
- Open the project in VS Code
- Press
F5or go to Run → Start Debugging - A new VS Code window will open ("[Extension Development Host]")
- In the new window, open a
.psor.epsfile - Click the preview icon in the editor title bar
For continuous development with auto-compilation:
yarn watchThen press F5 to launch the Extension Development Host.
Test files are located in examples/:
| File | Purpose |
|---|---|
sample.eps |
Sample EPS file |
basic_shapes.ps |
Basic single-page PostScript |
triangle_grid.ps |
PostScript with shapes and grid |
multipage.ps |
3-page document for testing navigation |
- Open
examples/basic_shapes.ps - Click preview icon → Preview should appear
- Open
examples/multipage.ps - Verify Prev/Next buttons appear
- Test page navigation and direct page input
- Open
examples/multipage.ps - Preview the file
- Open Output panel (
Ctrl+Shift+U) - Select "PostScript-Preview" → Should show GhostScript output
- Open Settings (
Ctrl+,) - Search "postscript-preview"
- Verify 3 path settings appear
- Use +/- buttons for zoom
- Click color picker to change background
- Test "Hide Controls" button
- Preview a file
- Edit and save the PostScript file
- Preview should auto-update
yarn testBuild a VSIX package for local installation:
npm install -g @vscode/vsce
vsce packageInstall the generated .vsix file via:
Extensions → ⋯ → Install from VSIX...
-
Create a Personal Access Token (PAT) - see official instructions
-
Login to vsce:
vsce login ahnafnafee
Before publishing a new version:
- Update version in
package.json - Update
CHANGELOG.mdwith new features/fixes - Compile and test locally (
yarn compile+F5) - Build package to verify:
vsce package
vsce publishOr publish with a version bump:
vsce publish patch # 0.5.0 → 0.5.1
vsce publish minor # 0.5.0 → 0.6.0
vsce publish major # 0.5.0 → 1.0.0https://marketplace.visualstudio.com/manage
- Use
console.log()statements in TypeScript code - View debug output in Debug Console panel when running with F5
- Check the Output panel for "PostScript-Preview" logs