News for hackers. Stuff that matters.
Re:Ace, CodeMirror, and Monaco: A comparison of browser code... by samwillis on Monday March 14, 2022 @01:28PM (#30675276)
Not mentioned in the article but CodeMirror has a brilliant story for realtime collaborative editing. You have two options:

- An Operational Transform (OT) based system built by Marijn (the creator of CodeMirror)

- A Conflict Free Replicated Datatype (CRDT) based system using Yjs built by Kevin Jahns (the creator of Yjs) - https://github.com/yjs/y-codemirror

OT Demo: https://codemirror.net/6/examples/collab/

Yjs Demo: https://demos.yjs.dev/codemirror/codemirror.html

Both are brilliant, but I'm a huge fan of Yjs - the number of different bindings to different editors (and state systems) is incredible. It's a great platform to build collaborative tools on and the big plus is offline editing support, you can have a document diverge significantly while offline and still merge successfully. OTs are a little more difficult to make work well for a significant period offline.

I don't know which of the above Replit use, I would suspect the OT version as they mention building a OT system for Ace in the article.

Re:Ace, CodeMirror, and Monaco: A comparison of browser code... by masfrost on Monday March 14, 2022 @01:48PM (#30675547)
We had to handroll our own OT implementation inhouse (based on https://github.com/ottypes/text-unicode) since we had built the system for it already. I suspect we would've used or forked CodeMirror's collab package if we were starting today.

Also huge fan of yjs, but the implementation is not compatible with codemirror 6, only version 5 (AFAIK)

Re:Ace, CodeMirror, and Monaco: A comparison of browser code... by mlajtos on Monday March 14, 2022 @02:01PM (#30675736)
There is Yjs bindings for CM6: https://github.com/yjs/y-codemirror.next
Re:Ace, CodeMirror, and Monaco: A comparison of browser code... by masfrost on Monday March 14, 2022 @04:55PM (#30678170)
Amazing, thanks