From a10437277074ed953dcc5f5f2359f42dd991acd2 Mon Sep 17 00:00:00 2001 From: thewahome Date: Tue, 19 Nov 2024 16:43:16 +0300 Subject: [PATCH] isolate in folder --- .../deleteWorkspaceItemCommand.ts | 43 ++++--------------- .../deleteWorkspaceItem/removeItem.ts | 32 ++++++++++++++ vscode/microsoft-kiota/src/extension.ts | 2 +- 3 files changed, 41 insertions(+), 36 deletions(-) rename vscode/microsoft-kiota/src/commands/{ => deleteWorkspaceItem}/deleteWorkspaceItemCommand.ts (69%) create mode 100644 vscode/microsoft-kiota/src/commands/deleteWorkspaceItem/removeItem.ts diff --git a/vscode/microsoft-kiota/src/commands/deleteWorkspaceItemCommand.ts b/vscode/microsoft-kiota/src/commands/deleteWorkspaceItem/deleteWorkspaceItemCommand.ts similarity index 69% rename from vscode/microsoft-kiota/src/commands/deleteWorkspaceItemCommand.ts rename to vscode/microsoft-kiota/src/commands/deleteWorkspaceItem/deleteWorkspaceItemCommand.ts index 5228b8556b..3bbf73fe44 100644 --- a/vscode/microsoft-kiota/src/commands/deleteWorkspaceItemCommand.ts +++ b/vscode/microsoft-kiota/src/commands/deleteWorkspaceItem/deleteWorkspaceItemCommand.ts @@ -1,14 +1,14 @@ import * as vscode from "vscode"; -import * as rpc from "vscode-jsonrpc/node"; import TelemetryReporter from "@vscode/extension-telemetry"; -import { extensionId } from "../constants"; -import { connectToKiota, getLogEntriesForLevel, KiotaLogEntry, LogLevel } from "../kiotaInterop"; -import { WorkspaceTreeItem, WorkspaceTreeProvider } from "../providers/workspaceTreeProvider"; -import { isPluginType } from "../util"; -import { exportLogsAndShowErrors } from "../utilities/logging"; -import { Command } from "./Command"; -import { checkForSuccess } from "./generate/generation-util"; +import { extensionId } from "../../constants"; +import { getLogEntriesForLevel, KiotaLogEntry, LogLevel } from "../../kiotaInterop"; +import { WorkspaceTreeItem, WorkspaceTreeProvider } from "../../providers/workspaceTreeProvider"; +import { isPluginType } from "../../util"; +import { exportLogsAndShowErrors } from "../../utilities/logging"; +import { Command } from "../Command"; +import { checkForSuccess } from "../generate/generation-util"; +import { removeClient, removePlugin } from "./removeItem"; export class DeleteWorkspaceItemCommand extends Command { constructor(private _context: vscode.ExtensionContext, private _workspaceTreeProvider: WorkspaceTreeProvider) { @@ -92,30 +92,3 @@ export class DeleteWorkspaceItemCommand extends Command { } } -export function removePlugin(context: vscode.ExtensionContext, pluginName: string, cleanOutput: boolean): Promise { - return connectToKiota(context, async (connection) => { - const request = new rpc.RequestType2( - "RemovePlugin" - ); - const result = await connection.sendRequest( - request, - pluginName, - cleanOutput - ); - return result; - }); -}; - -export function removeClient(context: vscode.ExtensionContext, clientName: string, cleanOutput: boolean): Promise { - return connectToKiota(context, async (connection) => { - const request = new rpc.RequestType2( - "RemoveClient" - ); - const result = await connection.sendRequest( - request, - clientName, - cleanOutput - ); - return result; - }); -}; \ No newline at end of file diff --git a/vscode/microsoft-kiota/src/commands/deleteWorkspaceItem/removeItem.ts b/vscode/microsoft-kiota/src/commands/deleteWorkspaceItem/removeItem.ts new file mode 100644 index 0000000000..8b906d30e9 --- /dev/null +++ b/vscode/microsoft-kiota/src/commands/deleteWorkspaceItem/removeItem.ts @@ -0,0 +1,32 @@ +import * as vscode from "vscode"; +import * as rpc from "vscode-jsonrpc/node"; + +import { connectToKiota, KiotaLogEntry } from "../../kiotaInterop"; + +export function removePlugin(context: vscode.ExtensionContext, pluginName: string, cleanOutput: boolean): Promise { + return connectToKiota(context, async (connection) => { + const request = new rpc.RequestType2( + "RemovePlugin" + ); + const result = await connection.sendRequest( + request, + pluginName, + cleanOutput + ); + return result; + }); +}; + +export function removeClient(context: vscode.ExtensionContext, clientName: string, cleanOutput: boolean): Promise { + return connectToKiota(context, async (connection) => { + const request = new rpc.RequestType2( + "RemoveClient" + ); + const result = await connection.sendRequest( + request, + clientName, + cleanOutput + ); + return result; + }); +}; \ No newline at end of file diff --git a/vscode/microsoft-kiota/src/extension.ts b/vscode/microsoft-kiota/src/extension.ts index a379dbedc0..7428af4906 100644 --- a/vscode/microsoft-kiota/src/extension.ts +++ b/vscode/microsoft-kiota/src/extension.ts @@ -4,7 +4,7 @@ import TelemetryReporter from '@vscode/extension-telemetry'; import * as vscode from "vscode"; import { CloseDescriptionCommand } from './commands/closeDescriptionCommand'; -import { DeleteWorkspaceItemCommand } from './commands/deleteWorkspaceItemCommand'; +import { DeleteWorkspaceItemCommand } from './commands/deleteWorkspaceItem/deleteWorkspaceItemCommand'; import { EditPathsCommand } from './commands/editPathsCommand'; import { GenerateClientCommand } from './commands/generate/generateClientCommand'; import { displayGenerationResults } from './commands/generate/generation-util';