Skip to content

feat: collab support in vscode-workbench extension#14

Merged
Vtec234 merged 11 commits into
mainfrom
collab-save
Jun 1, 2026
Merged

feat: collab support in vscode-workbench extension#14
Vtec234 merged 11 commits into
mainfrom
collab-save

Conversation

@Vtec234

@Vtec234 Vtec234 commented May 6, 2026

Copy link
Copy Markdown
Member

This PR adds support for collaborative editing to the vscode-workbench extension. The design I settled on is as follows.

  • The project directory is write-mounted in every VSC server (editor session). VSC servers open, read, and write project files directly.
    • Conflicts resulting from concurrent writes would normally produce an error in VSC. We turn this off by setting files.saveConflictResolution.
  • Text documents that clients have opened are synced through our collab-server. Edit rebasing is done by Yjs.
    • Collab-server picks up file contents from disk when initializing collaborative state, but stores the collaborative state in a database afterwards.
      • This leaves some potential for divergence between the on-disk contents of project files and the collaborative state. Divergence is not substantial when users auto-save (the default in VSC-Web), but we should add more safeguards in follow-up PRs.
      • Collaborative state is destroyed as soon as all VSC servers exit (defaults to a few hours after client disconnect, afaict). We could choose to persist it longer if desirable.
        • [ ] Persist DB. In feat: awareness for collaboration #20 we save document contents to disk when collab-server exits - there may be no need to persist the edit history in the Yjs CRDT also.

@Vtec234 Vtec234 marked this pull request as ready for review May 13, 2026 14:51
Comment thread collab-server/src/server.ts Outdated
url: `file:${dbPath}`,
nativeBinding,
})
const db = new PrismaClient({ adapter })

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prisma might be overkill for this simple database after all..

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

@Vtec234 Vtec234 requested a review from jcreedcmu May 13, 2026 15:24
@jcreedcmu

Copy link
Copy Markdown
Collaborator

We discussed the design a bit in a call, and made the following diagram:

image

@Vtec234 Vtec234 merged commit 0d74493 into main Jun 1, 2026
1 check passed
@Vtec234 Vtec234 deleted the collab-save branch June 1, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants