Skip to content

Commit

Permalink
add open workspace file command
Browse files Browse the repository at this point in the history
  • Loading branch information
ElinorW committed Aug 14, 2024
1 parent c566afa commit a90f2e2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vscode/microsoft-kiota/src/migrateFromLockFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { connectToKiota, KiotaLogEntry, LogLevel } from "./kiotaInterop";
import * as rpc from "vscode-jsonrpc/node";
import * as vscode from "vscode";
import { KIOTA_LOCK_FILE } from "./constants";
import { handleMigration } from "./util";
import { getWorkspaceJsonPath, handleMigration } from "./util";

export function migrateFromLockFile(context: vscode.ExtensionContext, lockFileDirectory: string): Promise<KiotaLogEntry[] | undefined> {
return connectToKiota(context, async (connection) => {
Expand Down Expand Up @@ -39,13 +39,16 @@ export async function checkForLockFileAndPrompt(context: vscode.ExtensionContext
};

export function displayMigrationMessages(logEntries: KiotaLogEntry[]) {
const workspaceJsonUri = vscode.Uri.file(getWorkspaceJsonPath());
const successEntries = logEntries.filter(entry =>
entry.level === LogLevel.information && entry.message.includes("migrated successfully")
);

if (successEntries.length > 0) {
successEntries.forEach(entry => {
vscode.window.showInformationMessage(vscode.l10n.t("Api clients migrated successfully!"));
vscode.commands.executeCommand('kiota.workspace.refresh');
vscode.commands.executeCommand('kiota.workspace.openWorkspaceFile', workspaceJsonUri);
});
} else {
logEntries.forEach(entry => {
Expand Down

0 comments on commit a90f2e2

Please sign in to comment.