Skip to content

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

Merged
merged 1 commit into from
Jun 1, 2020

Conversation

DonJayamanne
Copy link

For #10496

@DonJayamanne DonJayamanne added the no-changelog No news entry required label Jun 1, 2020
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 1, 2020

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
11.0% 11.0% Duplication

return;
}

cell.data.source = splitMultilineString(e.document.getText());
Copy link
Author

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...).

Copy link
Author

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();
Copy link
Author

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(
Copy link
Author

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);
Copy link
Member

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.

@DonJayamanne DonJayamanne merged commit feb74dc into microsoft:master Jun 1, 2020
@DonJayamanne DonJayamanne deleted the syncCellEdits branch June 1, 2020 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog No news entry required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants