Skip to content

Commit 22cd74c

Browse files
committed
Studio Source Control class some actions available now
1 parent 0f2d7b0 commit 22cd74c

File tree

4 files changed

+102
-2
lines changed

4 files changed

+102
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## [0.7.14]
4+
- "Debug this ClassMethod" feauture added, to quickly debug any classmethod in a class
5+
- Change variable value while debugging
6+
- When virtual filesystem `isfs://` used, now possible to execute some actions from Studio Source class menu
7+
38
## [0.7.12]
49

510
- **Debugging support, run routine, class or attach to a process**

package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@
121121
{
122122
"command": "vscode-objectscript.compileFolder",
123123
"when": "false"
124+
},
125+
{
126+
"command": "vscode-objectscript.studio.actions",
127+
"when": "vscode-objectscript.connectActive && resourceScheme == isfs"
124128
}
125129
],
126130
"view/title": [
@@ -163,6 +167,10 @@
163167
"command": "vscode-objectscript.compile",
164168
"when": "editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive"
165169
},
170+
{
171+
"command": "vscode-objectscript.studio.actions",
172+
"when": "resourceScheme == isfs && editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive"
173+
},
166174
{
167175
"command": "vscode-objectscript.previewXml",
168176
"when": "editorLangId =~ /^xml/"
@@ -184,6 +192,10 @@
184192
{
185193
"command": "vscode-objectscript.compileFolder",
186194
"when": "vscode-objectscript.connectActive"
195+
},
196+
{
197+
"command": "vscode-objectscript.studio.actions",
198+
"when": "resourceScheme == isfs && resourceLangId =~ /^objectscript/ && vscode-objectscript.connectActive"
187199
}
188200
]
189201
},
@@ -361,6 +373,11 @@
361373
"category": "ObjectScsript",
362374
"command": "vscode-objectscript.compileFolder",
363375
"title": "Import and compile"
376+
},
377+
{
378+
"category": "ObjectScript",
379+
"command": "vscode-objectscript.studio.actions",
380+
"title": "Studio actions"
364381
}
365382
],
366383
"keybindings": [

src/commands/studio.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import * as vscode from "vscode";
2+
import { AtelierAPI } from "../api";
3+
import { FILESYSTEM_SCHEMA } from "../extension";
4+
import { outputChannel } from "../utils";
5+
6+
interface StudioAction extends vscode.QuickPickItem {
7+
name: string;
8+
id: string;
9+
}
10+
11+
function doMenuAction(uri: vscode.Uri, menuType: string): Promise<any> {
12+
uri = uri || vscode.window.activeTextEditor.document.uri;
13+
if (uri.scheme !== FILESYSTEM_SCHEMA) {
14+
return;
15+
}
16+
const query = "select * from %Atelier_v1_Utils.Extension_GetMenus(?,?,?)";
17+
const name = uri.path.slice(1).replace(/\//g, ".");
18+
const api = new AtelierAPI(uri.authority);
19+
const parameters = [menuType, name, ""];
20+
return api
21+
.actionQuery(query, parameters)
22+
.then(data => data.result.content)
23+
.then(menu =>
24+
menu.reduce(
25+
(list, sub) =>
26+
list.concat(
27+
sub.items
28+
.filter(el => el.id !== "" && el.separator == 0 && el.enabled == 1)
29+
.map(el => ({ ...el, id: `${sub.id},${el.id}`, label: el.name }))
30+
),
31+
[]
32+
)
33+
)
34+
.then(menuItems => {
35+
return vscode.window.showQuickPick<StudioAction>(menuItems, { canPickMany: false });
36+
})
37+
.then(({ id, label }) => ({
38+
id: id,
39+
label,
40+
name,
41+
}))
42+
.then(action => {
43+
if (action) {
44+
const query = "select * from %Atelier_v1_Utils.Extension_UserAction(?, ?, ?, ?)";
45+
const parameters = ["0", action.id, name, ""];
46+
return vscode.window.withProgress(
47+
{
48+
cancellable: false,
49+
location: vscode.ProgressLocation.Notification,
50+
title: `Executing user action: ${action.label}`,
51+
},
52+
() =>
53+
api
54+
.actionQuery(query, parameters)
55+
.then(data => data.result.content.pop())
56+
.then(userAction => {
57+
if (userAction && userAction.action != "0") {
58+
outputChannel.appendLine(`Studio Action "${action.label}" not supported`);
59+
outputChannel.show();
60+
}
61+
})
62+
);
63+
}
64+
});
65+
}
66+
67+
// export function contextMenu(uri: vscode.Uri): Promise<void> {
68+
// return doMenuAction(uri, "context");
69+
// }
70+
71+
export function mainMenu(uri: vscode.Uri) {
72+
return doMenuAction(uri, "");
73+
}

src/extension.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { subclass } from "./commands/subclass";
1414
import { superclass } from "./commands/superclass";
1515
import { viewOthers } from "./commands/viewOthers";
1616
import { xml2doc } from "./commands/xml2doc";
17+
import { mainMenu } from "./commands/studio";
1718

1819
import { getLanguageConfiguration } from "./languageConfiguration";
1920

@@ -36,12 +37,15 @@ import { ObjectScriptConfigurationProvider } from "./debug/debugConfProvider";
3637
import { ObjectScriptExplorerProvider } from "./explorer/explorer";
3738
import { WorkspaceNode } from "./explorer/models/workspaceNode";
3839
import { FileSystemProvider } from "./providers/FileSystemPovider/FileSystemProvider";
39-
import { FileSearchProvider } from "./providers/FileSystemPovider/FileSearchProvider";
40-
import { TextSearchProvider } from "./providers/FileSystemPovider/TextSearchProvider";
4140
import { WorkspaceSymbolProvider } from "./providers/WorkspaceSymbolProvider";
4241
import { currentWorkspaceFolder, outputChannel } from "./utils";
4342
import { ObjectScriptDiagnosticProvider } from "./providers/ObjectScriptDiagnosticProvider";
4443
import { DocumentRangeFormattingEditProvider } from "./providers/DocumentRangeFormattingEditProvider";
44+
45+
/* proposed */
46+
import { FileSearchProvider } from "./providers/FileSystemPovider/FileSearchProvider";
47+
import { TextSearchProvider } from "./providers/FileSystemPovider/TextSearchProvider";
48+
4549
export let fileSystemProvider: FileSystemProvider;
4650
export let explorerProvider: ObjectScriptExplorerProvider;
4751
export let documentContentProvider: DocumentContentProvider;
@@ -233,6 +237,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
233237
});
234238
}),
235239
vscode.commands.registerCommand("vscode-objectscript.viewOthers", viewOthers),
240+
vscode.commands.registerCommand("vscode-objectscript.studio.actions", mainMenu),
236241
vscode.commands.registerCommand("vscode-objectscript.subclass", subclass),
237242
vscode.commands.registerCommand("vscode-objectscript.superclass", superclass),
238243
vscode.commands.registerCommand("vscode-objectscript.serverActions", serverActions),

0 commit comments

Comments
 (0)