From 4cb05c9c50e64b1ac4c4f8f5d8538b51a5ca8760 Mon Sep 17 00:00:00 2001 From: Lars Hvam Date: Fri, 13 Oct 2023 12:23:44 +0200 Subject: [PATCH] remove create artifact feature --- client/src/create.ts | 125 ---------------------------------------- client/src/extension.ts | 3 - package.json | 10 ---- 3 files changed, 138 deletions(-) diff --git a/client/src/create.ts b/client/src/create.ts index 9383356b..1e12754d 100644 --- a/client/src/create.ts +++ b/client/src/create.ts @@ -2,8 +2,6 @@ import * as path from "path"; import * as vscode from "vscode"; import {Buffer} from "buffer"; -// todo: run formatter, ie user settings, on generated ABAP - async function createFile(uri: vscode.Uri, content: string) { if (await fileExists(uri)) { vscode.window.showErrorMessage("File already exists!"); @@ -44,132 +42,9 @@ async function fileExists(uri: vscode.Uri): Promise { } } -export async function createArtifact(uri: vscode.Uri) { - const type = await vscode.window.showQuickPick(["Class", "Interface", "Program"]); - if (type === undefined || type === "") { - return; - } - - switch (type) { - case "Class": - return createCLAS(uri); - case "Interface": - return createINTF(uri); - case "Program": - return createPROG(uri); - default: - break; - } - -} - export async function createConfig(uri: vscode.Uri, config: string) { const dir = await findFolder(uri); const filename = dir + "abaplint.json"; const uriConfig = vscode.Uri.file(filename); await createFile(uriConfig, config); } - -async function createCLAS(uri: vscode.Uri) { - const name = await vscode.window.showInputBox({placeHolder: "cl_name"}); - if (name === undefined || name === "") { - return; - } - - const dir = await findFolder(uri); - const filename = dir + name.replace(/\//g, "#").toLowerCase() + ".clas"; - - const uriXML = vscode.Uri.file(filename + ".xml"); - const dataXML = ` - - - - - ${name.toUpperCase()} - E - ${name.toUpperCase()} - 1 - X - X - X - - - -`; - await createFile(uriXML, dataXML); - - const uriABAP = vscode.Uri.file(filename + ".abap"); - const dataABAP = `CLASS ${name.toLowerCase()} DEFINITION PUBLIC. - PUBLIC SECTION. -ENDCLASS. - -CLASS ${name.toLowerCase()} IMPLEMENTATION. - -ENDCLASS.`; - await createFile(uriABAP, dataABAP); -} - -async function createINTF(uri: vscode.Uri) { - const name = await vscode.window.showInputBox({placeHolder: "if_name"}); - if (name === undefined || name === "") { - return; - } - - const dir = await findFolder(uri); - const filename = dir + name.replace(/\//g, "#").toLowerCase() + ".intf"; - - const uriXML = vscode.Uri.file(filename + ".xml"); - const dataXML = ` - - - - - ${name.toUpperCase()} - E - ${name.toUpperCase()} - 2 - 1 - X - - - -`; - await createFile(uriXML, dataXML); - - const uriABAP = vscode.Uri.file(filename + ".abap"); - const dataABAP = `INTERFACE ${name.toLowerCase()} PUBLIC. - -ENDINTERFACE.`; - await createFile(uriABAP, dataABAP); -} - -async function createPROG(uri: vscode.Uri) { - const name = await vscode.window.showInputBox({placeHolder: "zreport"}); - if (name === undefined || name === "") { - return; - } - - const dir = await findFolder(uri); - const filename = dir + name.toLowerCase() + ".prog"; - - const uriXML = vscode.Uri.file(filename + ".xml"); - const dataXML = ` - - - - - ${name.toUpperCase()} - S - 1 - X - X - - - -`; - await createFile(uriXML, dataXML); - - const uriABAP = vscode.Uri.file(filename + ".abap"); - const dataABAP = `REPORT ${name.toLowerCase()}.\n\n`; - await createFile(uriABAP, dataABAP); -} \ No newline at end of file diff --git a/client/src/extension.ts b/client/src/extension.ts index 9b958008..87b76f33 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -4,7 +4,6 @@ import {LanguageClient as NodeLanguageClient, LanguageClientOptions, ServerOptio import {LanguageClient as BrowserLanguageClient} from "vscode-languageclient/browser"; import * as vscode from "vscode"; import * as fs from "fs"; -import {createArtifact} from "./create"; import {Highlight} from "./highlight"; import {Help} from "./help"; import {Config} from "./config"; @@ -63,8 +62,6 @@ export function activate(context: ExtensionContext) { }, }; - context.subscriptions.push(vscode.commands.registerCommand("abaplint.create.artifact", createArtifact)); - if (fs.read === undefined) { myStatusBarItem.text = "abaplint: web"; const serverMain = Uri.joinPath(context.extensionUri, "out-browser/server.js"); diff --git a/package.json b/package.json index 95eed698..7d1e7472 100644 --- a/package.json +++ b/package.json @@ -126,20 +126,10 @@ } ], "file/newFile": [ - { - "command": "abaplint.create.artifact", - "group": "abaplint@1" - }, { "command": "abaplint.create.default-config", "group": "abaplint@1" } - ], - "explorer/context": [ - { - "command": "abaplint.create.artifact", - "group": "abaplint@1" - } ] }, "keybindings": [