Skip to content

Auto-install the PostScript Language dependency and clarify why it's required - #23

Merged
ahnafnafee merged 2 commits into
ahnafnafee:masterfrom
DABH:docs/language-extension-dependency
Aug 30, 2026
Merged

ahnafnafee merged 2 commits into
ahnafnafee:masterfrom
DABH:docs/language-extension-dependency

Conversation

@DABH

@DABH DABH commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Installing this extension and following the Quick Start (Ghostscript + Poppler on PATH) is not enough to get a preview button. The button is contributed with "when": "resourceLangId == postscript", and the extension activates only on onLanguage:postscript — but nothing in this extension registers the postscript language for .ps/.eps files. That registration comes from the separate PostScript Language extension.

Without it, .eps/.ps files open as Plain Text, so the preview icon never appears and the extension never activates. The README does list PostScript Language under Requirements, but frames it as being "for syntax highlighting", which reads as optional/cosmetic — so it's easy to skip and then conclude the extension is broken. (Hit this on a fresh Windows 11 setup with Ghostscript and Poppler correctly installed and on PATH; everything worked once the language extension was added.)

Changes

  • package.json: declare "extensionDependencies": ["mxschmitt.postscript"] so VS Code installs the language extension automatically alongside this one — future users can't hit this failure mode.
  • README: reword the requirement to say the language extension is required for the preview button to appear (not just highlighting), note that it is auto-installed, and add a "No preview button?" troubleshooting tip for users on existing installs.

Alternative considered

If you'd rather not hard-depend on mxschmitt.postscript, this extension could instead contribute a bare languages entry ({"id": "postscript", "extensions": [".ps", ".eps"]}). Language contributions merge across extensions, so mxschmitt's grammar would still apply when installed, but the preview button would work standalone. Happy to rework the PR that way if you prefer.

Update: CI fix

The Unit Tests workflow initially failed on this PR — correctly so: with extensionDependencies declared, the extension can no longer activate in the integration-test VS Code instance, where mxschmitt.postscript is not installed (Cannot activate ... depends on unknown extension). src/test/runTest.ts now downloads the dependency as a VSIX and installs it into the test instance before runTests (a VSIX file install also avoids the Signature verification failed with 'ENOENT' abort that id-based installs can hit in the test CLI). Verified locally from a clean .vscode-test sandbox on Windows: all 7 tests pass.

@ahnafnafee
ahnafnafee self-requested a review August 29, 2026 23:25
@DABH

DABH commented Aug 30, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for approving the CI run — it caught a real gap in this PR, now fixed in d401161.

The failure was legitimate: once extensionDependencies is declared, the extension can no longer activate in the integration-test VS Code instance, because mxschmitt.postscript isn't installed there (Cannot activate the 'PostScript Preview' extension because it depends on unknown extension 'mxschmitt.postscript'). That took out the activation test and the three tests that follow from it.

src/test/runTest.ts now installs the dependency into the test instance before runTests. It downloads the VSIX and installs from the file rather than by extension id — the id-based install aborts with Signature verification failed with 'ENOENT' when the marketplace signature-verification tooling isn't available to the test CLI (reproduced locally), which would have traded one red build for another.

Verified locally on Windows from a clean .vscode-test sandbox: 7 passing. The push needs another CI approval when you have a moment.

@ahnafnafee

Copy link
Copy Markdown
Owner

Hi @DABH , you can rebase or merge in the latest changes in the default branch to fix the CI issues.

DABH added 2 commits August 29, 2026 19:57
The preview button is gated on 'resourceLangId == postscript' and the
extension activates only 'onLanguage:postscript', but nothing in this
extension registers the postscript language for .ps/.eps files - that
comes from mxschmitt.postscript. Without it, .eps/.ps files open as
plain text, so the preview button never appears and the extension never
activates. The README listed the language extension only 'for syntax
highlighting', which reads as optional.

- package.json: add extensionDependencies so VS Code installs
  mxschmitt.postscript automatically with this extension
- README: state the dependency is required for the preview button, and
  add a troubleshooting note for the no-button symptom
With extensionDependencies declared, the extension under test cannot
activate in the integration-test VS Code instance unless
mxschmitt.postscript is installed there, so the activation and command
tests fail ("Cannot activate ... depends on unknown extension").

Download the dependency as a VSIX and install it via the test CLI before
runTests. Installing by id instead can abort with "Signature
verification failed with 'ENOENT'" when the marketplace signature
verification tooling is unavailable in the test CLI; installing from a
local VSIX file avoids that path. spawnSync uses a shell on Windows
because Node refuses to spawn .cmd files directly (CVE-2024-27980).

Verified locally from a clean .vscode-test sandbox: 7 passing.
DABH pushed a commit to DABH/PostScript-Preview that referenced this pull request Aug 30, 2026
The existing CI combined Node 20-based actions with a legacy VS Code test harness. That harness did not install declared extension dependencies and its older Electron launcher no longer matched current macOS application layouts. The dependency tree also retained an abandoned runtime temp-file package and vulnerable transitive tooling.

Move CI and release automation to Node 24-based actions, migrate tests to the VS Code test CLI, pin current release tools, and add weekly Dependabot updates. Refresh the supported development toolchain, replace shell command strings and the temp package with built-in process and filesystem APIs, preserve VS Code 1.46 compatibility through minimum-host type definitions, and bump the extension to 0.6.0.

Mocha's patched diff and serialize-javascript releases are temporarily selected beyond upstream's declared ranges; both assertion failure rendering and the full extension suite were verified. Validation passed with a frozen install, compile, lint, actionlint, a zero-finding audit across 223 packages, 7 extension-host tests on VS Code 1.135, a VS Code 1.46 activation smoke test, automatic installation of the PR ahnafnafee#23 extension dependency, and a packaged 0.6.0 VSIX.
DABH pushed a commit to DABH/PostScript-Preview that referenced this pull request Aug 30, 2026
PR ahnafnafee#23 extends src/test/runTest.ts to install the PostScript language dependency before launching the extension host. Replacing that entry point with the VS Code test CLI in ahnafnafee#25 created a modify/delete conflict and bypassed the author's implementation.

Restore the original runner byte-for-byte, make it the active test script again, and update only the separate Mocha suite loader for the current glob API and a stable startup timeout. Keep the current Electron launcher, add the narrow Node 24 fetch declaration needed by PR ahnafnafee#23's host-side installer, and remove the superseded test CLI dependency.

Validation passed with a frozen install, compile, lint, a zero-finding audit across 190 packages, 7 extension-host tests, VSIX packaging, and a clean application check for the complete PR ahnafnafee#23 patch. README.md remains unchanged.
@DABH
DABH force-pushed the docs/language-extension-dependency branch from d401161 to fcd476d Compare August 30, 2026 00:59
@DABH

DABH commented Aug 30, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto master (03c02c1) — thanks for the pointer, that was the missing piece.

The rebase resolved cleanly with no conflicts, and the two remaining failures were both fixed by your CI modernization rather than by anything in this PR:

One nice coincidence: src/test/node24-globals.d.ts declares fetch with exactly the ok / status / arrayBuffer() shape this PR's launcher needs, so the VSIX-download step type-checks against @types/node@12 + strict with no further changes.

Verified locally on the rebased branch from a clean .vscode-test sandbox, using yarn install --frozen-lockfile and the new TypeScript 6 config: compile clean, 7 passing, exit code 0. yarn.lock is untouched; the PR is still just README.md, package.json, and src/test/runTest.ts.

Ready for another CI approval whenever you have a moment.

@ahnafnafee
ahnafnafee merged commit 013d38a into ahnafnafee:master Aug 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants