-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Refactor to accommodate upstream VSCode API changes #10569
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
Refactor to accommodate upstream VSCode API changes #10569
Conversation
src/client/datascience/interactive-ipynb/nativeEditorProvider.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!modelPromise) { | ||
const storage = this.serviceContainer.get<INotebookStorage>(INotebookStorage); | ||
modelPromise = storage.load(file, contents).then(m => { | ||
if (!this.modelChangedHandlers.has(key)) { | ||
this.modelChangedHandlers.set(key, m.changed(this.modelChanged.bind(this))); | ||
if (!this.models.has(m)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rchiodo Instead of using a dict that's keyed by the file, i'm using a weekmap.
Basically if we have a new model then we add event handlers.
And using a weekmap to not hold onto to the model ref.
Using a dictionary keyed with file, might not work, as its possible that the editor was closed, hence the model and the like get disposed, thus this condition will never get satisfied...
this way there's no ambiguitiy, - new model, then add event handlers
.
Codecov Report
@@ Coverage Diff @@
## ds/custom_editor #10569 +/- ##
===================================================
Coverage ? 60.65%
===================================================
Files ? 579
Lines ? 31429
Branches ? 4477
===================================================
Hits ? 19062
Misses ? 11396
Partials ? 971
Continue to review full report at Codecov.
|
Kudos, SonarCloud Quality Gate passed!
|
* master: Fix merge issue Move redux logging to a different file (#10605) Disable custom editor API (#10604) Ensure local host only if connection not available (#10600) Delegate management of notebooks (creation and disposing) to I… (#10568) Refactor to accommodate upstream VSCode API changes (#10569) Use a single notebook beetween multiple native editors (#10514) Add support for synchronising edits between two nb editors of… (#10189) Fix tests in ds/custom_editor branch (#10512) Fix linter Reimplement custom editor using new API
For #9960