Skip to content

Commit ae6996e

Browse files
authored
Merge pull request #756 from timleavitt/master
Fix two unrelated server-side source control issues
2 parents e3e3706 + a66c75e commit ae6996e

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

src/commands/studio.ts

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import * as vscode from "vscode";
22
import { AtelierAPI } from "../api";
33
import { config, FILESYSTEM_SCHEMA } from "../extension";
4-
import { outputChannel, outputConsole, currentFile, getServerName } from "../utils";
4+
import { outputChannel, outputConsole, getServerName } from "../utils";
55
import { DocumentContentProvider } from "../providers/DocumentContentProvider";
66
import { ClassNode } from "../explorer/models/classNode";
77
import { PackageNode } from "../explorer/models/packageNode";
88
import { RoutineNode } from "../explorer/models/routineNode";
99
import { NodeBase } from "../explorer/models/nodeBase";
10-
import { importAndCompile, loadChanges } from "./compile";
10+
import { importAndCompile } from "./compile";
1111

1212
export let documentBeingProcessed: vscode.TextDocument = null;
1313

@@ -131,6 +131,7 @@ class StudioActions {
131131
this.api.actionQuery("select %Atelier_v1_Utils.General_GetCSPToken(?) token", [target]).then((tokenObj) => {
132132
const csptoken = tokenObj.result.content[0].token;
133133
url.searchParams.set("CSPCHD", csptoken);
134+
url.searchParams.set("CSPSHARE", "1");
134135
url.searchParams.set("Namespace", this.api.config.ns);
135136
panel.webview.html = `
136137
<!DOCTYPE html>
@@ -280,41 +281,38 @@ class StudioActions {
280281
const actionToProcess = data.result.content.pop();
281282

282283
if (actionToProcess.reload) {
283-
const document = vscode.window.activeTextEditor.document;
284-
const file = currentFile(document);
285284
// Avoid the reload triggering the edit listener here
286-
suppressEditListenerMap.set(file.uri.toString(), true);
287-
await loadChanges([file]);
285+
suppressEditListenerMap.set(this.uri.toString(), true);
286+
await vscode.commands.executeCommand("workbench.action.files.revert", this.uri);
288287
}
289288

290289
// CSP pages should not have a progress bar
291290
if (actionToProcess.action === 2) {
292291
resolve();
293292
}
294-
return actionToProcess;
295-
})
296-
.then((actionToProcess) => {
293+
297294
const attemptedEditLabel = getOtherStudioActionLabel(OtherStudioAction.AttemptedEdit);
298295
if (afterUserAction && actionToProcess.errorText !== "") {
299296
if (action.label === attemptedEditLabel) {
300-
vscode.commands.executeCommand("undo");
297+
suppressEditListenerMap.set(this.uri.toString(), true);
298+
await vscode.commands.executeCommand("workbench.action.files.revert", this.uri);
301299
}
302300
outputChannel.appendLine(actionToProcess.errorText);
303301
outputChannel.show();
304302
}
305-
actionToProcess &&
306-
!afterUserAction &&
307-
this.processUserAction(actionToProcess).then((answer) => {
308-
if ((action.label = attemptedEditLabel) && answer !== "1") {
309-
vscode.commands.executeCommand("undo");
310-
}
311-
// call AfterUserAction only if there is a valid answer
312-
if (answer) {
313-
answer.msg || answer.msg === ""
314-
? this.userAction(action, true, answer.answer, answer.msg, type)
315-
: this.userAction(action, true, answer, "", type);
316-
}
317-
});
303+
if (actionToProcess && !afterUserAction) {
304+
const answer = await this.processUserAction(actionToProcess);
305+
// call AfterUserAction only if there is a valid answer
306+
if ((action.label = attemptedEditLabel) && answer !== "1") {
307+
suppressEditListenerMap.set(this.uri.toString(), true);
308+
await vscode.commands.executeCommand("workbench.action.files.revert", this.uri);
309+
}
310+
if (answer) {
311+
answer.msg || answer.msg === ""
312+
? this.userAction(action, true, answer.answer, answer.msg, type)
313+
: this.userAction(action, true, answer, "", type);
314+
}
315+
}
318316
})
319317
.then(() => resolve())
320318
.catch((err) => {

0 commit comments

Comments
 (0)