vscode
vscode copied to clipboard
feat: copy id or document to clipboard
Description
Adds 2 new context menu actions.
mdb.copyDocumentIdFromTree- To copy the ID of a document to the clipboard.mdb.copyDocumentFromTree- To copy the value of a document to the clipboard.
Sometimes I can recognize an ID, or especially for small collections (i.e. during development) I know the document at the bottom is the one I need to interact with. It'd be nice to be able to just copy the ID directly from the tree view and just paste it in the playground.
body = body.slice(1, body.length - 1);
Just to explain this particular line. Copies the documentId property, but if it's a string, which it is in most cases, I thought we should remove the quotes when copying.
For any other type of ID (namely objects) the output doesn't start or end with quotes anyway.
Checklist
- [ ] New tests and/or benchmarks are included
- Not sure if we need tests for this one?
- [ ] Documentation is changed or added
Motivation and Context
- [ ] Bugfix
- [x] New feature
- [ ] Dependency update
- [ ] Misc
Dependents
Types of changes
- [ ] Backport Needed
- [ ] Patch (non-breaking change which fixes an issue)
- [x] Minor (non-breaking change which adds functionality)
- [ ] Major (fix or feature that would cause existing functionality to change)
Added view document and copy document in this pr: https://github.com/mongodb-js/vscode/pull/445 - it'll be in the next release. No copy id, yet, though.