Hasty Briefsbeta

Bilingual

Collaborative Editing in CodeMirror

a day ago
  • #collaborative-editing
  • #operational-transformation
  • #crdt
  • CodeMirror's collaborative editing uses a 'boring non-distributed operational transformation (OT)' design, focusing on centralized server-client setups rather than distributed models.
  • The post contrasts OT with CRDTs, noting OT's simplicity for plain-text but complexity with richer document structures, while CRDTs offer robust convergence but with higher memory and complexity costs.
  • CodeMirror adopts a change set representation for edits, allowing flat sequences of untouched and replaced spans to simplify handling multiple changes and support features like undo histories and position mapping.
  • A key limitation identified is that OT cannot guarantee converging position mappings (e.g., for annotations), unlike CRDTs which use persistent character IDs, but this was deemed too complex for core implementation.
  • The design prioritizes support for centralized editing, avoiding the overhead of decentralized approaches, though external CRDT integrations (like Yjs) are possible for advanced needs.