Skip to content

Commit

Permalink
Fix VSCode's extension update (#5514)
Browse files Browse the repository at this point in the history
* add kiotaVersion property to workspace json file

* update workspace JSON schema

* Update vscode/microsoft-kiota/src/extension.ts

Co-authored-by: Faith Kangai <[email protected]>

* remove kiotaVersion from workspace configuration

update workspace json schema

* update json schema version

---------

Co-authored-by: Caleb Magiya (from Dev Box) <[email protected]>
Co-authored-by: Faith Kangai <[email protected]>
  • Loading branch information
3 people authored Oct 3, 2024
1 parent 6627a99 commit a62abf6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions specs/schemas/workspace.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "<http://json-schema.org/draft-07/schema#>",
"$schema": "https://json-schema.org/2020-12/schema",
"type": "object",
"properties": {
"version": {
Expand Down Expand Up @@ -104,4 +104,4 @@
}
}
}
}
}
9 changes: 6 additions & 3 deletions vscode/microsoft-kiota/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,12 @@ async function showUpgradeWarningMessage(clientPath: string, context: vscode.Ext
}
const workspaceFileData = await vscode.workspace.fs.readFile(vscode.Uri.file(workspaceFilePath));
const workspaceFile = JSON.parse(workspaceFileData.toString()) as { kiotaVersion: string };
const clientVersion = workspaceFile.kiotaVersion.toLocaleLowerCase();
if (clientVersion.toLocaleLowerCase() !== kiotaVersion) {
await vscode.window.showWarningMessage(vscode.l10n.t("Client will be upgraded from version {0} to {1}, upgrade your dependencies", clientVersion, kiotaVersion));
// don't fail if kiotaVersion isn't in the workspace config file
if (workspaceFile.kiotaVersion) {
const clientVersion = workspaceFile.kiotaVersion.toLocaleLowerCase();
if (clientVersion !== kiotaVersion) {
await vscode.window.showWarningMessage(vscode.l10n.t("Client will be upgraded from version {0} to {1}, upgrade your dependencies", clientVersion, kiotaVersion));
}
}
}

Expand Down

0 comments on commit a62abf6

Please sign in to comment.