-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add support for synchronising edits between two nb editors of the same file #10189
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
Add support for synchronising edits between two nb editors of the same file #10189
Conversation
@@ -9,7 +9,7 @@ export enum MessageType { | |||
/** | |||
* Action dispatched as result of some user action. | |||
*/ | |||
userAction = 0, | |||
other = 0, |
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 seems okay, but I wonder if we even need to sync all of this stuff. I believe the model edits sync'd to all views should just work. That seems simpler to me.
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.
Ahh yes, agreed, but we'd need to know where cell edits come from (i.e. from which editor and ensure those are propagated to the other views).
I'll check that out.
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.
but I wonder if we even need to sync all of this stuff
- This is stuff like cell selection, focus (for live share)
- We control what actions can be synchronized (cell progress states, error states, etc).
- If the model state captures all of this then yes that will work as well. I'll look into that right now.
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.
Yeah I think that should be pretty easy. Add like an origin or something to the NotebookModelChange class. And then check that in the code in the nativeEditor that skips when from 'user'. Only skip if from 'user' and 'origin' is self.
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.
I don't think we need to sync selection or focus. That's weird. Would you want your other editor (or your editor if on liveshare) to change focus/selection?
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.
But otherwise each view should represent the model.
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
That being said, I'm not saying this is a full proof solution, however using the model alone doesn't give us all the synchronization we need (cell state for execution, & the like) I.e. i think using the latter solution would require some more changes and wouldn't cover all scenarios. |
@@ -99,8 +100,8 @@ export function reBroadcastMessageIfRequired( | |||
// tslint:disable-next-line: no-any | |||
const syncPayloadData: BaseReduxActionPayload<any> = { data: payload?.data, messageType: result[1], messageDirection: 'incoming' }; | |||
// tslint:disable-next-line: no-any |
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.
Looks like you can ditch the no-any now.
Codecov Report
@@ Coverage Diff @@
## ds/custom_editor #10189 +/- ##
====================================================
+ Coverage 60.80% 60.83% +0.02%
====================================================
Files 579 580 +1
Lines 31301 31336 +35
Branches 4454 4461 +7
====================================================
+ Hits 19032 19062 +30
- Misses 11308 11312 +4
- Partials 961 962 +1
Continue to review full report at Codecov.
|
a5f3a0d
to
9c7e9bb
Compare
9c7e9bb
to
b4997d6
Compare
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 #9879
Notes:
userAction
toother
, as its misleading (was to me, cuz if its a user action they why isn't it synchronized).