-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Support suggestions #239
Closed
Closed
Support suggestions #239
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
davidbrochart
force-pushed
the
suggestions
branch
from
March 8, 2024 09:27
8ff32e7
to
8bac302
Compare
This was referenced Mar 18, 2024
Thank @davidbrochart for working on this feature. After playing with this PR in JupyterCAD, I like the simplicity of the fork idea and how easy to integrate it into our project. Here are my few feedbacks:
My wish list for the improvement:
|
Thanks for the feedback Trung! You suggestions make a lot of sense, I'll work on them soon. |
This was referenced Mar 28, 2024
Use jupyter-collaboration to get the full notebook content for completions
jupyterlab/jupyter-ai#708
Closed
davidbrochart
force-pushed
the
suggestions
branch
from
April 2, 2024 15:22
d4943ab
to
a63043a
Compare
Draft
Closing in favor of #292. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See jupyterlab/jupyterlab#16008.
This PR adds a menu to the Notebook page (it should add it to every shared document in the future), which allows to choose between "Editing" and "Suggesting". The former is the current state (edit document directly), and the later is an editing mode where edits become suggestions, which is the purpose of this PR.
When entering the suggesting mode, the root provider for the shared document is retrieved and a request to fork the document is done with
context.model.sharedModel.provider.fork()
. This triggers aPUT /api/collaboration/fork_room
request with the root room ID of the document in the body. The response gives back a fork ID, which is the room ID for the forked document that is created in the backend. The forked document is a dependency of the root room, and it is kept in sync with the root document: updates to the root document are applied to the forked document, but not the other way around. The shared document is disconnected from the root provider, and connected to a new provider for the forked document. The forked document is advertised on the root Y document as a newstate
entryfork_{forkId}
, so that other users can connect to the forked room. They can do that by callingWebSocketProvider.connect(forkId, sharedModel)
on their current provider.JupyterLab shows a notification when a client enters the suggestion mode, and the user can choose to view the suggestion or remain on the root document. When viewing the suggestion, changes are synchronized with the suggester and it is also possible to collaborate on the suggestion, since it is a regular room. A user (not the suggester) can merge the suggestion or discard it in the
Review
menu. When merged, aPUT /api/collaboration/merge_room
request is done with the fork room ID and the root room ID in the body.A menu shows which room the document is currently connect to. It can be "Root" for the root room, or the ID of a fork. Users can connect to anyone of them at any time.