Skip to content

Commit

Permalink
fix: save documents from tree view and do not reopen them for playgro…
Browse files Browse the repository at this point in the history
…und 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
  • Loading branch information
alenakhineika authored Mar 30, 2023
1 parent 28e9bea commit 271a312
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@
},
{
"command": "mdb.saveMongoDBDocument",
"when": "editorLangId == json"
"when": "resourceScheme == VIEW_DOCUMENT_SCHEME"
},
{
"command": "mdb.runSelectedPlaygroundBlocks",
Expand Down Expand Up @@ -812,7 +812,7 @@
"command": "mdb.saveMongoDBDocument",
"key": "ctrl+s",
"mac": "cmd+s",
"when": "mdb.isPlayground == true"
"when": "resourceScheme == VIEW_DOCUMENT_SCHEME"
}
],
"capabilities": {
Expand Down
6 changes: 3 additions & 3 deletions src/editors/editorsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand All @@ -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;
}

Expand Down
2 changes: 0 additions & 2 deletions src/editors/playgroundController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,6 @@ export default class PlaygroundController {

this._playgroundResult = evaluateResponse.result;

this._explorerController.refresh();

await this._openPlaygroundResult();

return true;
Expand Down

0 comments on commit 271a312

Please sign in to comment.