Skip to content

feat: collab support in vscode-workbench extension#14

Open
Vtec234 wants to merge 10 commits into
mainfrom
collab-save
Open

feat: collab support in vscode-workbench extension#14
Vtec234 wants to merge 10 commits into
mainfrom
collab-save

Conversation

@Vtec234
Copy link
Copy Markdown
Member

@Vtec234 Vtec234 commented May 6, 2026

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.

@Vtec234 Vtec234 marked this pull request as ready for review May 13, 2026 14:51
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

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