Skip to content

Commit 271a312

Browse files
authoredMar 30, 2023
fix: save documents from tree view and do not reopen them for playground runs VSCODE-399, VSCODE-400 (#504)
* fix: save documents from tree view and do not reopen them for playground runs VSCODE-399, VSCODE-400 * refactor: save mongodb document when resource scheme is mongodb document scheme
1 parent 28e9bea commit 271a312

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed
 

‎package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@
619619
},
620620
{
621621
"command": "mdb.saveMongoDBDocument",
622-
"when": "editorLangId == json"
622+
"when": "resourceScheme == VIEW_DOCUMENT_SCHEME"
623623
},
624624
{
625625
"command": "mdb.runSelectedPlaygroundBlocks",
@@ -812,7 +812,7 @@
812812
"command": "mdb.saveMongoDBDocument",
813813
"key": "ctrl+s",
814814
"mac": "cmd+s",
815-
"when": "mdb.isPlayground == true"
815+
"when": "resourceScheme == VIEW_DOCUMENT_SCHEME"
816816
}
817817
],
818818
"capabilities": {

‎src/editors/editorsController.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ export default class EditorsController {
224224
DOCUMENT_SOURCE_URI_IDENTIFIER
225225
) as DocumentSource;
226226

227-
// If not MongoDB document save to disk instead of MongoDB.
228227
if (
229228
activeEditor.document.uri.scheme !== 'VIEW_DOCUMENT_SCHEME' ||
230229
!namespace ||
@@ -233,8 +232,9 @@ export default class EditorsController {
233232
documentId === null ||
234233
documentId === undefined
235234
) {
236-
await vscode.commands.executeCommand('workbench.action.files.save');
237-
235+
void vscode.window.showErrorMessage(
236+
`The current file can not be saved as a MongoDB document. Invalid URL: ${activeEditor.document.uri.toString()}`
237+
);
238238
return false;
239239
}
240240

‎src/editors/playgroundController.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,6 @@ export default class PlaygroundController {
581581

582582
this._playgroundResult = evaluateResponse.result;
583583

584-
this._explorerController.refresh();
585-
586584
await this._openPlaygroundResult();
587585

588586
return true;

0 commit comments

Comments
 (0)