Skip to content

Commit 7fb2071

Browse files
committed
feat(vscode): show "What's New" notification after extension update
Display an info notification when the extension version changes, linking to the news page on robotcode.io via the built-in Simple Browser. Also adds a public "RobotCode: Show What's New" command to the palette.
1 parent 9978a88 commit 7fb2071

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,11 @@
13721372
"category": "RobotCode",
13731373
"command": "robotcode.createNewNotebook"
13741374
},
1375+
{
1376+
"title": "Show What's New",
1377+
"category": "RobotCode",
1378+
"command": "robotcode.showWhatsNew"
1379+
},
13751380
{
13761381
"command": "robotcode.notebookEditor.restartKernel",
13771382
"title": "Restart Kernel",

vscode-client/extension/index.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,48 @@ export async function activateAsync(context: vscode.ExtensionContext): Promise<v
3939

4040
outputChannel.appendLine("Activate RobotCode Extension.");
4141

42+
const currentVersion = context.extension.packageJSON.version as string;
43+
const previousVersion = context.globalState.get<string>("robotcode.lastVersion");
44+
45+
if (previousVersion !== currentVersion) {
46+
vscode.window
47+
.showInformationMessage(
48+
`RobotCode has been updated to v${currentVersion}. Want to know what's new? Click below to see all the latest changes and improvements.`,
49+
"What's New?",
50+
)
51+
.then(async (action) => {
52+
if (action === "What's New?") {
53+
await vscode.commands.executeCommand("robotcode.showWhatsNew");
54+
}
55+
});
56+
}
57+
58+
context.globalState.update("robotcode.lastVersion", currentVersion);
59+
60+
context.subscriptions.push(
61+
vscode.commands.registerCommand("robotcode.showWhatsNew", async () => {
62+
await vscode.commands.executeCommand("simpleBrowser.api.open", "https://robotcode.io/news/", {
63+
preserveFocus: false,
64+
viewColumn: vscode.ViewColumn.Active,
65+
});
66+
}),
67+
vscode.commands.registerCommand("robotcode.testWhatsNew", async () => {
68+
const action = await vscode.window.showQuickPick(
69+
[
70+
{ label: "Set to 0.0.0", description: "Simulate upgrade from old version" },
71+
{ label: "Delete", description: "Remove stored version (simulate fresh install)" },
72+
],
73+
{ placeHolder: "Choose how to reset robotcode.lastVersion" },
74+
);
75+
if (action) {
76+
await context.globalState.update("robotcode.lastVersion", action.label === "Delete" ? undefined : "0.0.0");
77+
vscode.window.showInformationMessage(
78+
`robotcode.lastVersion ${action.label === "Delete" ? "deleted" : "set to 0.0.0"}. Reload window to see notification.`,
79+
);
80+
}
81+
}),
82+
);
83+
4284
const pythonManager = new PythonManager(context, outputChannel);
4385

4486
languageClientManger = new LanguageClientsManager(context, pythonManager, outputChannel);

0 commit comments

Comments
 (0)