Signed-off-by: Vincent Biret <vibiret@microsoft.com>
This commit is contained in:
Vincent Biret 2023-03-23 10:21:23 -04:00
Родитель 3615f253dc
Коммит dee7b8ba85
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 32426322EDFFB7E3
6 изменённых файлов: 193 добавлений и 171 удалений

Просмотреть файл

@ -1,9 +0,0 @@
# Change Log
All notable changes to the "microsoft-kiota" extension will be documented in this file.
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
## [Unreleased]
- Initial release

29
vscode/microsoft-kiota/package-lock.json сгенерированный
Просмотреть файл

@ -1,12 +1,12 @@
{
"name": "microsoft-kiota",
"version": "0.0.1",
"name": "kiota",
"version": "1.0.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "microsoft-kiota",
"version": "0.0.1",
"name": "kiota",
"version": "1.0.1",
"dependencies": {
"@vscode/l10n": "^0.0.11",
"vscode-jsonrpc": "^8.1.0"
@ -1557,20 +1557,6 @@
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true
},
"node_modules/fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@ -4586,13 +4572,6 @@
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true
},
"fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"optional": true
},
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",

Просмотреть файл

@ -1,14 +1,18 @@
{
"name": "microsoft-kiota",
"name": "kiota",
"displayName": "Microsoft Kiota",
"description": "REST API client generator based on OpenAPI",
"version": "0.0.1",
"version": "1.0.1",
"engines": {
"vscode": "^1.75.0"
},
"categories": [
"Other"
],
"repository": {
"url": "https://github.com/microsoft/kiota.git",
"type": "git"
},
"activationEvents": [
"onStartupFinished"
],
@ -34,18 +38,18 @@
"views": {
"kiota-openapi-explorer": [
{
"id": "microsoft-kiota.openApiExplorer",
"name": "%microsoft-kiota.openApiExplorer.name%",
"id": "kiota.openApiExplorer",
"name": "%kiota.openApiExplorer.name%",
"icon": "media/openapi.svg",
"contextualTitle": "%microsoft-kiota.openApiExplorer.contextualTitle%"
"contextualTitle": "%kiota.openApiExplorer.contextualTitle%"
}
],
"kiota-dependencies-info": [
{
"id": "microsoft-kiota.dependenciesInfo",
"name": "%microsoft-kiota.dependenciesInfo.name%",
"id": "kiota.dependenciesInfo",
"name": "%kiota.dependenciesInfo.name%",
"icon": "media/dependencies.svg",
"contextualTitle": "%microsoft-kiota.dependenciesInfo.contextualTitle%",
"contextualTitle": "%kiota.dependenciesInfo.contextualTitle%",
"type": "webview",
"visibility": "visible"
}
@ -54,127 +58,127 @@
"menus": {
"explorer/context": [
{
"command": "microsoft-kiota.selectLock",
"command": "kiota.selectLock",
"group": "2_kiota@1",
"when": "resourceLangId == json && resourceFilename =~ /kiota-lock\\.json$/"
}
],
"view/title": [
{
"command": "microsoft-kiota.searchApiDescription",
"when": "view == microsoft-kiota.openApiExplorer",
"command": "kiota.searchApiDescription",
"when": "view == kiota.openApiExplorer",
"group": "navigation"
},
{
"command": "microsoft-kiota.openApiExplorer.generateClient",
"when": "view == microsoft-kiota.openApiExplorer",
"command": "kiota.openApiExplorer.generateClient",
"when": "view == kiota.openApiExplorer",
"group": "navigation"
},
{
"command": "microsoft-kiota.openApiExplorer.closeDescription",
"when": "view == microsoft-kiota.openApiExplorer",
"command": "kiota.openApiExplorer.closeDescription",
"when": "view == kiota.openApiExplorer",
"group": "navigation"
}
],
"view/item/context": [
{
"command": "microsoft-kiota.openApiExplorer.addToSelectedEndpoints",
"when": "view == microsoft-kiota.openApiExplorer",
"command": "kiota.openApiExplorer.addToSelectedEndpoints",
"when": "view == kiota.openApiExplorer",
"group": "inline"
},
{
"command": "microsoft-kiota.openApiExplorer.addAllToSelectedEndpoints",
"when": "view == microsoft-kiota.openApiExplorer"
"command": "kiota.openApiExplorer.addAllToSelectedEndpoints",
"when": "view == kiota.openApiExplorer"
},
{
"command": "microsoft-kiota.openApiExplorer.removeFromSelectedEndpoints",
"when": "view == microsoft-kiota.openApiExplorer",
"command": "kiota.openApiExplorer.removeFromSelectedEndpoints",
"when": "view == kiota.openApiExplorer",
"group": "inline"
},
{
"command": "microsoft-kiota.openApiExplorer.removeAllFromSelectedEndpoints",
"when": "view == microsoft-kiota.openApiExplorer"
"command": "kiota.openApiExplorer.removeAllFromSelectedEndpoints",
"when": "view == kiota.openApiExplorer"
}
],
"commandPalette": [
{
"command": "microsoft-kiota.selectLock",
"command": "kiota.selectLock",
"when": "false"
},
{
"command": "microsoft-kiota.openApiExplorer.addToSelectedEndpoints",
"command": "kiota.openApiExplorer.addToSelectedEndpoints",
"when": "false"
},
{
"command": "microsoft-kiota.openApiExplorer.addAllToSelectedEndpoints",
"command": "kiota.openApiExplorer.addAllToSelectedEndpoints",
"when": "false"
},
{
"command": "microsoft-kiota.openApiExplorer.removeFromSelectedEndpoints",
"command": "kiota.openApiExplorer.removeFromSelectedEndpoints",
"when": "false"
},
{
"command": "microsoft-kiota.openApiExplorer.removeAllFromSelectedEndpoints",
"command": "kiota.openApiExplorer.removeAllFromSelectedEndpoints",
"when": "false"
}
]
},
"commands": [
{
"command": "microsoft-kiota.selectLock",
"command": "kiota.selectLock",
"category": "Kiota",
"title": "%microsoft-kiota.selectLock.title%",
"title": "%kiota.selectLock.title%",
"icon": "$(file-symlink-file)"
},
{
"command": "microsoft-kiota.updateClients",
"command": "kiota.updateClients",
"category": "Kiota",
"title": "%microsoft-kiota.updateClients.title%"
"title": "%kiota.updateClients.title%"
},
{
"command": "microsoft-kiota.openApiExplorer.generateClient",
"command": "kiota.openApiExplorer.generateClient",
"category": "Kiota",
"title": "%microsoft-kiota.openApiExplorer.generateClient.title%",
"title": "%kiota.openApiExplorer.generateClient.title%",
"icon": "$(play)"
},
{
"command": "microsoft-kiota.searchApiDescription",
"command": "kiota.searchApiDescription",
"category": "Kiota",
"title": "%microsoft-kiota.searchApiDescription.title%",
"title": "%kiota.searchApiDescription.title%",
"icon": "$(search)"
},
{
"command": "microsoft-kiota.openApiExplorer.addToSelectedEndpoints",
"command": "kiota.openApiExplorer.addToSelectedEndpoints",
"category": "Kiota",
"title": "%microsoft-kiota.openApiExplorer.addToSelectedEndpoints.title%",
"title": "%kiota.openApiExplorer.addToSelectedEndpoints.title%",
"icon": "$(add)"
},
{
"command": "microsoft-kiota.openApiExplorer.addAllToSelectedEndpoints",
"command": "kiota.openApiExplorer.addAllToSelectedEndpoints",
"category": "Kiota",
"title": "%microsoft-kiota.openApiExplorer.addAllToSelectedEndpoints.title%"
"title": "%kiota.openApiExplorer.addAllToSelectedEndpoints.title%"
},
{
"command": "microsoft-kiota.openApiExplorer.removeFromSelectedEndpoints",
"command": "kiota.openApiExplorer.removeFromSelectedEndpoints",
"category": "Kiota",
"title": "%microsoft-kiota.openApiExplorer.removeFromSelectedEndpoints.title%",
"title": "%kiota.openApiExplorer.removeFromSelectedEndpoints.title%",
"icon": "$(remove)"
},
{
"command": "microsoft-kiota.openApiExplorer.removeAllFromSelectedEndpoints",
"command": "kiota.openApiExplorer.removeAllFromSelectedEndpoints",
"category": "Kiota",
"title": "%microsoft-kiota.openApiExplorer.removeAllFromSelectedEndpoints.title%"
"title": "%kiota.openApiExplorer.removeAllFromSelectedEndpoints.title%"
},
{
"command": "microsoft-kiota.openApiExplorer.closeDescription",
"command": "kiota.openApiExplorer.closeDescription",
"category": "Kiota",
"title": "%microsoft-kiota.openApiExplorer.closeDescription.title%",
"title": "%kiota.openApiExplorer.closeDescription.title%",
"icon": "$(close)"
},
{
"command": "microsoft-kiota.openApiExplorer.openDescription",
"command": "kiota.openApiExplorer.openDescription",
"category": "Kiota",
"title": "%microsoft-kiota.openApiExplorer.openDescription.title%",
"title": "%kiota.openApiExplorer.openDescription.title%",
"icon": "$(go-to-file)"
}
]

Просмотреть файл

@ -1,18 +1,18 @@
{
"microsoft-kiota.dependenciesInfo.name": "Informations sur les dépendances Kiota",
"microsoft-kiota.dependenciesInfo.contextualTitle": "Information de dépendances",
"microsoft-kiota.openApiExplorer.name": "Explorateur OpenAPI Kiota",
"microsoft-kiota.openApiExplorer.contextualTitle": "Explorateur OpenAPI",
"kiota.dependenciesInfo.name": "Informations sur les dépendances Kiota",
"kiota.dependenciesInfo.contextualTitle": "Information de dépendances",
"kiota.openApiExplorer.name": "Explorateur OpenAPI Kiota",
"kiota.openApiExplorer.contextualTitle": "Explorateur OpenAPI",
"kiota-dependencies-info.panel.title": "Informations sur les dépendances Kiota",
"kiota-openapi-explorer.activitybar.title": "Explorateur OpenAPI Kiota",
"microsoft-kiota.selectLock.title": "Sélectionner pour la vue explorateur d'API",
"microsoft-kiota.updateClients.title": "Mettre à jour les clients d'API dans l'environment courant",
"microsoft-kiota.openApiExplorer.generateClient.title": "Générer le client d'API",
"microsoft-kiota.searchApiDescription.title": "Rechercher une description d'API",
"microsoft-kiota.openApiExplorer.addToSelectedEndpoints.title": "Ajouter",
"microsoft-kiota.openApiExplorer.removeFromSelectedEndpoints.title": "Supprimer",
"microsoft-kiota.openApiExplorer.addAllToSelectedEndpoints.title": "Tout ajouter",
"microsoft-kiota.openApiExplorer.removeAllFromSelectedEndpoints.title": "Tout supprimer",
"microsoft-kiota.openApiExplorer.closeDescription.title": "Fermer la description d'API",
"microsoft-kiota.openApiExplorer.openDescription.title": "Ouvrir une description d'API"
"kiota.selectLock.title": "Sélectionner pour la vue explorateur d'API",
"kiota.updateClients.title": "Mettre à jour les clients d'API dans l'environment courant",
"kiota.openApiExplorer.generateClient.title": "Générer le client d'API",
"kiota.searchApiDescription.title": "Rechercher une description d'API",
"kiota.openApiExplorer.addToSelectedEndpoints.title": "Ajouter",
"kiota.openApiExplorer.removeFromSelectedEndpoints.title": "Supprimer",
"kiota.openApiExplorer.addAllToSelectedEndpoints.title": "Tout ajouter",
"kiota.openApiExplorer.removeAllFromSelectedEndpoints.title": "Tout supprimer",
"kiota.openApiExplorer.closeDescription.title": "Fermer la description d'API",
"kiota.openApiExplorer.openDescription.title": "Ouvrir une description d'API"
}

Просмотреть файл

@ -1,18 +1,18 @@
{
"microsoft-kiota.dependenciesInfo.name": "Kiota Dependencies Information",
"microsoft-kiota.dependenciesInfo.contextualTitle": "Dependencies Information",
"microsoft-kiota.openApiExplorer.name": "Kiota OpenAPI Explorer",
"microsoft-kiota.openApiExplorer.contextualTitle": "OpenAPI Explorer",
"kiota.dependenciesInfo.name": "Kiota Dependencies Information",
"kiota.dependenciesInfo.contextualTitle": "Dependencies Information",
"kiota.openApiExplorer.name": "Kiota OpenAPI Explorer",
"kiota.openApiExplorer.contextualTitle": "OpenAPI Explorer",
"kiota-dependencies-info.panel.title": "Kiota Dependencies Information",
"kiota-openapi-explorer.activitybar.title": "Kiota OpenAPI Explorer",
"microsoft-kiota.selectLock.title": "Select lock file for API explorer view",
"microsoft-kiota.updateClients.title": "Update API clients in the current workspace",
"microsoft-kiota.openApiExplorer.generateClient.title": "Generate API client",
"microsoft-kiota.searchApiDescription.title": "Search for an API description",
"microsoft-kiota.openApiExplorer.addToSelectedEndpoints.title": "Add",
"microsoft-kiota.openApiExplorer.removeFromSelectedEndpoints.title": "Remove",
"microsoft-kiota.openApiExplorer.addAllToSelectedEndpoints.title": "Add all",
"microsoft-kiota.openApiExplorer.removeAllFromSelectedEndpoints.title": "Remove all",
"microsoft-kiota.openApiExplorer.closeDescription.title": "Close API description",
"microsoft-kiota.openApiExplorer.openDescription.title": "Open API description"
"kiota.selectLock.title": "Select lock file for API explorer view",
"kiota.updateClients.title": "Update API clients in the current workspace",
"kiota.openApiExplorer.generateClient.title": "Generate API client",
"kiota.searchApiDescription.title": "Search for an API description",
"kiota.openApiExplorer.addToSelectedEndpoints.title": "Add",
"kiota.openApiExplorer.removeFromSelectedEndpoints.title": "Remove",
"kiota.openApiExplorer.addAllToSelectedEndpoints.title": "Add all",
"kiota.openApiExplorer.removeAllFromSelectedEndpoints.title": "Remove all",
"kiota.openApiExplorer.closeDescription.title": "Close API description",
"kiota.openApiExplorer.openDescription.title": "Open API description"
}

Просмотреть файл

@ -3,7 +3,14 @@
import * as vscode from "vscode";
import * as rpc from "vscode-jsonrpc/node";
import { OpenApiTreeNode, OpenApiTreeProvider } from "./openApiTreeProvider";
import { connectToKiota, getLogEntriesForLevel, KiotaGenerationLanguage, KiotaLogEntry, LogLevel, parseGenerationLanguage } from "./kiotaInterop";
import {
connectToKiota,
getLogEntriesForLevel,
KiotaGenerationLanguage,
KiotaLogEntry,
LogLevel,
parseGenerationLanguage,
} from "./kiotaInterop";
import { generateSteps, openSteps, searchSteps } from "./steps";
import { getKiotaVersion } from "./getKiotaVersion";
import { searchDescription } from "./searchDescription";
@ -22,31 +29,39 @@ export async function activate(
kiotaOutputChannel = vscode.window.createOutputChannel("Kiota", {
log: true,
});
const extensionId = "microsoft-kiota";
const extensionId = "kiota";
const statusBarCommandId = `${extensionId}.status`;
const treeViewId = `${extensionId}.openApiExplorer`;
const dependenciesInfo = `${extensionId}.dependenciesInfo`;
const openApiTreeProvider = new OpenApiTreeProvider();
const dependenciesInfoProvider = new DependenciesViewProvider(context.extensionUri);
const dependenciesInfoProvider = new DependenciesViewProvider(
context.extensionUri
);
context.subscriptions.push(
vscode.commands.registerCommand(`${extensionId}.selectLock`, async (node: {fsPath: string}) => {
await openApiTreeProvider.loadLockFile(node.fsPath);
if(openApiTreeProvider.descriptionUrl) {
vscode.commands.executeCommand(`${treeViewId}.focus`);
vscode.commands.registerCommand(
`${extensionId}.selectLock`,
async (node: { fsPath: string }) => {
await openApiTreeProvider.loadLockFile(node.fsPath);
if (openApiTreeProvider.descriptionUrl) {
vscode.commands.executeCommand(`${treeViewId}.focus`);
}
}
}),
),
vscode.commands.registerCommand(statusBarCommandId, async () => {
const yesAnswer = vscode.l10n.t('Yes');
const yesAnswer = vscode.l10n.t("Yes");
const response = await vscode.window.showInformationMessage(
vscode.l10n.t('Open installation instructions for kiota?'),
vscode.l10n.t("Open installation instructions for kiota?"),
yesAnswer,
vscode.l10n.t('No')
vscode.l10n.t("No")
);
if (response === yesAnswer) {
vscode.env.openExternal(vscode.Uri.parse("https://aka.ms/get/kiota"));
}
}),
vscode.window.registerWebviewViewProvider(dependenciesInfo, dependenciesInfoProvider),
vscode.window.registerWebviewViewProvider(
dependenciesInfo,
dependenciesInfoProvider
),
vscode.window.registerTreeDataProvider(treeViewId, openApiTreeProvider),
vscode.commands.registerCommand(
`${treeViewId}.addToSelectedEndpoints`,
@ -70,7 +85,7 @@ export async function activate(
const selectedPaths = openApiTreeProvider.getSelectedPaths();
if (selectedPaths.length === 0) {
vscode.window.showErrorMessage(
vscode.l10n.t('No endpoints selected, select endpoints first')
vscode.l10n.t("No endpoints selected, select endpoints first")
);
return;
}
@ -79,76 +94,95 @@ export async function activate(
vscode.workspace.workspaceFolders.length === 0
) {
vscode.window.showErrorMessage(
vscode.l10n.t('No workspace folder found, open a folder first')
vscode.l10n.t("No workspace folder found, open a folder first")
);
return;
}
let languagesInformation = await getLanguageInformation();
const config = await generateSteps({
clientClassName: openApiTreeProvider.clientClassName,
clientNamespaceName: openApiTreeProvider.clientNamespaceName,
language: openApiTreeProvider.language,
outputPath: openApiTreeProvider.outputPath
},
const config = await generateSteps(
{
clientClassName: openApiTreeProvider.clientClassName,
clientNamespaceName: openApiTreeProvider.clientNamespaceName,
language: openApiTreeProvider.language,
outputPath: openApiTreeProvider.outputPath,
},
languagesInformation
);
if (!openApiTreeProvider.descriptionUrl) {
vscode.window.showErrorMessage(
vscode.l10n.t('No description found, select a description first')
vscode.l10n.t("No description found, select a description first")
);
return;
}
const language = typeof config.language === "string" ? parseGenerationLanguage(config.language) : KiotaGenerationLanguage.CSharp;
const language =
typeof config.language === "string"
? parseGenerationLanguage(config.language)
: KiotaGenerationLanguage.CSharp;
const result = await generateClient(
openApiTreeProvider.descriptionUrl,
typeof config.outputPath === "string" ? config.outputPath : './output',
typeof config.outputPath === "string"
? config.outputPath
: "./output",
language,
selectedPaths,
[],
typeof config.clientClassName === "string" ? config.clientClassName : 'ApiClient',
typeof config.clientNamespaceName === "string" ? config.clientNamespaceName : 'ApiSdk');
typeof config.clientClassName === "string"
? config.clientClassName
: "ApiClient",
typeof config.clientNamespaceName === "string"
? config.clientNamespaceName
: "ApiSdk"
);
const informationMessages = result ? getLogEntriesForLevel(result, LogLevel.information) : [];
const errorMessages = result ? getLogEntriesForLevel(result, LogLevel.critical, LogLevel.error) : [];
if (errorMessages.length > 0) {
errorMessages.forEach((element) => {
kiotaOutputChannel.error(element.message);
vscode.window.showErrorMessage(element.message);
});
} else {
informationMessages.forEach((element) => {
kiotaOutputChannel.info(element.message);
vscode.window.showInformationMessage(element.message);
});
}
languagesInformation = await getLanguageInformation(
language,
openApiTreeProvider.descriptionUrl);
if (languagesInformation) {
dependenciesInfoProvider.update(languagesInformation, language);
}
}),
const informationMessages = result
? getLogEntriesForLevel(result, LogLevel.information)
: [];
const errorMessages = result
? getLogEntriesForLevel(result, LogLevel.critical, LogLevel.error)
: [];
if (errorMessages.length > 0) {
errorMessages.forEach((element) => {
kiotaOutputChannel.error(element.message);
vscode.window.showErrorMessage(element.message);
});
} else {
informationMessages.forEach((element) => {
kiotaOutputChannel.info(element.message);
vscode.window.showInformationMessage(element.message);
});
}
languagesInformation = await getLanguageInformation(
language,
openApiTreeProvider.descriptionUrl
);
if (languagesInformation) {
dependenciesInfoProvider.update(languagesInformation, language);
}
}
),
vscode.commands.registerCommand(
`${extensionId}.searchApiDescription`,
async () => {
const config = await searchSteps(searchDescription);
if(config.descriptionPath) {
if (config.descriptionPath) {
openApiTreeProvider.descriptionUrl = config.descriptionPath;
vscode.commands.executeCommand(`${treeViewId}.focus`);
}
}),
vscode.commands.registerCommand(
`${treeViewId}.closeDescription`,
() => openApiTreeProvider.closeDescription()),
}
),
vscode.commands.registerCommand(`${treeViewId}.closeDescription`, () =>
openApiTreeProvider.closeDescription()
),
vscode.commands.registerCommand(
`${treeViewId}.openDescription`,
async () => {
const openState = await openSteps();
if(openState.descriptionPath) {
if (openState.descriptionPath) {
openApiTreeProvider.descriptionUrl = openState.descriptionPath;
vscode.commands.executeCommand(`${treeViewId}.focus`);
}
}),
}
)
);
// create a new status bar item that we can now manage
@ -162,15 +196,15 @@ export async function activate(
// update status bar item once at start
await updateStatusBarItem();
let disposable = vscode.commands.registerCommand(
"microsoft-kiota.updateClients",
"kiota.updateClients",
async () => {
if (
!vscode.workspace.workspaceFolders ||
vscode.workspace.workspaceFolders.length === 0
) {
vscode.window.showErrorMessage(
vscode.l10n.t('No workspace folder found, open a folder first')
);
vscode.l10n.t("No workspace folder found, open a folder first")
);
return;
}
await updateStatusBarItem();
@ -178,7 +212,9 @@ export async function activate(
kiotaOutputChannel.clear();
kiotaOutputChannel.show();
kiotaOutputChannel.info(
vscode.l10n.t('updating client with path {path}', {path: vscode.workspace.workspaceFolders[0].uri.fsPath}),
vscode.l10n.t("updating client with path {path}", {
path: vscode.workspace.workspaceFolders[0].uri.fsPath,
})
);
await connectToKiota(async (connection) => {
const request = new rpc.RequestType<string, KiotaLogEntry[], void>(
@ -188,8 +224,15 @@ export async function activate(
request,
vscode.workspace.workspaceFolders![0].uri.fsPath
);
const informationMessages = getLogEntriesForLevel(result, LogLevel.information);
const errorMessages = getLogEntriesForLevel(result, LogLevel.critical, LogLevel.error);
const informationMessages = getLogEntriesForLevel(
result,
LogLevel.information
);
const errorMessages = getLogEntriesForLevel(
result,
LogLevel.critical,
LogLevel.error
);
if (errorMessages.length > 0) {
errorMessages.forEach((element) => {
kiotaOutputChannel.error(element.message);
@ -203,9 +246,12 @@ export async function activate(
}
});
} catch (error) {
kiotaOutputChannel.error(vscode.l10n.t('error updating the clients {error}'), error);
kiotaOutputChannel.error(
vscode.l10n.t("error updating the clients {error}"),
error
);
vscode.window.showErrorMessage(
vscode.l10n.t('error updating the clients {error}'),
vscode.l10n.t("error updating the clients {error}"),
error as string
);
}
@ -223,7 +269,9 @@ async function updateStatusBarItem(): Promise<void> {
}
kiotaStatusBarItem.text = `$(extensions-info-message) kiota ${version}`;
} catch (error) {
kiotaStatusBarItem.text = `$(extensions-warning-message) kiota ${vscode.l10n.t('not found')}`;
kiotaStatusBarItem.text = `$(extensions-warning-message) kiota ${vscode.l10n.t(
"not found"
)}`;
kiotaStatusBarItem.backgroundColor = new vscode.ThemeColor(
"statusBarItem.errorBackground"
);