From 23e3694bb4762dbaa84732a49b1528878a277d0d Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Thu, 30 Mar 2023 19:16:07 +0200 Subject: [PATCH 1/2] fix: save documents from tree view and do not reopen them for playground runs VSCODE-399, VSCODE-400 --- package.json | 2 +- src/editors/playgroundController.ts | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index 5862115aa..0c93385d2 100644 --- a/package.json +++ b/package.json @@ -812,7 +812,7 @@ "command": "mdb.saveMongoDBDocument", "key": "ctrl+s", "mac": "cmd+s", - "when": "mdb.isPlayground == true" + "when": "editorLangId == json" } ], "capabilities": { diff --git a/src/editors/playgroundController.ts b/src/editors/playgroundController.ts index 91ed1bb3c..1a6287bee 100644 --- a/src/editors/playgroundController.ts +++ b/src/editors/playgroundController.ts @@ -581,8 +581,6 @@ export default class PlaygroundController { this._playgroundResult = evaluateResponse.result; - this._explorerController.refresh(); - await this._openPlaygroundResult(); return true; From ace5df24183519463e53b6933e35ca13baef3d11 Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Thu, 30 Mar 2023 21:16:47 +0200 Subject: [PATCH 2/2] refactor: save mongodb document when resource scheme is mongodb document scheme --- package.json | 4 ++-- src/editors/editorsController.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 0c93385d2..4db2fbf65 100644 --- a/package.json +++ b/package.json @@ -619,7 +619,7 @@ }, { "command": "mdb.saveMongoDBDocument", - "when": "editorLangId == json" + "when": "resourceScheme == VIEW_DOCUMENT_SCHEME" }, { "command": "mdb.runSelectedPlaygroundBlocks", @@ -812,7 +812,7 @@ "command": "mdb.saveMongoDBDocument", "key": "ctrl+s", "mac": "cmd+s", - "when": "editorLangId == json" + "when": "resourceScheme == VIEW_DOCUMENT_SCHEME" } ], "capabilities": { diff --git a/src/editors/editorsController.ts b/src/editors/editorsController.ts index eb272b00f..971c01e4d 100644 --- a/src/editors/editorsController.ts +++ b/src/editors/editorsController.ts @@ -224,7 +224,6 @@ export default class EditorsController { DOCUMENT_SOURCE_URI_IDENTIFIER ) as DocumentSource; - // If not MongoDB document save to disk instead of MongoDB. if ( activeEditor.document.uri.scheme !== 'VIEW_DOCUMENT_SCHEME' || !namespace || @@ -233,8 +232,9 @@ export default class EditorsController { documentId === null || documentId === undefined ) { - await vscode.commands.executeCommand('workbench.action.files.save'); - + void vscode.window.showErrorMessage( + `The current file can not be saved as a MongoDB document. Invalid URL: ${activeEditor.document.uri.toString()}` + ); return false; }