Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCODE-219: edit documents opened form the sidebar #226

Merged
merged 6 commits into from
Dec 18, 2020

Conversation

alenakhineika
Copy link
Contributor

@alenakhineika alenakhineika commented Dec 17, 2020

Description

Edit documents that are opened from the tree-view.

  • When a document is opened from the tree-view, the document is editable.
  • Each document should be opened as a separate editor.
  • Each document should be opened only once.
  • If a user didn't make any changes the document can be simply closed without a confirmation modal.
  • Editing happens in EJSON to preserve type information.
  • When the document is saved (Cmd/Ctrl + S), the document is updated in MongoDB to reflect the changes that were made.
  • For saving documents we use findOneAndReplace.
  • When the document is saved, a notification informs the user that the change has been saved in MongoDB.
  • When the update results in an error, the user is notified.
  • It's possible to make edits to a document and save it more than once.
  • When the extension is reopened the opened documents should have content.
  • The documents can't be saved to MongoDB until a user connects to the proper namespace.

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@alenakhineika alenakhineika requested a review from Anemy December 17, 2020 16:32
Copy link
Contributor

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! :)

src/editors/documentProvider.ts Outdated Show resolved Hide resolved
src/test/suite/mdbExtensionController.test.ts Show resolved Hide resolved
@mmarcon
Copy link
Member

mmarcon commented Dec 18, 2020

When a document is reopened after VS Code is restarted and I try to edit it, I get this error.

image

The error is expected but it's not really helpful. Is it possible to show the connection name instead of the connection id?

@alenakhineika alenakhineika merged commit bd6b78b into master Dec 18, 2020
@alenakhineika alenakhineika deleted the VSCODE-219-edit-documents-opened-from-tree-view branch December 18, 2020 13:23
@Anemy Anemy mentioned this pull request Jan 25, 2021
@MullinsN
Copy link

MullinsN commented Jan 25, 2021

I like the changes that have appeared in the 0.4 update.

Please make sure that the marketplace extension documentation reflects some of the key changes. It helps with showing the growth in the extension, like the ability to edit documents.

What happens if the database doesn't allow a change to be made to that document?

@mmarcon
Copy link
Member

mmarcon commented Jan 26, 2021

Thank you @MullinsN for trying out 0.4.0.

The market place homepage does talk about document editing and also includes a screenshot here. Were you expecting something different?

If the database does not allow a change to be made, then VS Code will display an error that includes the server error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants