Skip to content

Commit fbb94e9

Browse files
Merge pull request #152 from ty-d/AddMoreStudioActions
Add more studio actions
2 parents 35db205 + dc5ee8e commit fbb94e9

File tree

5 files changed

+304
-33
lines changed

5 files changed

+304
-33
lines changed

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@
156156
"command": "vscode-objectscript.explorer.compile",
157157
"when": "view == ObjectScriptExplorer && viewItem =~ /^dataNode:/"
158158
},
159+
{
160+
"command": "vscode-objectscript.studio.contextActions",
161+
"when": "view == ObjectScriptExplorer && viewItem =~ /^dataNode:/"
162+
},
159163
{
160164
"command": "vscode-objectscript.explorer.otherNamespace",
161165
"when": "view == ObjectScriptExplorer && viewItem =~ /^serverNode((?!:extra:).)*$/",
@@ -407,6 +411,11 @@
407411
"category": "ObjectScript",
408412
"command": "vscode-objectscript.studio.actions",
409413
"title": "Studio Actions..."
414+
},
415+
{
416+
"category": "ObjectScript",
417+
"command": "vscode-objectscript.studio.contextActions",
418+
"title": "Studio Context Actions..."
410419
}
411420
],
412421
"keybindings": [
@@ -612,6 +621,11 @@
612621
"type": "boolean",
613622
"default": true,
614623
"description": "Show `Debug this method` action for ClassMethods"
624+
},
625+
"objectscript.studioActionDebugOutput": {
626+
"type": "boolean",
627+
"default": false,
628+
"description": "Output the action that VSCode should perform as requested by the server in JSON format."
615629
}
616630
}
617631
},

src/api/index.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,21 @@ export class AtelierAPI {
187187
data.result.content = Buffer.from(data.result.content.join(""), "base64");
188188
}
189189
if (data.console) {
190-
outputConsole(data.console);
190+
// Let studio actions handle their console output
191+
const isStudioAction = data.result.content != undefined
192+
&& data.result.content.length !== 0
193+
&& data.result.content[0] != undefined
194+
&& data.result.content[0].action != undefined;
195+
if(!isStudioAction) {
196+
outputConsole(data.console);
197+
}
191198
}
192199
if (data.result.status && data.result.status !== "") {
193-
outputChannel.appendLine(data.result.status);
200+
const status: string = data.result.status;
201+
outputChannel.appendLine(status);
202+
if(status.endsWith("is marked as read only by source control hooks.")) {
203+
vscode.window.showWarningMessage(status, { modal: true });
204+
}
194205
throw new Error(data.result.status);
195206
}
196207
if (data.status.summary) {

src/commands/compile.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function updateOthers(others: string[]) {
3838
});
3939
}
4040

41-
async function loadChanges(files: CurrentFile[]): Promise<any> {
41+
export async function loadChanges(files: CurrentFile[]): Promise<any> {
4242
if (!files.length) {
4343
return;
4444
}
@@ -104,8 +104,8 @@ async function compile(docs: CurrentFile[], flags?: string): Promise<any> {
104104
.then(loadChanges);
105105
}
106106

107-
export async function importAndCompile(askFLags = false): Promise<any> {
108-
const file = currentFile();
107+
export async function importAndCompile(askFLags = false, document?: vscode.TextDocument): Promise<any> {
108+
const file = currentFile(document);
109109
if (!file) {
110110
return;
111111
}

0 commit comments

Comments
 (0)