-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add ability to sync INotebookModel with cell text edits #12092
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
Conversation
SonarCloud Quality Gate failed.
|
return; | ||
} | ||
|
||
cell.data.source = splitMultilineString(e.document.getText()); |
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 @IanMatthewHuff I'm not using the INotebookModel.update
to update the model. Editing cell could end up causing this code to get executed for every keystroke, also don't see any value in triggering model updates for cell source changes (unnecessary slicing of arrays, unnecessary CPU...).
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.
This is the crux of the PR, when user edits a cell, we take the contents of the cell and update our cell.
FYI - not performing diff updates or the like. This is more efficient.
test('Cancelling using VSC Command for cell (slow)', async () => { | ||
test('Cancelling using VSC Command for cell (slow)', async function () { | ||
// Fails due to VSC bugs. | ||
return this.skip(); |
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.
VSC Insiders is now broken.
return; | ||
} | ||
if (!editor.model) { | ||
traceError( |
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.
Should we add telemetry for these?
Not sure what needs to be done here. Basically these conditions should not be met.
I could throw an error, but it wouldn't get handled by anything as this is all happening within the context of an event handler (i.e. error throw will not be displayed to user).
I feel we need to atleast add some logging
if (!this.experiment.inExperiment(NativeNotebook.experiment)) { | ||
return; | ||
} | ||
this.documentManager.onDidChangeTextDocument(this.onDidChangeTextDocument, this, this.disposables); |
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.
That's interesting. Didn't realize you could pass in the disposeable[] I always just used the return value.
For #10496