|
1 | 1 | import * as vscode from "vscode"; |
2 | 2 | import { AtelierAPI } from "../api"; |
3 | 3 | import { config, FILESYSTEM_SCHEMA } from "../extension"; |
4 | | -import { outputChannel, outputConsole, currentFile, getServerName } from "../utils"; |
| 4 | +import { outputChannel, outputConsole, getServerName } from "../utils"; |
5 | 5 | import { DocumentContentProvider } from "../providers/DocumentContentProvider"; |
6 | 6 | import { ClassNode } from "../explorer/models/classNode"; |
7 | 7 | import { PackageNode } from "../explorer/models/packageNode"; |
8 | 8 | import { RoutineNode } from "../explorer/models/routineNode"; |
9 | 9 | import { NodeBase } from "../explorer/models/nodeBase"; |
10 | | -import { importAndCompile, loadChanges } from "./compile"; |
| 10 | +import { importAndCompile } from "./compile"; |
11 | 11 |
|
12 | 12 | export let documentBeingProcessed: vscode.TextDocument = null; |
13 | 13 |
|
@@ -131,6 +131,7 @@ class StudioActions { |
131 | 131 | this.api.actionQuery("select %Atelier_v1_Utils.General_GetCSPToken(?) token", [target]).then((tokenObj) => { |
132 | 132 | const csptoken = tokenObj.result.content[0].token; |
133 | 133 | url.searchParams.set("CSPCHD", csptoken); |
| 134 | + url.searchParams.set("CSPSHARE", "1"); |
134 | 135 | url.searchParams.set("Namespace", this.api.config.ns); |
135 | 136 | panel.webview.html = ` |
136 | 137 | <!DOCTYPE html> |
@@ -280,41 +281,38 @@ class StudioActions { |
280 | 281 | const actionToProcess = data.result.content.pop(); |
281 | 282 |
|
282 | 283 | if (actionToProcess.reload) { |
283 | | - const document = vscode.window.activeTextEditor.document; |
284 | | - const file = currentFile(document); |
285 | 284 | // 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); |
288 | 287 | } |
289 | 288 |
|
290 | 289 | // CSP pages should not have a progress bar |
291 | 290 | if (actionToProcess.action === 2) { |
292 | 291 | resolve(); |
293 | 292 | } |
294 | | - return actionToProcess; |
295 | | - }) |
296 | | - .then((actionToProcess) => { |
| 293 | + |
297 | 294 | const attemptedEditLabel = getOtherStudioActionLabel(OtherStudioAction.AttemptedEdit); |
298 | 295 | if (afterUserAction && actionToProcess.errorText !== "") { |
299 | 296 | 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); |
301 | 299 | } |
302 | 300 | outputChannel.appendLine(actionToProcess.errorText); |
303 | 301 | outputChannel.show(); |
304 | 302 | } |
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 | + } |
318 | 316 | }) |
319 | 317 | .then(() => resolve()) |
320 | 318 | .catch((err) => { |
|
0 commit comments