From 3a6c8cf7aa5cd69700d5d722fd4c08defb6d6453 Mon Sep 17 00:00:00 2001 From: ElinorW Date: Tue, 13 Aug 2024 16:17:46 +0300 Subject: [PATCH 01/11] add migration dialog --- vscode/microsoft-kiota/src/constants.ts | 1 + vscode/microsoft-kiota/src/extension.ts | 56 ++++++++++++++++++++++++- vscode/microsoft-kiota/src/util.ts | 31 ++++++++++++++ 3 files changed, 86 insertions(+), 2 deletions(-) diff --git a/vscode/microsoft-kiota/src/constants.ts b/vscode/microsoft-kiota/src/constants.ts index c604466f7e..fa467dc88c 100644 --- a/vscode/microsoft-kiota/src/constants.ts +++ b/vscode/microsoft-kiota/src/constants.ts @@ -11,4 +11,5 @@ export const PLUGINS = "plugins"; export const CLIENT = "client"; export const PLUGIN = "plugin"; export const APIMANIFEST = "apimanifest"; +export const REMIND_ME_LATER_FLAG = 'remindMeLater'; diff --git a/vscode/microsoft-kiota/src/extension.ts b/vscode/microsoft-kiota/src/extension.ts index 45576ea78b..4fccb39237 100644 --- a/vscode/microsoft-kiota/src/extension.ts +++ b/vscode/microsoft-kiota/src/extension.ts @@ -28,8 +28,9 @@ import { ExtensionSettings, getExtensionSettings } from "./extensionSettings"; import { loadTreeView } from "./workspaceTreeProvider"; import { generatePlugin } from "./generatePlugin"; import { CodeLensProvider } from "./codelensProvider"; -import { KIOTA_DIRECTORY, KIOTA_WORKSPACE_FILE, dependenciesInfo, extensionId, statusBarCommandId, treeViewFocusCommand, treeViewId } from "./constants"; -import { getWorkspaceJsonDirectory, getWorkspaceJsonPath, isClientType, isPluginType, updateTreeViewIcons } from "./util"; +import { KIOTA_WORKSPACE_FILE, REMIND_ME_LATER_FLAG, dependenciesInfo, extensionId, statusBarCommandId, treeViewFocusCommand, treeViewId } from "./constants"; +import { findLockFile, getWorkspaceJsonDirectory, getWorkspaceJsonPath, isClientType, isPluginType, updateTreeViewIcons } from "./util"; +import { migrateFromLockFile } from "./migrateFromLockFile"; let kiotaStatusBarItem: vscode.StatusBarItem; let kiotaOutputChannel: vscode.LogOutputChannel; @@ -58,6 +59,57 @@ export async function activate( const reporter = new TelemetryReporter(context.extension.packageJSON.telemetryInstrumentationKey); await loadTreeView(context); let codeLensProvider = new CodeLensProvider(); + vscode.workspace.onDidOpenTextDocument(async () => { + const workspaceFolders = vscode.workspace.workspaceFolders; + + if (workspaceFolders) { + for (const folder of workspaceFolders) { + const lockFilePath = await findLockFile(folder.uri.fsPath); + + if (lockFilePath) { + const remindMeLater = context.globalState.get(REMIND_ME_LATER_FLAG); + + if (remindMeLater === undefined || remindMeLater) { + // Show the prompt again if the user selected "Remind me later" and the lock-file.json is still present + const result = await vscode.window.showInformationMessage( + vscode.l10n.t("Please migrate your API clients to Kiota workspace."), + vscode.l10n.t("OK"), + vscode.l10n.t("Remind me later") + ); + + if (result === vscode.l10n.t("OK")) { + await context.globalState.update(REMIND_ME_LATER_FLAG, false); + + vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: vscode.l10n.t("Migrating API clients..."), + cancellable: false + }, async (progress) => { + progress.report({ increment: 0 }); + + try { + const migrationResult = await migrateFromLockFile(context, lockFilePath); + + progress.report({ increment: 100 }); + + if (migrationResult) { + vscode.window.showInformationMessage(vscode.l10n.t("API clients migrated successfully!")); + } else { + vscode.window.showWarningMessage(vscode.l10n.t("Migration completed, but no changes were detected.")); + } + } catch (error) { + vscode.window.showErrorMessage(vscode.l10n.t(`Migration failed: ${error}`)); + } + }); + } else if (result === vscode.l10n.t("Remind me later")) { + await context.globalState.update(REMIND_ME_LATER_FLAG, true); + } + } + break; + } + } + } +}); context.subscriptions.push( vscode.window.registerUriHandler({ handleUri: async (uri: vscode.Uri) => { diff --git a/vscode/microsoft-kiota/src/util.ts b/vscode/microsoft-kiota/src/util.ts index 087dc03fde..42a0c93b01 100644 --- a/vscode/microsoft-kiota/src/util.ts +++ b/vscode/microsoft-kiota/src/util.ts @@ -66,4 +66,35 @@ export function findAppPackageDirectory(directory: string): string | null { } return null; +} + +export async function findLockFile(directory: string): Promise { + return new Promise((resolve) => { + fs.readdir(directory, (err, files) => { + if (err) { + resolve(undefined); + return; + } + for (const file of files) { + const fullPath = path.join(directory, file); + + if (file === 'kiota-lock.json') { + resolve(fullPath); + return; + } + + // Check directories recursively + if (fs.statSync(fullPath).isDirectory()) { + void findLockFile(fullPath).then((result) => { + if (result) { + resolve(result); + return; + } + }); + } + } + + resolve(undefined); + }); + }); } \ No newline at end of file From 395d0df62f4620c82a0d333592478ed876c09f50 Mon Sep 17 00:00:00 2001 From: ElinorW Date: Tue, 13 Aug 2024 18:25:49 +0300 Subject: [PATCH 02/11] update the prompt check --- vscode/microsoft-kiota/src/extension.ts | 79 +++++++++++++------------ 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/vscode/microsoft-kiota/src/extension.ts b/vscode/microsoft-kiota/src/extension.ts index 4fccb39237..0d1a7aebde 100644 --- a/vscode/microsoft-kiota/src/extension.ts +++ b/vscode/microsoft-kiota/src/extension.ts @@ -58,58 +58,59 @@ export async function activate( ); const reporter = new TelemetryReporter(context.extension.packageJSON.telemetryInstrumentationKey); await loadTreeView(context); + await checkForLockFileAndPrompt(context); let codeLensProvider = new CodeLensProvider(); - vscode.workspace.onDidOpenTextDocument(async () => { + async function checkForLockFileAndPrompt(context: vscode.ExtensionContext) { const workspaceFolders = vscode.workspace.workspaceFolders; if (workspaceFolders) { + let lockFilePath: string | undefined; for (const folder of workspaceFolders) { - const lockFilePath = await findLockFile(folder.uri.fsPath); - + lockFilePath = await findLockFile(folder.uri.fsPath); if (lockFilePath) { - const remindMeLater = context.globalState.get(REMIND_ME_LATER_FLAG); - - if (remindMeLater === undefined || remindMeLater) { - // Show the prompt again if the user selected "Remind me later" and the lock-file.json is still present - const result = await vscode.window.showInformationMessage( - vscode.l10n.t("Please migrate your API clients to Kiota workspace."), - vscode.l10n.t("OK"), - vscode.l10n.t("Remind me later") - ); - - if (result === vscode.l10n.t("OK")) { - await context.globalState.update(REMIND_ME_LATER_FLAG, false); - - vscode.window.withProgress({ - location: vscode.ProgressLocation.Notification, - title: vscode.l10n.t("Migrating API clients..."), - cancellable: false - }, async (progress) => { - progress.report({ increment: 0 }); - - try { - const migrationResult = await migrateFromLockFile(context, lockFilePath); - - progress.report({ increment: 100 }); - - if (migrationResult) { + break; + } + } + + const remindMeLater = context.globalState.get(REMIND_ME_LATER_FLAG); + + if (lockFilePath || remindMeLater) { + const result = await vscode.window.showInformationMessage( + vscode.l10n.t("Please migrate your API clients to Kiota workspace."), + vscode.l10n.t("OK"), + vscode.l10n.t("Remind me later") + ); + + if (result === vscode.l10n.t("OK")) { + await context.globalState.update(REMIND_ME_LATER_FLAG, false); + + vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: vscode.l10n.t("Migrating API clients..."), + cancellable: false + }, async (progress) => { + progress.report({ increment: 0 }); + + try { + const migrationResult = await migrateFromLockFile(context, lockFilePath!); + + progress.report({ increment: 100 }); + + if (migrationResult) { vscode.window.showInformationMessage(vscode.l10n.t("API clients migrated successfully!")); - } else { + } else { vscode.window.showWarningMessage(vscode.l10n.t("Migration completed, but no changes were detected.")); - } - } catch (error) { - vscode.window.showErrorMessage(vscode.l10n.t(`Migration failed: ${error}`)); } - }); - } else if (result === vscode.l10n.t("Remind me later")) { - await context.globalState.update(REMIND_ME_LATER_FLAG, true); + } catch (error) { + vscode.window.showErrorMessage(vscode.l10n.t(`Migration failed: ${error}`)); } - } - break; + }); + } else if (result === vscode.l10n.t("Remind me later")) { + await context.globalState.update(REMIND_ME_LATER_FLAG, true); } } } -}); + }; context.subscriptions.push( vscode.window.registerUriHandler({ handleUri: async (uri: vscode.Uri) => { From 4503dfe42a01f4223b4a56ee93c4ac347fbde595 Mon Sep 17 00:00:00 2001 From: ElinorW Date: Wed, 14 Aug 2024 12:40:35 +0300 Subject: [PATCH 03/11] pass workspace folder and update message display --- vscode/microsoft-kiota/src/extension.ts | 71 ++++++++----------- .../src/migrateFromLockFile.ts | 30 +++++++- vscode/microsoft-kiota/src/util.ts | 31 -------- 3 files changed, 58 insertions(+), 74 deletions(-) diff --git a/vscode/microsoft-kiota/src/extension.ts b/vscode/microsoft-kiota/src/extension.ts index 0d1a7aebde..5a40342ec6 100644 --- a/vscode/microsoft-kiota/src/extension.ts +++ b/vscode/microsoft-kiota/src/extension.ts @@ -29,8 +29,8 @@ import { loadTreeView } from "./workspaceTreeProvider"; import { generatePlugin } from "./generatePlugin"; import { CodeLensProvider } from "./codelensProvider"; import { KIOTA_WORKSPACE_FILE, REMIND_ME_LATER_FLAG, dependenciesInfo, extensionId, statusBarCommandId, treeViewFocusCommand, treeViewId } from "./constants"; -import { findLockFile, getWorkspaceJsonDirectory, getWorkspaceJsonPath, isClientType, isPluginType, updateTreeViewIcons } from "./util"; -import { migrateFromLockFile } from "./migrateFromLockFile"; +import { getWorkspaceJsonDirectory, getWorkspaceJsonPath, isClientType, isPluginType, updateTreeViewIcons } from "./util"; +import { displayMigrationMessages, migrateFromLockFile } from "./migrateFromLockFile"; let kiotaStatusBarItem: vscode.StatusBarItem; let kiotaOutputChannel: vscode.LogOutputChannel; @@ -62,52 +62,41 @@ export async function activate( let codeLensProvider = new CodeLensProvider(); async function checkForLockFileAndPrompt(context: vscode.ExtensionContext) { const workspaceFolders = vscode.workspace.workspaceFolders; + const remindMeLater = context.globalState.get(REMIND_ME_LATER_FLAG); - if (workspaceFolders) { - let lockFilePath: string | undefined; - for (const folder of workspaceFolders) { - lockFilePath = await findLockFile(folder.uri.fsPath); - if (lockFilePath) { - break; - } - } - - const remindMeLater = context.globalState.get(REMIND_ME_LATER_FLAG); - - if (lockFilePath || remindMeLater) { - const result = await vscode.window.showInformationMessage( - vscode.l10n.t("Please migrate your API clients to Kiota workspace."), - vscode.l10n.t("OK"), - vscode.l10n.t("Remind me later") - ); + if (workspaceFolders || remindMeLater) { + const result = await vscode.window.showInformationMessage( + vscode.l10n.t("Please migrate your API clients to Kiota workspace."), + vscode.l10n.t("OK"), + vscode.l10n.t("Remind me later") + ); - if (result === vscode.l10n.t("OK")) { - await context.globalState.update(REMIND_ME_LATER_FLAG, false); + if (result === vscode.l10n.t("OK")) { + await context.globalState.update(REMIND_ME_LATER_FLAG, false); - vscode.window.withProgress({ - location: vscode.ProgressLocation.Notification, - title: vscode.l10n.t("Migrating API clients..."), - cancellable: false - }, async (progress) => { - progress.report({ increment: 0 }); + vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: vscode.l10n.t("Migrating API clients..."), + cancellable: false + }, async (progress) => { + progress.report({ increment: 0 }); - try { - const migrationResult = await migrateFromLockFile(context, lockFilePath!); + try { + const migrationResult = await migrateFromLockFile(context, workspaceFolders![0].uri.fsPath); - progress.report({ increment: 100 }); + progress.report({ increment: 100 }); - if (migrationResult) { - vscode.window.showInformationMessage(vscode.l10n.t("API clients migrated successfully!")); - } else { - vscode.window.showWarningMessage(vscode.l10n.t("Migration completed, but no changes were detected.")); - } - } catch (error) { - vscode.window.showErrorMessage(vscode.l10n.t(`Migration failed: ${error}`)); + if (migrationResult && migrationResult.length > 0) { + displayMigrationMessages(migrationResult); + } else { + vscode.window.showWarningMessage(vscode.l10n.t("Migration completed, but no changes were detected.")); } - }); - } else if (result === vscode.l10n.t("Remind me later")) { - await context.globalState.update(REMIND_ME_LATER_FLAG, true); - } + } catch (error) { + vscode.window.showErrorMessage(vscode.l10n.t(`Migration failed: ${error}`)); + } + }); + } else if (result === vscode.l10n.t("Remind me later")) { + await context.globalState.update(REMIND_ME_LATER_FLAG, true); } } }; diff --git a/vscode/microsoft-kiota/src/migrateFromLockFile.ts b/vscode/microsoft-kiota/src/migrateFromLockFile.ts index 33593b8590..4166e2e9a4 100644 --- a/vscode/microsoft-kiota/src/migrateFromLockFile.ts +++ b/vscode/microsoft-kiota/src/migrateFromLockFile.ts @@ -1,4 +1,4 @@ -import { connectToKiota, KiotaLogEntry } from "./kiotaInterop"; +import { connectToKiota, KiotaLogEntry, LogLevel } from "./kiotaInterop"; import * as rpc from "vscode-jsonrpc/node"; import * as vscode from "vscode"; @@ -13,4 +13,30 @@ export function migrateFromLockFile(context: vscode.ExtensionContext, lockFileDi ); return result; }); -}; \ No newline at end of file +}; + +export function displayMigrationMessages(logEntries: KiotaLogEntry[]) { + 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!")); + }); + } else { + logEntries.forEach(entry => { + switch (entry.level) { + case LogLevel.warning: + vscode.window.showWarningMessage(vscode.l10n.t(entry.message)); + break; + case LogLevel.error: + case LogLevel.critical: + vscode.window.showErrorMessage(vscode.l10n.t(entry.message)); + break; + default: + break; + } + }); + } +} \ No newline at end of file diff --git a/vscode/microsoft-kiota/src/util.ts b/vscode/microsoft-kiota/src/util.ts index 42a0c93b01..087dc03fde 100644 --- a/vscode/microsoft-kiota/src/util.ts +++ b/vscode/microsoft-kiota/src/util.ts @@ -66,35 +66,4 @@ export function findAppPackageDirectory(directory: string): string | null { } return null; -} - -export async function findLockFile(directory: string): Promise { - return new Promise((resolve) => { - fs.readdir(directory, (err, files) => { - if (err) { - resolve(undefined); - return; - } - for (const file of files) { - const fullPath = path.join(directory, file); - - if (file === 'kiota-lock.json') { - resolve(fullPath); - return; - } - - // Check directories recursively - if (fs.statSync(fullPath).isDirectory()) { - void findLockFile(fullPath).then((result) => { - if (result) { - resolve(result); - return; - } - }); - } - } - - resolve(undefined); - }); - }); } \ No newline at end of file From 1706ffa84431482d2d911d46ad6c960e2c49d6c4 Mon Sep 17 00:00:00 2001 From: ElinorW Date: Wed, 14 Aug 2024 12:41:05 +0300 Subject: [PATCH 04/11] add strings to be translated --- vscode/microsoft-kiota/l10n/bundle.l10n.ar.json | 8 +++++++- vscode/microsoft-kiota/l10n/bundle.l10n.cs.json | 8 +++++++- vscode/microsoft-kiota/l10n/bundle.l10n.es.json | 8 +++++++- vscode/microsoft-kiota/l10n/bundle.l10n.fr.json | 8 +++++++- vscode/microsoft-kiota/l10n/bundle.l10n.it.json | 8 +++++++- vscode/microsoft-kiota/l10n/bundle.l10n.ja.json | 8 +++++++- vscode/microsoft-kiota/l10n/bundle.l10n.pl.json | 8 +++++++- vscode/microsoft-kiota/l10n/bundle.l10n.pt.json | 8 +++++++- vscode/microsoft-kiota/l10n/bundle.l10n.ru.json | 8 +++++++- vscode/microsoft-kiota/l10n/bundle.l10n.sw.json | 8 +++++++- vscode/microsoft-kiota/l10n/bundle.l10n.tr.json | 8 +++++++- vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json | 8 +++++++- 12 files changed, 84 insertions(+), 12 deletions(-) diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json b/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json index 441b9e14fb..a942260af1 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json @@ -70,5 +70,11 @@ "Generating manifest...": "", "Generating plugin...": "", "Re-generating client...": "", - "Re-generating plugin...": "" + "Re-generating plugin...": "", + "Please migrate your API clients to Kiota workspace.":"", + "Remind me later":"", + "Migrating API clients...":"", + "Migration completed, but no changes were detected.":"", + "Migration failed":"", + "Api clients migrated successfully!":"" } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.cs.json b/vscode/microsoft-kiota/l10n/bundle.l10n.cs.json index 108bae1484..46568a1325 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.cs.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.cs.json @@ -70,5 +70,11 @@ "Generating manifest...": "Generování manifestu...", "Generating plugin...": "Generování pluginu...", "Re-generating client...": "Opětovné generování klienta...", - "Re-generating plugin...": "Opětovné generování pluginu..." + "Re-generating plugin...": "Opětovné generování pluginu...", + "Please migrate your API clients to Kiota workspace.":"", + "Remind me later":"", + "Migrating API clients...":"", + "Migration completed, but no changes were detected.":"", + "Migration failed":"", + "Api clients migrated successfully!":"" } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.es.json b/vscode/microsoft-kiota/l10n/bundle.l10n.es.json index 417be3b3d3..b3b3c66161 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.es.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.es.json @@ -70,5 +70,11 @@ "Generating manifest...": "Generando manifesto...", "Generating plugin...": "Generando plugin...", "Re-generating client...": "Re-generando cliente...", - "Re-generating plugin...": "Re-generando plugin..." + "Re-generating plugin...": "Re-generando plugin...", + "Please migrate your API clients to Kiota workspace.":"", + "Remind me later":"", + "Migrating API clients...":"", + "Migration completed, but no changes were detected.":"", + "Migration failed":"", + "Api clients migrated successfully!":"" } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json b/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json index e639041a90..5cb0d28015 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json @@ -70,5 +70,11 @@ "Generating manifest...": "Génération du manifeste...", "Generating plugin...": "Génération du composant...", "Re-generating client...": "Rafraichissement du client...", - "Re-generating plugin...": "Refraichissement du composant..." + "Re-generating plugin...": "Refraichissement du composant...", + "Please migrate your API clients to Kiota workspace.":"", + "Remind me later":"", + "Migrating API clients...":"", + "Migration completed, but no changes were detected.":"", + "Migration failed":"", + "Api clients migrated successfully!":"" } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.it.json b/vscode/microsoft-kiota/l10n/bundle.l10n.it.json index b10609f433..1cefc74446 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.it.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.it.json @@ -70,5 +70,11 @@ "Generating manifest...": "Generando il manifest...", "Generating plugin...": "Generando il plugin...", "Re-generating client...": "Ri-generando il client...", - "Re-generating plugin...": "Ri-generando il plugin..." + "Re-generating plugin...": "Ri-generando il plugin...", + "Please migrate your API clients to Kiota workspace.":"", + "Remind me later":"", + "Migrating API clients...":"", + "Migration completed, but no changes were detected.":"", + "Migration failed":"", + "Api clients migrated successfully!":"" } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json b/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json index e248530e02..3628b1e377 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json @@ -70,5 +70,11 @@ "Generating manifest...": "", "Generating plugin...": "", "Re-generating client...": "", - "Re-generating plugin...": "" + "Re-generating plugin...": "", + "Please migrate your API clients to Kiota workspace.":"", + "Remind me later":"", + "Migrating API clients...":"", + "Migration completed, but no changes were detected.":"", + "Migration failed":"", + "Api clients migrated successfully!":"" } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.pl.json b/vscode/microsoft-kiota/l10n/bundle.l10n.pl.json index 828b872e19..e70195c4a0 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.pl.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.pl.json @@ -70,5 +70,11 @@ "Generating manifest...": "Generowanie manifestu...", "Generating plugin...": "Generowanie wtyczki", "Re-generating client...": "Ponowne generowanie klienta...", - "Re-generating plugin...": "Ponowne generowanie wtyczki..." + "Re-generating plugin...": "Ponowne generowanie wtyczki...", + "Please migrate your API clients to Kiota workspace.":"", + "Remind me later":"", + "Migrating API clients...":"", + "Migration completed, but no changes were detected.":"", + "Migration failed":"", + "Api clients migrated successfully!":"" } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json b/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json index 7f9a96542f..fed15fecc8 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json @@ -70,5 +70,11 @@ "Generating manifest...": "Gerando o manifesto...", "Generating plugin...": "Gerando o plugin...", "Re-generating client...": "Regerando o cliente...", - "Re-generating plugin...": "Regerando o plugin..." + "Re-generating plugin...": "Regerando o plugin...", + "Please migrate your API clients to Kiota workspace.":"", + "Remind me later":"", + "Migrating API clients...":"", + "Migration completed, but no changes were detected.":"", + "Migration failed":"", + "Api clients migrated successfully!":"" } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json b/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json index 031b80012c..c6da48ec1c 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json @@ -69,5 +69,11 @@ "Generating manifest...": "Генерация манифеста...", "Generating plugin...": "Генерация плагина...", "Re-generating client...": "Перегенерация клиента...", - "Re-generating plugin...": "Перегенерация плагина..." + "Re-generating plugin...": "Перегенерация плагина...", + "Please migrate your API clients to Kiota workspace.":"", + "Remind me later":"", + "Migrating API clients...":"", + "Migration completed, but no changes were detected.":"", + "Migration failed":"", + "Api clients migrated successfully!":"" } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json b/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json index 1d1613baa8..070c228d06 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json @@ -70,5 +70,11 @@ "Generating manifest...": "Inatengeneza dhariri..", "Generating plugin...": "Inatengeneza programu-jalizi...", "Re-generating client...": "Inatengeneza mteja upya...", - "Re-generating plugin...": "Inatengeneza programu-jalizi upya ..." + "Re-generating plugin...": "Inatengeneza programu-jalizi upya ...", + "Please migrate your API clients to Kiota workspace.":"", + "Remind me later":"", + "Migrating API clients...":"", + "Migration completed, but no changes were detected.":"", + "Migration failed":"", + "Api client migrateds successfully!":"" } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json b/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json index 1db954277f..03018b2928 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json @@ -70,5 +70,11 @@ "Generating manifest...": "", "Generating plugin...": "", "Re-generating client...": "", - "Re-generating plugin...": "" + "Re-generating plugin...": "", + "Please migrate your API clients to Kiota workspace.":"", + "Remind me later":"", + "Migrating API clients...":"", + "Migration completed, but no changes were detected.":"", + "Migration failed":"", + "Api clients migrated successfully!":"" } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json b/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json index ffc8d9e7ec..b0cfc5fc47 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json @@ -69,5 +69,11 @@ "Generating manifest...": "正在生成清单...", "Generating plugin...": "正在生成插件...", "Re-generating client...": "重新生成客户端...", - "Re-generating plugin...": "正在重新生成插件..." + "Re-generating plugin...": "正在重新生成插件...", + "Please migrate your API clients to Kiota workspace.":"", + "Remind me later":"", + "Migrating API clients...":"", + "Migration completed, but no changes were detected.":"", + "Migration failed":"", + "Api clients migrated successfully!":"" } From 4fa93b9529b910430e95919da664969161bf9251 Mon Sep 17 00:00:00 2001 From: ElinorW Date: Wed, 14 Aug 2024 13:30:31 +0300 Subject: [PATCH 05/11] extract function and add contextual menu --- vscode/microsoft-kiota/package.json | 17 +++++++++++ vscode/microsoft-kiota/src/extension.ts | 38 +++++++++---------------- vscode/microsoft-kiota/src/util.ts | 28 ++++++++++++++++++ 3 files changed, 58 insertions(+), 25 deletions(-) diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index d8b1eb9652..1c95006df8 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -234,6 +234,11 @@ "command": "kiota.selectLock", "group": "2_kiota@1", "when": "resourceLangId == json && resourceFilename =~ /workspace\\.json$/" + }, + { + "command": "kiota.migrateFromLockFile", + "when": "resourceExtname == .json && resourceFilename == kiota-lock.json", + "group": "navigation" } ], "view/title": [ @@ -315,6 +320,13 @@ "command": "kiota.openApiExplorer.removeAllFromSelectedEndpoints", "when": "false" } + ], + "editor/context": [ + { + "command": "kiota.migrateFromLockFile", + "when": "resourceExtname == .json && resourceFilename == kiota-lock.json", + "group": "navigation" + } ] }, "commands": [ @@ -413,7 +425,12 @@ { "command": "kiota.workspace.refresh", "title": "%kiota.openApiExplorer.refresh.title%" + }, + { + "command": "kiota.migrateFromLockFile", + "title": "%kiota.migrateClients.title%" } + ], "languages": [ { diff --git a/vscode/microsoft-kiota/src/extension.ts b/vscode/microsoft-kiota/src/extension.ts index 5a40342ec6..15c73880cc 100644 --- a/vscode/microsoft-kiota/src/extension.ts +++ b/vscode/microsoft-kiota/src/extension.ts @@ -29,8 +29,7 @@ import { loadTreeView } from "./workspaceTreeProvider"; import { generatePlugin } from "./generatePlugin"; import { CodeLensProvider } from "./codelensProvider"; import { KIOTA_WORKSPACE_FILE, REMIND_ME_LATER_FLAG, dependenciesInfo, extensionId, statusBarCommandId, treeViewFocusCommand, treeViewId } from "./constants"; -import { getWorkspaceJsonDirectory, getWorkspaceJsonPath, isClientType, isPluginType, updateTreeViewIcons } from "./util"; -import { displayMigrationMessages, migrateFromLockFile } from "./migrateFromLockFile"; +import { getWorkspaceJsonDirectory, getWorkspaceJsonPath, handleMigration, isClientType, isPluginType, updateTreeViewIcons } from "./util"; let kiotaStatusBarItem: vscode.StatusBarItem; let kiotaOutputChannel: vscode.LogOutputChannel; @@ -73,28 +72,7 @@ export async function activate( if (result === vscode.l10n.t("OK")) { await context.globalState.update(REMIND_ME_LATER_FLAG, false); - - vscode.window.withProgress({ - location: vscode.ProgressLocation.Notification, - title: vscode.l10n.t("Migrating API clients..."), - cancellable: false - }, async (progress) => { - progress.report({ increment: 0 }); - - try { - const migrationResult = await migrateFromLockFile(context, workspaceFolders![0].uri.fsPath); - - progress.report({ increment: 100 }); - - if (migrationResult && migrationResult.length > 0) { - displayMigrationMessages(migrationResult); - } else { - vscode.window.showWarningMessage(vscode.l10n.t("Migration completed, but no changes were detected.")); - } - } catch (error) { - vscode.window.showErrorMessage(vscode.l10n.t(`Migration failed: ${error}`)); - } - }); + await handleMigration(context, workspaceFolders![0]); } else if (result === vscode.l10n.t("Remind me later")) { await context.globalState.update(REMIND_ME_LATER_FLAG, true); } @@ -336,7 +314,17 @@ export async function activate( await regeneratePlugin(clientKey, clientObject, settings); } }), - ); + registerCommandWithTelemetry(reporter, `${extensionId}.migrateFromLockFile`, async (uri: vscode.Uri) => { + const workspaceFolder = vscode.workspace.getWorkspaceFolder(uri); + + if (!workspaceFolder) { + vscode.window.showErrorMessage(vscode.l10n.t("Could not determine the workspace folder.")); + return; + } + + await handleMigration(context, workspaceFolder); + }) +); async function generateManifestAndRefreshUI(config: Partial, settings: ExtensionSettings, outputPath: string, selectedPaths: string[]):Promise { const pluginTypes = KiotaPluginType.ApiManifest; diff --git a/vscode/microsoft-kiota/src/util.ts b/vscode/microsoft-kiota/src/util.ts index 087dc03fde..09b958230e 100644 --- a/vscode/microsoft-kiota/src/util.ts +++ b/vscode/microsoft-kiota/src/util.ts @@ -2,6 +2,7 @@ import * as vscode from 'vscode'; import * as path from 'path'; import * as fs from 'fs'; import { APIMANIFEST, CLIENT, CLIENTS, KIOTA_DIRECTORY, KIOTA_WORKSPACE_FILE, PLUGIN, PLUGINS } from './constants'; +import { migrateFromLockFile, displayMigrationMessages } from './migrateFromLockFile'; const clientTypes = [CLIENT, CLIENTS]; const pluginTypes = [PLUGIN, PLUGINS, APIMANIFEST]; @@ -66,4 +67,31 @@ export function findAppPackageDirectory(directory: string): string | null { } return null; +} + +export async function handleMigration( + context: vscode.ExtensionContext, + workspaceFolder: vscode.WorkspaceFolder +): Promise { + vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: vscode.l10n.t("Migrating API clients..."), + cancellable: false + }, async (progress) => { + progress.report({ increment: 0 }); + + try { + const migrationResult = await migrateFromLockFile(context, workspaceFolder.uri.fsPath); + + progress.report({ increment: 100 }); + + if (migrationResult && migrationResult.length > 0) { + displayMigrationMessages(migrationResult); + } else { + vscode.window.showWarningMessage(vscode.l10n.t("Migration completed, but no changes were detected.")); + } + } catch (error) { + vscode.window.showErrorMessage(vscode.l10n.t(`Migration failed: ${error}`)); + } + }); } \ No newline at end of file From 955df3fa120ada7ea91d9733b6124886651a45de Mon Sep 17 00:00:00 2001 From: ElinorW Date: Wed, 14 Aug 2024 13:30:43 +0300 Subject: [PATCH 06/11] update translations --- vscode/microsoft-kiota/l10n/bundle.l10n.ar.json | 3 ++- vscode/microsoft-kiota/l10n/bundle.l10n.cs.json | 3 ++- vscode/microsoft-kiota/l10n/bundle.l10n.es.json | 3 ++- vscode/microsoft-kiota/l10n/bundle.l10n.fr.json | 3 ++- vscode/microsoft-kiota/l10n/bundle.l10n.it.json | 3 ++- vscode/microsoft-kiota/l10n/bundle.l10n.ja.json | 3 ++- vscode/microsoft-kiota/l10n/bundle.l10n.pl.json | 3 ++- vscode/microsoft-kiota/l10n/bundle.l10n.pt.json | 3 ++- vscode/microsoft-kiota/l10n/bundle.l10n.ru.json | 3 ++- vscode/microsoft-kiota/l10n/bundle.l10n.sw.json | 3 ++- vscode/microsoft-kiota/l10n/bundle.l10n.tr.json | 3 ++- .../microsoft-kiota/l10n/bundle.l10n.zh-cn.json | 3 ++- vscode/microsoft-kiota/package.nls.ar.json | 3 ++- vscode/microsoft-kiota/package.nls.cs.json | 3 ++- vscode/microsoft-kiota/package.nls.es.json | 4 +++- vscode/microsoft-kiota/package.nls.fr.json | 4 +++- vscode/microsoft-kiota/package.nls.it.json | 4 +++- vscode/microsoft-kiota/package.nls.ja.json | 8 +++++--- vscode/microsoft-kiota/package.nls.json | 3 ++- vscode/microsoft-kiota/package.nls.pl.json | 8 +++++--- vscode/microsoft-kiota/package.nls.pt.json | 4 +++- vscode/microsoft-kiota/package.nls.ru.json | 16 +++++++++++++++- vscode/microsoft-kiota/package.nls.sw.json | 4 +++- vscode/microsoft-kiota/package.nls.tr.json | 8 +++++--- 24 files changed, 75 insertions(+), 30 deletions(-) diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json b/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json index a942260af1..3aa21048f2 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json @@ -76,5 +76,6 @@ "Migrating API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", - "Api clients migrated successfully!":"" + "Api clients migrated successfully!":"", + "Could not determine the workspace folder.": "لا يمكن تحديد مجلد مساحة العمل." } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.cs.json b/vscode/microsoft-kiota/l10n/bundle.l10n.cs.json index 46568a1325..fd7646e989 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.cs.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.cs.json @@ -76,5 +76,6 @@ "Migrating API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", - "Api clients migrated successfully!":"" + "Api clients migrated successfully!":"", + "Could not determine the workspace folder.": "Nepodařilo se určit složku pracovního prostoru." } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.es.json b/vscode/microsoft-kiota/l10n/bundle.l10n.es.json index b3b3c66161..f3a8e41bb4 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.es.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.es.json @@ -76,5 +76,6 @@ "Migrating API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", - "Api clients migrated successfully!":"" + "Api clients migrated successfully!":"", + "Could not determine the workspace folder.": "No se pudo determinar la carpeta de espacio de trabajo." } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json b/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json index 5cb0d28015..07a7b196fc 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json @@ -76,5 +76,6 @@ "Migrating API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", - "Api clients migrated successfully!":"" + "Api clients migrated successfully!":"", + "Could not determine the workspace folder.": "Impossible de déterminer le dossier de l'espace de travail." } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.it.json b/vscode/microsoft-kiota/l10n/bundle.l10n.it.json index 1cefc74446..d11c21d2f0 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.it.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.it.json @@ -76,5 +76,6 @@ "Migrating API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", - "Api clients migrated successfully!":"" + "Api clients migrated successfully!":"", + "Could not determine the workspace folder.": "Impossibile determinare la cartella di lavoro." } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json b/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json index 3628b1e377..0280b59f13 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json @@ -76,5 +76,6 @@ "Migrating API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", - "Api clients migrated successfully!":"" + "Api clients migrated successfully!":"", + "Could not determine the workspace folder.": "ワークスペースフォルダを特定できませんでした。" } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.pl.json b/vscode/microsoft-kiota/l10n/bundle.l10n.pl.json index e70195c4a0..3d3f5d915b 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.pl.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.pl.json @@ -76,5 +76,6 @@ "Migrating API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", - "Api clients migrated successfully!":"" + "Api clients migrated successfully!":"", + "Could not determine the workspace folder.": "Nie można określić folderu przestrzeni roboczej." } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json b/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json index fed15fecc8..1a9188c76a 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json @@ -76,5 +76,6 @@ "Migrating API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", - "Api clients migrated successfully!":"" + "Api clients migrated successfully!":"", + "Could not determine the workspace folder.": "Não foi possível determinar a pasta de trabalho." } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json b/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json index c6da48ec1c..c0cc536be5 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json @@ -75,5 +75,6 @@ "Migrating API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", - "Api clients migrated successfully!":"" + "Api clients migrated successfully!":"", + "Could not determine the workspace folder.": "Не удалось определить папку рабочего пространства." } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json b/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json index 070c228d06..14597f691e 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json @@ -76,5 +76,6 @@ "Migrating API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", - "Api client migrateds successfully!":"" + "Api client migrateds successfully!":"", + "Could not determine the workspace folder.": "Haiwezekani kubaini folda ya kazi." } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json b/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json index 03018b2928..74e42175c9 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json @@ -76,5 +76,6 @@ "Migrating API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", - "Api clients migrated successfully!":"" + "Api clients migrated successfully!":"", + "Could not determine the workspace folder.": "" } diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json b/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json index b0cfc5fc47..22190e759d 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json @@ -75,5 +75,6 @@ "Migrating API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", - "Api clients migrated successfully!":"" + "Api clients migrated successfully!":"", + "Could not determine the workspace folder.": "无法确定工作区文件夹" } diff --git a/vscode/microsoft-kiota/package.nls.ar.json b/vscode/microsoft-kiota/package.nls.ar.json index 8f80d7c77a..fc42890243 100644 --- a/vscode/microsoft-kiota/package.nls.ar.json +++ b/vscode/microsoft-kiota/package.nls.ar.json @@ -28,5 +28,6 @@ "kiota.generate.includeAdditionalData.description": "سيتم تضمين خاصية 'Additional Data' للنماذج", "kiota.workspace.name": "", "kiota.openApiExplorer.regenerateButton.title": "", - "kiota.openApiExplorer.editPaths.title": "" + "kiota.openApiExplorer.editPaths.title": "", + "kiota.migrateClients.title": "" } diff --git a/vscode/microsoft-kiota/package.nls.cs.json b/vscode/microsoft-kiota/package.nls.cs.json index eebfa55d3d..f010aeb6f0 100644 --- a/vscode/microsoft-kiota/package.nls.cs.json +++ b/vscode/microsoft-kiota/package.nls.cs.json @@ -28,5 +28,6 @@ "kiota.generate.includeAdditionalData.description": "Bude zahrnuta vlastnost 'AdditionalData' pro modely", "kiota.workspace.name": "Můj pracovní prostor", "kiota.openApiExplorer.regenerateButton.title": "Znovu vygenerovat", - "kiota.openApiExplorer.editPaths.title": "Upravit cesty" + "kiota.openApiExplorer.editPaths.title": "Upravit cesty", + "kiota.migrateClients.title": "Migrovat API klienty" } diff --git a/vscode/microsoft-kiota/package.nls.es.json b/vscode/microsoft-kiota/package.nls.es.json index 60a2d1fdaa..2265e8f1a2 100644 --- a/vscode/microsoft-kiota/package.nls.es.json +++ b/vscode/microsoft-kiota/package.nls.es.json @@ -28,5 +28,7 @@ "kiota.generate.includeAdditionalData.description": "Incluirá la propiedad 'AdditionalData' para modelos.", "kiota.workspace.name": "Mi espacio de trabajo", "kiota.openApiExplorer.regenerateButton.title": "Re-generar", - "kiota.openApiExplorer.editPaths.title": "Editar ruta de acceso" + "kiota.openApiExplorer.editPaths.title": "Editar ruta de acceso", + "kiota.openApiExplorer.refresh.title": "Actualizar", + "kiota.migrateClients.title": "Migrar clientes del API" } diff --git a/vscode/microsoft-kiota/package.nls.fr.json b/vscode/microsoft-kiota/package.nls.fr.json index 6fc8376876..a21a66347a 100644 --- a/vscode/microsoft-kiota/package.nls.fr.json +++ b/vscode/microsoft-kiota/package.nls.fr.json @@ -28,5 +28,7 @@ "kiota.generate.includeAdditionalData.description": "Incluera la propriété 'AdditionalData' pour les modèles générés.", "kiota.workspace.name": "Mon espace de travail", "kiota.openApiExplorer.regenerateButton.title": "Générer de nouveau", - "kiota.openApiExplorer.editPaths.title": "Modifier les chemins" + "kiota.openApiExplorer.editPaths.title": "Modifier les chemins", + "kiota.openApiExplorer.refresh.title": "Rafraîchir", + "kiota.migrateClients.title": "Migrer les clients d'API" } diff --git a/vscode/microsoft-kiota/package.nls.it.json b/vscode/microsoft-kiota/package.nls.it.json index ac68bf7ec4..7f7155d26a 100644 --- a/vscode/microsoft-kiota/package.nls.it.json +++ b/vscode/microsoft-kiota/package.nls.it.json @@ -28,5 +28,7 @@ "kiota.generate.includeAdditionalData.description": "Includerà la proprietà 'AdditionalData' per i modelli", "kiota.workspace.name": "Il mio spazio di lavoro", "kiota.openApiExplorer.regenerateButton.title": "Rigener", - "kiota.openApiExplorer.editPaths.title": "Modifica i percorsi" + "kiota.openApiExplorer.editPaths.title": "Modifica i percorsi", + "kiota.openApiExplorer.refresh.title": "Aggiorna", + "kiota.migrateClients.title": "Migra i client API" } diff --git a/vscode/microsoft-kiota/package.nls.ja.json b/vscode/microsoft-kiota/package.nls.ja.json index 20e515b42a..9a6efa3282 100644 --- a/vscode/microsoft-kiota/package.nls.ja.json +++ b/vscode/microsoft-kiota/package.nls.ja.json @@ -26,7 +26,9 @@ "kiota.generate.deserializer.description": "デシリアライザの完全修飾クラス名", "kiota.generate.structuredMimeTypes.description": "構造化データモデル生成に使用するMIMEタイプと設定(RFC 9110のAcceptヘッダー表記)", "kiota.generate.includeAdditionalData.description": "モデルのための“AdditionalData”プロパティを含める", - "kiota.workspace.name": "My Workspace", - "kiota.openApiExplorer.regenerateButton.title": "Re-generate", - "kiota.openApiExplorer.editPaths.title": "Edit paths" + "kiota.workspace.name": "ワークスペース", + "kiota.openApiExplorer.regenerateButton.title": "再生成", + "kiota.openApiExplorer.editPaths.title": "パスを編集", + "kiota.openApiExplorer.refresh.title": "リフレッシュ", + "kiota.migrateClients.title": "APIクライアントを移行" } diff --git a/vscode/microsoft-kiota/package.nls.json b/vscode/microsoft-kiota/package.nls.json index 00e54d3cb5..5c7baf619a 100644 --- a/vscode/microsoft-kiota/package.nls.json +++ b/vscode/microsoft-kiota/package.nls.json @@ -30,5 +30,6 @@ "kiota.workspace.name": "My Workspace", "kiota.openApiExplorer.regenerateButton.title": "Re-generate", "kiota.openApiExplorer.editPaths.title": "Edit paths", - "kiota.openApiExplorer.refresh.title": "Refresh" + "kiota.openApiExplorer.refresh.title": "Refresh", + "kiota.migrateClients.title": "Migrate API clients" } diff --git a/vscode/microsoft-kiota/package.nls.pl.json b/vscode/microsoft-kiota/package.nls.pl.json index db57de062a..91b4870fb8 100644 --- a/vscode/microsoft-kiota/package.nls.pl.json +++ b/vscode/microsoft-kiota/package.nls.pl.json @@ -27,7 +27,9 @@ "kiota.generate.deserializer.description": "Pełne nazwy klas dla deserializatorów", "kiota.generate.structuredMimeTypes.description": "Typy MIME i preferencje do użycia dla generacji modeli danych strukturalnych. Zgodnie z notacją nagłówka Accept RFC9110.", "kiota.generate.includeAdditionalData.description": "Doda właściwości 'AdditionalData' do modeli", - "kiota.workspace.name": "My Workspace", - "kiota.openApiExplorer.regenerateButton.title": "Re-generate", - "kiota.openApiExplorer.editPaths.title": "Edit paths" + "kiota.workspace.name": "Moja przestrzeń robocza", + "kiota.openApiExplorer.regenerateButton.title": "Ponownie wygeneruj", + "kiota.openApiExplorer.editPaths.title": "Edytuj ścieżki", + "kiota.openApiExplorer.refresh.title": "Odśwież", + "kiota.migrateClients.title": "Migruj klientów API" } diff --git a/vscode/microsoft-kiota/package.nls.pt.json b/vscode/microsoft-kiota/package.nls.pt.json index 8128a1e643..76f1b780b8 100644 --- a/vscode/microsoft-kiota/package.nls.pt.json +++ b/vscode/microsoft-kiota/package.nls.pt.json @@ -28,5 +28,7 @@ "kiota.generate.includeAdditionalData.description": "Será incluído a propriedade 'AdditionalData' para modelos", "kiota.workspace.name": "Meu espaço de trabalho", "kiota.openApiExplorer.regenerateButton.title": "Gerar novamente", - "kiota.openApiExplorer.editPaths.title": "Modificar endpoints" + "kiota.openApiExplorer.editPaths.title": "Modificar endpoints", + "kiota.openApiExplorer.refresh.title": "Atualizar", + "kiota.migrateClients.title": "Migrar clientes de API" } diff --git a/vscode/microsoft-kiota/package.nls.ru.json b/vscode/microsoft-kiota/package.nls.ru.json index e5bde6083a..5e4db32ccc 100644 --- a/vscode/microsoft-kiota/package.nls.ru.json +++ b/vscode/microsoft-kiota/package.nls.ru.json @@ -16,5 +16,19 @@ "kiota.openApiExplorer.openDescription.title": "Открыть описание API", "kiota.searchLock.title": "Искать файл блокировки", "kiota.openApiExplorer.filterDescription.title": "Отфильтровать описание API", - "kiota.openApiExplorer.openDocumentationPage.title": "Открыть страницу документации" + "kiota.openApiExplorer.openDocumentationPage.title": "Открыть страницу документации", + "kiota.generate.backingStore.description": "Включить резервное хранилище для моделей", + "kiota.generate.excludeBackwardCompatible.description": "Исключить совместимые с предыдущими версиями и устаревшие активы из сгенерированного результата. Следует использовать для новых клиентов", + "kiota.cleanOutput.description": "Удалить все файлы из каталога вывода перед созданием файлов кода", + "kiota.generate.disabledValidationRules.description": "Правила проверки описания OpenAPI для отключения: \nDivergentResponseSchema\nGetWithBody\nInconsistentTypeFormatPair\nKnownAndNotSupportedFormats\nMissingDiscriminator\nMultipleServerEntries\nNoContentWithBody\nNoServerEntry\nUrlFormEncodedComplex\nValidationRuleSetExtensions\nAll", + "kiota.clearCache.description": "Очистить любые кэшированные данные", + "kiota.generate.serializer.description": "Полностью квалифицированные имена классов для сериализаторов", + "kiota.generate.deserializer.description": "Полностью квалифицированные имена классов для десериализаторов", + "kiota.generate.structuredMimeTypes.description": "Типы MIME и предпочтения для использования при создании структурированных моделей данных. Согласно нотации заголовка Accept RFC9110.", + "kiota.generate.includeAdditionalData.description": "Будет включено свойство 'Дополнительные данные' для моделей", + "kiota.workspace.name": "Мое рабочее пространство", + "kiota.openApiExplorer.regenerateButton.title": "Пересоздать", + "kiota.openApiExplorer.editPaths.title": "Изменить пути", + "kiota.openApiExplorer.refresh.title": "Обновить", + "kiota.migrateClients.title": "Перенести API-клиенты" } diff --git a/vscode/microsoft-kiota/package.nls.sw.json b/vscode/microsoft-kiota/package.nls.sw.json index 254f2975c7..b4946bacb8 100644 --- a/vscode/microsoft-kiota/package.nls.sw.json +++ b/vscode/microsoft-kiota/package.nls.sw.json @@ -20,5 +20,7 @@ "kiota.openApiExplorer.openFile.title": "fungua faili", "kiota.workspace.name": "Mahali pa kazi yangu", "kiota.openApiExplorer.regenerateButton.title": "Kuunda upya", - "kiota.openApiExplorer.editPaths.title": "Hariri pointi za mwisho" + "kiota.openApiExplorer.editPaths.title": "Hariri pointi za mwisho", + "kiota.openApiExplorer.refresh.title": "Sasisha", + "kiota.migrateClients.title": "Hamisha wateja wa API" } diff --git a/vscode/microsoft-kiota/package.nls.tr.json b/vscode/microsoft-kiota/package.nls.tr.json index 04006690ea..2956d11157 100644 --- a/vscode/microsoft-kiota/package.nls.tr.json +++ b/vscode/microsoft-kiota/package.nls.tr.json @@ -26,7 +26,9 @@ "kiota.generate.deserializer.description": "Seri durumdan çıkarma işlemleri için tam nitelikli sınıf adları", "kiota.generate.structuredMimeTypes.description": "Yapılandırılmış veri modeli oluşturmak için kullanılacak MIME türleri ve tercihi. RFC9110'a göre Başlık gösterimini kabul et.", "kiota.generate.includeAdditionalData.description": "Modeller için 'AdditionalData' özelliğini içerecektir", - "kiota.workspace.name": "My Workspace", - "kiota.openApiExplorer.regenerateButton.title": "Re-generate", - "kiota.openApiExplorer.editPaths.title": "Edit paths" + "kiota.workspace.name": "Çalışma Alanım", + "kiota.openApiExplorer.regenerateButton.title": "Yeniden oluştur", + "kiota.openApiExplorer.editPaths.title": "Yolları düzenle", + "kiota.openApiExplorer.refresh.title": "Yenile", + "kiota.migrateClients.title": "API istemcilerini taşı" } From 94d4999b19b6c2d8f60b0f7bf8833eede5155692 Mon Sep 17 00:00:00 2001 From: ElinorW Date: Wed, 14 Aug 2024 13:38:45 +0300 Subject: [PATCH 07/11] update lockfile check --- vscode/microsoft-kiota/src/constants.ts | 1 + vscode/microsoft-kiota/src/extension.ts | 30 ++++++++++++++----------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/vscode/microsoft-kiota/src/constants.ts b/vscode/microsoft-kiota/src/constants.ts index fa467dc88c..cade17dacd 100644 --- a/vscode/microsoft-kiota/src/constants.ts +++ b/vscode/microsoft-kiota/src/constants.ts @@ -4,6 +4,7 @@ export const statusBarCommandId = `${extensionId}.status`; export const treeViewId = `${extensionId}.openApiExplorer`; export const treeViewFocusCommand = `${treeViewId}${focusCommandId}`; export const dependenciesInfo = `${extensionId}.dependenciesInfo`; +export const KIOTA_LOCK_FILE = "kiota-lock,json"; export const KIOTA_WORKSPACE_FILE = "workspace.json"; export const KIOTA_DIRECTORY = '.kiota'; export const CLIENTS = "clients"; diff --git a/vscode/microsoft-kiota/src/extension.ts b/vscode/microsoft-kiota/src/extension.ts index 15c73880cc..9a24516279 100644 --- a/vscode/microsoft-kiota/src/extension.ts +++ b/vscode/microsoft-kiota/src/extension.ts @@ -28,7 +28,7 @@ import { ExtensionSettings, getExtensionSettings } from "./extensionSettings"; import { loadTreeView } from "./workspaceTreeProvider"; import { generatePlugin } from "./generatePlugin"; import { CodeLensProvider } from "./codelensProvider"; -import { KIOTA_WORKSPACE_FILE, REMIND_ME_LATER_FLAG, dependenciesInfo, extensionId, statusBarCommandId, treeViewFocusCommand, treeViewId } from "./constants"; +import { KIOTA_LOCK_FILE, KIOTA_WORKSPACE_FILE, REMIND_ME_LATER_FLAG, dependenciesInfo, extensionId, statusBarCommandId, treeViewFocusCommand, treeViewId } from "./constants"; import { getWorkspaceJsonDirectory, getWorkspaceJsonPath, handleMigration, isClientType, isPluginType, updateTreeViewIcons } from "./util"; let kiotaStatusBarItem: vscode.StatusBarItem; @@ -63,20 +63,24 @@ export async function activate( const workspaceFolders = vscode.workspace.workspaceFolders; const remindMeLater = context.globalState.get(REMIND_ME_LATER_FLAG); - if (workspaceFolders || remindMeLater) { - const result = await vscode.window.showInformationMessage( - vscode.l10n.t("Please migrate your API clients to Kiota workspace."), - vscode.l10n.t("OK"), - vscode.l10n.t("Remind me later") - ); + if(workspaceFolders) { + const lockFile = await vscode.workspace.findFiles(`**/${KIOTA_LOCK_FILE}`); + + if (lockFile || remindMeLater) { + const result = await vscode.window.showInformationMessage( + vscode.l10n.t("Please migrate your API clients to Kiota workspace."), + vscode.l10n.t("OK"), + vscode.l10n.t("Remind me later") + ); - if (result === vscode.l10n.t("OK")) { - await context.globalState.update(REMIND_ME_LATER_FLAG, false); - await handleMigration(context, workspaceFolders![0]); - } else if (result === vscode.l10n.t("Remind me later")) { - await context.globalState.update(REMIND_ME_LATER_FLAG, true); + if (result === vscode.l10n.t("OK")) { + await context.globalState.update(REMIND_ME_LATER_FLAG, false); + await handleMigration(context, workspaceFolders![0]); + } else if (result === vscode.l10n.t("Remind me later")) { + await context.globalState.update(REMIND_ME_LATER_FLAG, true); + } } - } + } }; context.subscriptions.push( vscode.window.registerUriHandler({ From 081fdc1cb9c43faf57b142ab97a88ea1b7848a8d Mon Sep 17 00:00:00 2001 From: ElinorW Date: Wed, 14 Aug 2024 13:59:04 +0300 Subject: [PATCH 08/11] refactor code --- vscode/microsoft-kiota/src/extension.ts | 26 ++----------------- .../src/migrateFromLockFile.ts | 23 ++++++++++++++++ 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/vscode/microsoft-kiota/src/extension.ts b/vscode/microsoft-kiota/src/extension.ts index 9a24516279..c7cdc97884 100644 --- a/vscode/microsoft-kiota/src/extension.ts +++ b/vscode/microsoft-kiota/src/extension.ts @@ -28,8 +28,9 @@ import { ExtensionSettings, getExtensionSettings } from "./extensionSettings"; import { loadTreeView } from "./workspaceTreeProvider"; import { generatePlugin } from "./generatePlugin"; import { CodeLensProvider } from "./codelensProvider"; -import { KIOTA_LOCK_FILE, KIOTA_WORKSPACE_FILE, REMIND_ME_LATER_FLAG, dependenciesInfo, extensionId, statusBarCommandId, treeViewFocusCommand, treeViewId } from "./constants"; +import { KIOTA_WORKSPACE_FILE, dependenciesInfo, extensionId, statusBarCommandId, treeViewFocusCommand, treeViewId } from "./constants"; import { getWorkspaceJsonDirectory, getWorkspaceJsonPath, handleMigration, isClientType, isPluginType, updateTreeViewIcons } from "./util"; +import { checkForLockFileAndPrompt } from "./migrateFromLockFile"; let kiotaStatusBarItem: vscode.StatusBarItem; let kiotaOutputChannel: vscode.LogOutputChannel; @@ -59,29 +60,6 @@ export async function activate( await loadTreeView(context); await checkForLockFileAndPrompt(context); let codeLensProvider = new CodeLensProvider(); - async function checkForLockFileAndPrompt(context: vscode.ExtensionContext) { - const workspaceFolders = vscode.workspace.workspaceFolders; - const remindMeLater = context.globalState.get(REMIND_ME_LATER_FLAG); - - if(workspaceFolders) { - const lockFile = await vscode.workspace.findFiles(`**/${KIOTA_LOCK_FILE}`); - - if (lockFile || remindMeLater) { - const result = await vscode.window.showInformationMessage( - vscode.l10n.t("Please migrate your API clients to Kiota workspace."), - vscode.l10n.t("OK"), - vscode.l10n.t("Remind me later") - ); - - if (result === vscode.l10n.t("OK")) { - await context.globalState.update(REMIND_ME_LATER_FLAG, false); - await handleMigration(context, workspaceFolders![0]); - } else if (result === vscode.l10n.t("Remind me later")) { - await context.globalState.update(REMIND_ME_LATER_FLAG, true); - } - } - } - }; context.subscriptions.push( vscode.window.registerUriHandler({ handleUri: async (uri: vscode.Uri) => { diff --git a/vscode/microsoft-kiota/src/migrateFromLockFile.ts b/vscode/microsoft-kiota/src/migrateFromLockFile.ts index 4166e2e9a4..0622eefcd3 100644 --- a/vscode/microsoft-kiota/src/migrateFromLockFile.ts +++ b/vscode/microsoft-kiota/src/migrateFromLockFile.ts @@ -1,6 +1,8 @@ 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"; export function migrateFromLockFile(context: vscode.ExtensionContext, lockFileDirectory: string): Promise { return connectToKiota(context, async (connection) => { @@ -15,6 +17,27 @@ export function migrateFromLockFile(context: vscode.ExtensionContext, lockFileDi }); }; +export async function checkForLockFileAndPrompt(context: vscode.ExtensionContext) { + const workspaceFolders = vscode.workspace.workspaceFolders; + + if(workspaceFolders) { + const lockFile = await vscode.workspace.findFiles(`**/${KIOTA_LOCK_FILE}`); + + if (lockFile.length > 0) { + const result = await vscode.window.showInformationMessage( + vscode.l10n.t("Please migrate your API clients to Kiota workspace."), + vscode.l10n.t("OK"), + vscode.l10n.t("Remind me later") + ); + + if (result === vscode.l10n.t("OK")) { + await handleMigration(context, workspaceFolders![0]); + await vscode.commands.executeCommand('kiota.workspace.refresh'); + } + } + } + }; + export function displayMigrationMessages(logEntries: KiotaLogEntry[]) { const successEntries = logEntries.filter(entry => entry.level === LogLevel.information && entry.message.includes("migrated successfully") From 0fc542048cf36e0b5fa9be99680d2946b7717928 Mon Sep 17 00:00:00 2001 From: ElinorW Date: Wed, 14 Aug 2024 16:33:21 +0300 Subject: [PATCH 09/11] fix typo --- vscode/microsoft-kiota/src/constants.ts | 2 +- vscode/microsoft-kiota/src/migrateFromLockFile.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vscode/microsoft-kiota/src/constants.ts b/vscode/microsoft-kiota/src/constants.ts index cade17dacd..45c775da13 100644 --- a/vscode/microsoft-kiota/src/constants.ts +++ b/vscode/microsoft-kiota/src/constants.ts @@ -4,7 +4,7 @@ export const statusBarCommandId = `${extensionId}.status`; export const treeViewId = `${extensionId}.openApiExplorer`; export const treeViewFocusCommand = `${treeViewId}${focusCommandId}`; export const dependenciesInfo = `${extensionId}.dependenciesInfo`; -export const KIOTA_LOCK_FILE = "kiota-lock,json"; +export const KIOTA_LOCK_FILE = "kiota-lock.json"; export const KIOTA_WORKSPACE_FILE = "workspace.json"; export const KIOTA_DIRECTORY = '.kiota'; export const CLIENTS = "clients"; diff --git a/vscode/microsoft-kiota/src/migrateFromLockFile.ts b/vscode/microsoft-kiota/src/migrateFromLockFile.ts index 0622eefcd3..d0162eaa6f 100644 --- a/vscode/microsoft-kiota/src/migrateFromLockFile.ts +++ b/vscode/microsoft-kiota/src/migrateFromLockFile.ts @@ -21,7 +21,7 @@ export async function checkForLockFileAndPrompt(context: vscode.ExtensionContext const workspaceFolders = vscode.workspace.workspaceFolders; if(workspaceFolders) { - const lockFile = await vscode.workspace.findFiles(`**/${KIOTA_LOCK_FILE}`); + const lockFile = await vscode.workspace.findFiles(`{**/${KIOTA_LOCK_FILE},${KIOTA_LOCK_FILE}}`); if (lockFile.length > 0) { const result = await vscode.window.showInformationMessage( From c566afa86981e3c1141fcb9c1c40d943f52a9e19 Mon Sep 17 00:00:00 2001 From: ElinorW Date: Wed, 14 Aug 2024 16:42:29 +0300 Subject: [PATCH 10/11] update display message --- vscode/microsoft-kiota/l10n/bundle.l10n.ar.json | 2 +- vscode/microsoft-kiota/l10n/bundle.l10n.cs.json | 2 +- vscode/microsoft-kiota/l10n/bundle.l10n.es.json | 2 +- vscode/microsoft-kiota/l10n/bundle.l10n.fr.json | 2 +- vscode/microsoft-kiota/l10n/bundle.l10n.it.json | 2 +- vscode/microsoft-kiota/l10n/bundle.l10n.ja.json | 2 +- vscode/microsoft-kiota/l10n/bundle.l10n.pl.json | 2 +- vscode/microsoft-kiota/l10n/bundle.l10n.pt.json | 2 +- vscode/microsoft-kiota/l10n/bundle.l10n.ru.json | 2 +- vscode/microsoft-kiota/l10n/bundle.l10n.sw.json | 2 +- vscode/microsoft-kiota/l10n/bundle.l10n.tr.json | 2 +- vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json | 2 +- vscode/microsoft-kiota/src/util.ts | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json b/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json index 3aa21048f2..62293e9155 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.ar.json @@ -73,7 +73,7 @@ "Re-generating plugin...": "", "Please migrate your API clients to Kiota workspace.":"", "Remind me later":"", - "Migrating API clients...":"", + "Migrating your API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", "Api clients migrated successfully!":"", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.cs.json b/vscode/microsoft-kiota/l10n/bundle.l10n.cs.json index fd7646e989..399db84bfc 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.cs.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.cs.json @@ -73,7 +73,7 @@ "Re-generating plugin...": "Opětovné generování pluginu...", "Please migrate your API clients to Kiota workspace.":"", "Remind me later":"", - "Migrating API clients...":"", + "Migrating your API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", "Api clients migrated successfully!":"", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.es.json b/vscode/microsoft-kiota/l10n/bundle.l10n.es.json index f3a8e41bb4..92f9942590 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.es.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.es.json @@ -73,7 +73,7 @@ "Re-generating plugin...": "Re-generando plugin...", "Please migrate your API clients to Kiota workspace.":"", "Remind me later":"", - "Migrating API clients...":"", + "Migrating your API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", "Api clients migrated successfully!":"", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json b/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json index 07a7b196fc..68cb0b95a6 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.fr.json @@ -73,7 +73,7 @@ "Re-generating plugin...": "Refraichissement du composant...", "Please migrate your API clients to Kiota workspace.":"", "Remind me later":"", - "Migrating API clients...":"", + "Migrating your API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", "Api clients migrated successfully!":"", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.it.json b/vscode/microsoft-kiota/l10n/bundle.l10n.it.json index d11c21d2f0..e4c3c0e301 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.it.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.it.json @@ -73,7 +73,7 @@ "Re-generating plugin...": "Ri-generando il plugin...", "Please migrate your API clients to Kiota workspace.":"", "Remind me later":"", - "Migrating API clients...":"", + "Migrating your API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", "Api clients migrated successfully!":"", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json b/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json index 0280b59f13..a2f3b17c96 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.ja.json @@ -73,7 +73,7 @@ "Re-generating plugin...": "", "Please migrate your API clients to Kiota workspace.":"", "Remind me later":"", - "Migrating API clients...":"", + "Migrating your API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", "Api clients migrated successfully!":"", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.pl.json b/vscode/microsoft-kiota/l10n/bundle.l10n.pl.json index 3d3f5d915b..df0f952569 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.pl.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.pl.json @@ -73,7 +73,7 @@ "Re-generating plugin...": "Ponowne generowanie wtyczki...", "Please migrate your API clients to Kiota workspace.":"", "Remind me later":"", - "Migrating API clients...":"", + "Migrating your API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", "Api clients migrated successfully!":"", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json b/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json index 1a9188c76a..f7e2ce2e15 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.pt.json @@ -73,7 +73,7 @@ "Re-generating plugin...": "Regerando o plugin...", "Please migrate your API clients to Kiota workspace.":"", "Remind me later":"", - "Migrating API clients...":"", + "Migrating your API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", "Api clients migrated successfully!":"", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json b/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json index c0cc536be5..9b5e5c3145 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.ru.json @@ -72,7 +72,7 @@ "Re-generating plugin...": "Перегенерация плагина...", "Please migrate your API clients to Kiota workspace.":"", "Remind me later":"", - "Migrating API clients...":"", + "Migrating your API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", "Api clients migrated successfully!":"", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json b/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json index 14597f691e..e8f8e1e75a 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.sw.json @@ -73,7 +73,7 @@ "Re-generating plugin...": "Inatengeneza programu-jalizi upya ...", "Please migrate your API clients to Kiota workspace.":"", "Remind me later":"", - "Migrating API clients...":"", + "Migrating your API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", "Api client migrateds successfully!":"", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json b/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json index 74e42175c9..c252995721 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.tr.json @@ -73,7 +73,7 @@ "Re-generating plugin...": "", "Please migrate your API clients to Kiota workspace.":"", "Remind me later":"", - "Migrating API clients...":"", + "Migrating your API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", "Api clients migrated successfully!":"", diff --git a/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json b/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json index 22190e759d..fffd320503 100644 --- a/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json +++ b/vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json @@ -72,7 +72,7 @@ "Re-generating plugin...": "正在重新生成插件...", "Please migrate your API clients to Kiota workspace.":"", "Remind me later":"", - "Migrating API clients...":"", + "Migrating your API clients...":"", "Migration completed, but no changes were detected.":"", "Migration failed":"", "Api clients migrated successfully!":"", diff --git a/vscode/microsoft-kiota/src/util.ts b/vscode/microsoft-kiota/src/util.ts index 09b958230e..cd67dd6d35 100644 --- a/vscode/microsoft-kiota/src/util.ts +++ b/vscode/microsoft-kiota/src/util.ts @@ -75,7 +75,7 @@ export async function handleMigration( ): Promise { vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, - title: vscode.l10n.t("Migrating API clients..."), + title: vscode.l10n.t("Migrating your API clients..."), cancellable: false }, async (progress) => { progress.report({ increment: 0 }); From a90f2e2773d62d2fcd930a02bcae8cf00de88e15 Mon Sep 17 00:00:00 2001 From: ElinorW Date: Wed, 14 Aug 2024 17:57:57 +0300 Subject: [PATCH 11/11] add open workspace file command --- vscode/microsoft-kiota/src/migrateFromLockFile.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vscode/microsoft-kiota/src/migrateFromLockFile.ts b/vscode/microsoft-kiota/src/migrateFromLockFile.ts index d0162eaa6f..9c77d8dfd1 100644 --- a/vscode/microsoft-kiota/src/migrateFromLockFile.ts +++ b/vscode/microsoft-kiota/src/migrateFromLockFile.ts @@ -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 { return connectToKiota(context, async (connection) => { @@ -39,6 +39,7 @@ 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") ); @@ -46,6 +47,8 @@ export function displayMigrationMessages(logEntries: KiotaLogEntry[]) { 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 => {