Skip to content

Commit

Permalink
Studio Source Control class some actions available now
Browse files Browse the repository at this point in the history
  • Loading branch information
daimor committed Oct 5, 2019
1 parent 0f2d7b0 commit 22cd74c
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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**
Expand Down
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@
{
"command": "vscode-objectscript.compileFolder",
"when": "false"
},
{
"command": "vscode-objectscript.studio.actions",
"when": "vscode-objectscript.connectActive && resourceScheme == isfs"
}
],
"view/title": [
Expand Down Expand Up @@ -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/"
Expand All @@ -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"
}
]
},
Expand Down Expand Up @@ -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": [
Expand Down
73 changes: 73 additions & 0 deletions src/commands/studio.ts
Original file line number Diff line number Diff line change
@@ -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<any> {
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<StudioAction>(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<void> {
// return doMenuAction(uri, "context");
// }

export function mainMenu(uri: vscode.Uri) {
return doMenuAction(uri, "");
}
9 changes: 7 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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;
Expand Down Expand Up @@ -233,6 +237,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
});
}),
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),
Expand Down

0 comments on commit 22cd74c

Please sign in to comment.