From 22cd74cd51e64eab6870d77a3eae0ec704add9a1 Mon Sep 17 00:00:00 2001 From: Dmitry Maslennikov Date: Fri, 4 Oct 2019 20:25:07 -0400 Subject: [PATCH] Studio Source Control class some actions available now --- CHANGELOG.md | 5 +++ package.json | 17 ++++++++++ src/commands/studio.ts | 73 ++++++++++++++++++++++++++++++++++++++++++ src/extension.ts | 9 ++++-- 4 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 src/commands/studio.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 53c00d1f..f324d41e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## [0.7.14] +- "Debug this ClassMethod" feauture added, to quickly debug any classmethod in a class +- Change variable value while debugging +- When virtual filesystem `isfs://` used, now possible to execute some actions from Studio Source class menu + ## [0.7.12] - **Debugging support, run routine, class or attach to a process** diff --git a/package.json b/package.json index 03cbd64f..19d90345 100644 --- a/package.json +++ b/package.json @@ -121,6 +121,10 @@ { "command": "vscode-objectscript.compileFolder", "when": "false" + }, + { + "command": "vscode-objectscript.studio.actions", + "when": "vscode-objectscript.connectActive && resourceScheme == isfs" } ], "view/title": [ @@ -163,6 +167,10 @@ "command": "vscode-objectscript.compile", "when": "editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive" }, + { + "command": "vscode-objectscript.studio.actions", + "when": "resourceScheme == isfs && editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive" + }, { "command": "vscode-objectscript.previewXml", "when": "editorLangId =~ /^xml/" @@ -184,6 +192,10 @@ { "command": "vscode-objectscript.compileFolder", "when": "vscode-objectscript.connectActive" + }, + { + "command": "vscode-objectscript.studio.actions", + "when": "resourceScheme == isfs && resourceLangId =~ /^objectscript/ && vscode-objectscript.connectActive" } ] }, @@ -361,6 +373,11 @@ "category": "ObjectScsript", "command": "vscode-objectscript.compileFolder", "title": "Import and compile" + }, + { + "category": "ObjectScript", + "command": "vscode-objectscript.studio.actions", + "title": "Studio actions" } ], "keybindings": [ diff --git a/src/commands/studio.ts b/src/commands/studio.ts new file mode 100644 index 00000000..25c9b6ea --- /dev/null +++ b/src/commands/studio.ts @@ -0,0 +1,73 @@ +import * as vscode from "vscode"; +import { AtelierAPI } from "../api"; +import { FILESYSTEM_SCHEMA } from "../extension"; +import { outputChannel } from "../utils"; + +interface StudioAction extends vscode.QuickPickItem { + name: string; + id: string; +} + +function doMenuAction(uri: vscode.Uri, menuType: string): Promise { + uri = uri || vscode.window.activeTextEditor.document.uri; + if (uri.scheme !== FILESYSTEM_SCHEMA) { + return; + } + const query = "select * from %Atelier_v1_Utils.Extension_GetMenus(?,?,?)"; + const name = uri.path.slice(1).replace(/\//g, "."); + const api = new AtelierAPI(uri.authority); + const parameters = [menuType, name, ""]; + return api + .actionQuery(query, parameters) + .then(data => data.result.content) + .then(menu => + menu.reduce( + (list, sub) => + list.concat( + sub.items + .filter(el => el.id !== "" && el.separator == 0 && el.enabled == 1) + .map(el => ({ ...el, id: `${sub.id},${el.id}`, label: el.name })) + ), + [] + ) + ) + .then(menuItems => { + return vscode.window.showQuickPick(menuItems, { canPickMany: false }); + }) + .then(({ id, label }) => ({ + id: id, + label, + name, + })) + .then(action => { + if (action) { + const query = "select * from %Atelier_v1_Utils.Extension_UserAction(?, ?, ?, ?)"; + const parameters = ["0", action.id, name, ""]; + return vscode.window.withProgress( + { + cancellable: false, + location: vscode.ProgressLocation.Notification, + title: `Executing user action: ${action.label}`, + }, + () => + api + .actionQuery(query, parameters) + .then(data => data.result.content.pop()) + .then(userAction => { + if (userAction && userAction.action != "0") { + outputChannel.appendLine(`Studio Action "${action.label}" not supported`); + outputChannel.show(); + } + }) + ); + } + }); +} + +// export function contextMenu(uri: vscode.Uri): Promise { +// return doMenuAction(uri, "context"); +// } + +export function mainMenu(uri: vscode.Uri) { + return doMenuAction(uri, ""); +} diff --git a/src/extension.ts b/src/extension.ts index 645e1fb3..878ffd0b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -14,6 +14,7 @@ import { subclass } from "./commands/subclass"; import { superclass } from "./commands/superclass"; import { viewOthers } from "./commands/viewOthers"; import { xml2doc } from "./commands/xml2doc"; +import { mainMenu } from "./commands/studio"; import { getLanguageConfiguration } from "./languageConfiguration"; @@ -36,12 +37,15 @@ import { ObjectScriptConfigurationProvider } from "./debug/debugConfProvider"; import { ObjectScriptExplorerProvider } from "./explorer/explorer"; import { WorkspaceNode } from "./explorer/models/workspaceNode"; import { FileSystemProvider } from "./providers/FileSystemPovider/FileSystemProvider"; -import { FileSearchProvider } from "./providers/FileSystemPovider/FileSearchProvider"; -import { TextSearchProvider } from "./providers/FileSystemPovider/TextSearchProvider"; import { WorkspaceSymbolProvider } from "./providers/WorkspaceSymbolProvider"; import { currentWorkspaceFolder, outputChannel } from "./utils"; import { ObjectScriptDiagnosticProvider } from "./providers/ObjectScriptDiagnosticProvider"; import { DocumentRangeFormattingEditProvider } from "./providers/DocumentRangeFormattingEditProvider"; + +/* proposed */ +import { FileSearchProvider } from "./providers/FileSystemPovider/FileSearchProvider"; +import { TextSearchProvider } from "./providers/FileSystemPovider/TextSearchProvider"; + export let fileSystemProvider: FileSystemProvider; export let explorerProvider: ObjectScriptExplorerProvider; export let documentContentProvider: DocumentContentProvider; @@ -233,6 +237,7 @@ export async function activate(context: vscode.ExtensionContext): Promise }); }), vscode.commands.registerCommand("vscode-objectscript.viewOthers", viewOthers), + vscode.commands.registerCommand("vscode-objectscript.studio.actions", mainMenu), vscode.commands.registerCommand("vscode-objectscript.subclass", subclass), vscode.commands.registerCommand("vscode-objectscript.superclass", superclass), vscode.commands.registerCommand("vscode-objectscript.serverActions", serverActions),