Repository navigation
feat: initialize Y.Docs from VSC buffers - #160
Merged
Merged
Conversation
This was referenced Sep 30, 2026
Vtec234
force-pushed
the
connect-init
branch
from
September 30, 2026 20:04
7a0a234 to
eef7b1b
Compare
robsimmons
reviewed
Sep 30, 2026
robsimmons
reviewed
Sep 30, 2026
robsimmons
reviewed
Sep 30, 2026
robsimmons
approved these changes
Sep 30, 2026
robsimmons
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for revising this to do a bit less. The tRPC communication channel is likely to be helpful for other things, and with the exception of increasing the delay before initFromRemote overwrites the buffer, this pretty clearly improves things more than it breaks them without adding a lot of cruft.
Please file and/or link an issue about the initFromRemote problem if there isn't one before you merge.
Vtec234
force-pushed
the
connect-init
branch
from
September 30, 2026 22:50
eef7b1b to
2e9bc46
Compare
This was referenced Oct 3, 2026
This file contains hidden or 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
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.
This PR changes how
Y.Docs are initialized incollab-serverwhen they are opened for the first time. Previously,collab-serverwould open the given file on disk and read its contents. In this PR, VSC instead sends the contents of its text buffer tocollab-serverwhenYTextBindingis constructed. This produces a different outcome in case the VSC buffer has unsaved changes. Previously, they would be discarded, whereas now they are kept.Addresses, but does not entirely fix, #146 - renaming once works now, but renaming back to an old name will restore the last buffer state of the old name.
This is moving in the direction of having
collab-serversync only the open text buffers, but not the project files: disk IO is now the sole purview of VSC clients.After this PR,collab-serverwill not even have access to project files.Instrumentally, we introduce a tRPC connection between VSC and
collab-serverto communicate events that Hocuspocus/Yjs doesn't handle natively.