Skip to content

update.ps1 installs and updates the VS Code extension - #222

Merged
markbac merged 1 commit into
mainfrom
claude/update-vscode-extension
Nov 5, 2026
Merged

markbac merged 1 commit into
mainfrom
claude/update-vscode-extension

Conversation

@markbac

@markbac markbac commented Nov 5, 2026

Copy link
Copy Markdown
Owner

scripts/update.ps1 now installs py-doc's VS Code extension when VS Code is present, and installs it again when the extension changes.

What it does

  • New step 5, "VS Code extension", after the py-doc command check and before Docker, so a Docker problem doesn't block it. It runs the new scripts/install-vscode-extension.ps1, which:
    • finds VS Code's command line (-Code, else code on the PATH, else the usual Windows install folders). Without one, it says so and does nothing.
    • builds and installs the extension (npm ci, npx @vscode/vsce@3.6.2 package, code --install-extension … --force) when:
      • it isn't installed, or
      • another version is installed, or
      • any of its files changed since the last install, even without a version bump. A hash of the files is kept in .py-doc/vscode-extension.sha256, which Git ignores.
    • otherwise reports "up to date".
    • deletes the built .vsix after installing, and tells you to reload open VS Code windows.
  • Building needs Node.js. If it's missing, or the build or install fails, the step says why and the rest of the update carries on.
  • New options on update.ps1: -NoVSCode skips the step, and -Code names code.cmd when VS Code isn't on the PATH. The script can also run on its own, and -Force reinstalls even when it's up to date.

Docs

The install guide's update-steps table, the root README and the extension README describe it.

Testing

PowerShell wasn't available where this was written, so neither script has run yet; this PR's CI is the first run.

tests/test_vscode_install_script.py runs the script against a fake VS Code command line:

  • it installs once, does nothing on the next run, and reinstalls when the files change;
  • it replaces an older installed version;
  • a -Code path that doesn't exist fails with the reason.

It needs PowerShell and Node.js, which GitHub's Ubuntu and Windows runners have, and is skipped elsewhere. The update.ps1 change itself is untested: worth running .\scripts\update.ps1 -NoPull once on Windows before merging.

ruff and the docs lint are clean.


Generated by Claude Code

A new step, before Docker: when VS Code is there, update.ps1 runs the
new scripts/install-vscode-extension.ps1. It builds editors/vscode
(npm ci and vsce) and installs it with code --install-extension when it
is not installed, another version is, or any of its files changed since
the last install (a hash kept in .py-doc/vscode-extension.sha256).
Otherwise it says it is up to date. A failure is reported and the
update goes on. -NoVSCode skips the step and -Code names VS Code's
command line when it is not on the PATH.

The script is tested against a fake VS Code command line where
PowerShell and Node.js are present, as on GitHub's runners.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WHtcxeRPPmXcydfxoEHGJ4
@markbac
markbac merged commit 445b17c into main Nov 5, 2026
6 checks passed
@markbac
markbac deleted the claude/update-vscode-extension branch November 5, 2026 14:31
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