This is an example vscode extension that demonstrates a pattern. It is not published anywhere.
Show a one-time notification when your extension updates, with a "What's New"
button that opens your CHANGELOG.md in VS Code's built-in Markdown preview.
On activation, compare the running version against the last version you told the
user about. The "last notified" version is persisted in globalState, which is
shared across all windows and survives restarts.
stored == none → fresh install → store silently, never notify
stored == current → reload/restart → silent
current > stored → update → store, notify if the bump clears the threshold
current < stored → downgrade → store, stay silent
Not every bump deserves a toast. A updateNotification.notifyOn setting lets the
user pick the smallest change worth interrupting them for:
| Setting | Notifies on |
|---|---|
patch |
any bump (default) |
minor |
minor and major bumps |
major |
major bumps only |
The version math lives in src/versionGate.ts. The VS Code wiring lives in src/updateNotifier.ts.
No custom webview — the changelog is just Markdown, so hand it to the built-in preview:
const uri = vscode.Uri.joinPath(context.extensionUri, 'CHANGELOG.md');
await vscode.commands.executeCommand('markdown.showPreview', uri);Bundle CHANGELOG.md with the extension (it's not in .vscodeignore) so the URI
resolves at runtime.
npm install
F5To see the toast in the Extension Development Host:
- run it once
- bump version in package.json
- run it again