News for hackers. Stuff that matters.
Re:We are rewriting CodeMirror by marijn on Tuesday August 28, 2018 @10:21AM (#17858947)
Oh hi, I'm Marijn, one of the maintainers. It doesn't look like this submission is going anywhere, but I'll keep an eye on the comments and respond to questions.
Re:We are rewriting CodeMirror by tobr on Tuesday August 28, 2018 @11:01AM (#17859291)
Would be interested in a short overview of contentEditable in 2018. Until very recently the consesus was that it's completely broken, but I understand from the design document[1] that it's good enough for you to build on now? Does it “just work” or is it only a slightly smaller mess than before?

[1] https://codemirror.net/6/design.html

Re:We are rewriting CodeMirror by marijn on Tuesday August 28, 2018 @11:07AM (#17859347)
It's underspecified and very hard to implement (and hence, not implemented all that well), but if you know the pitfalls (only some DOM/style structures are well supported, cursors vanish in some circumstances, etc) and avoid them, and implement non-trivial editing commands yourself (because you can't really rely on the browser to get them right), contentEditable is a functional way to represent editable content in the browser.
Re:We are rewriting CodeMirror by leeoniya on Tuesday August 28, 2018 @01:26PM (#17860763)
how do you plan to handle multiple cursors (eg: simultaneous-edit & collab), vertical / column selections, and multiple disjoint selections?
Re:We are rewriting CodeMirror by marijn on Tuesday August 28, 2018 @03:45PM (#17862208)
The DOM selection corresponds to the primary selection, the others are drawn using CSS spans. This means you only get touchscreen-style handles on the primary one, but I think that's acceptable.
Re:We are rewriting CodeMirror by antoineMoPa on Tuesday August 28, 2018 @02:29PM (#17861458)
By the way, how do we select multiple lines in chrome? I can do it in firefox in the "old" CodeMirror, but not in my chromebook.
Re:We are rewriting CodeMirror by marijn on Tuesday August 28, 2018 @03:46PM (#17862217)
Mouse drag or shift up/down works for me? Or what kind of selecting are you trying to do? (Or, if this was about multiple _cursors_, those are only half-implemented, and not exposed through the UI yet.)
Re:We are rewriting CodeMirror by short on Wednesday August 29, 2018 @06:04AM (#17867044)
Interesting! I actually wrote https://github.com/SjonHortensius/LRTEditor to replace CM, but the many subtle browser bugs eventually forced me to abandon it. Do you expect to use shims and possibly let browser-vendors fix bugs/inconsistencies you find?
Re:We are rewriting CodeMirror by marijn on Wednesday August 29, 2018 @09:46AM (#17868161)
We're not really using shims, just targeting the lowest-common-denominator contentEditable behavior that we can count on, and implementing anything else ourselves.
Re:We are rewriting CodeMirror by dyarosla on Tuesday August 28, 2018 @02:28PM (#17861440)
‘Because you can't really rely on the browser to get them right‘- welcome to the state of the web today- inconsistencies everywhere and no fix in sight :(

Now you either recreate things yourself or offload the consistency patching to a framework to (hopefully) correctly handle.

Re:We are rewriting CodeMirror by k_sh on Tuesday August 28, 2018 @02:54PM (#17861731)
Well, this has been the case with the web for a while. See: jQuery.
Re:We are rewriting CodeMirror by tnolet on Tuesday August 28, 2018 @02:45PM (#17861632)
Hi Marijn, I rely on CodeMirror for a SaaS I run (from Berlin). I will donate what I can. Just one question and please don’t take this the wrong way, but can you provide an insight into how you got to 80k as the target amount?
Re:We are rewriting CodeMirror by adrianheine on Tuesday August 28, 2018 @03:37PM (#17862150)
It's roughly what the two of us need (in addition to regular donations and support contracts) to be able to work on this for one year. We expect a year to be enough time for stabilizing the core and porting some essential plugins.
Re:We are rewriting CodeMirror by jazzyjackson on Tuesday August 28, 2018 @07:49PM (#17863960)
Hi Marjin, I've been extremely impressed working with Codemirror. The event API is really easy to work with and I love the ease of switching syntax modes and color schemes.

I'm building a product around CodeMirror and as a vimmer, I intend to carry Vim mode with me.

Will CodeMirror6 implement vim mode in a similar fashion?

I'll send you some coin either way, thanks again for developing such a great project!

Re:We are rewriting CodeMirror by marijn on Wednesday August 29, 2018 @02:44AM (#17866183)
> Will CodeMirror6 implement vim mode in a similar fashion?

This hasn't been decided yet—I'm aware how much people appreciate the vim bindings, but they are _huge_ (as big as the current core) and written by someone else. I'll probably take a stab at porting them when the new API is stable, and give up when it turns out to be too messy. On the bright side, they have a lot of tests, which helps with making sure I don't break them. But they _are_ still looking for a new maintainer, and even if I do port them, I'm not taking over maintenance.

Re:We are rewriting CodeMirror by brainkim on Tuesday August 28, 2018 @02:34PM (#17861524)
I’m currently in the process of writing a codemirror mode for a language I’m working on, is the way codemirror modes are written/used gonna change substantially? Should I hold off on this work?

I’m glad to see you’re focusing on accessibility!

Re:We are rewriting CodeMirror by adrianheine on Tuesday August 28, 2018 @03:39PM (#17862165)
Modes implemented against the current interface will be supported by a plugin. We are definitely planning on providing a better interface for highlighting eventually, but that will take some time.
Re:We are rewriting CodeMirror by louisstow on Wednesday August 29, 2018 @02:10AM (#17866047)
Hi Marijn. Big fan of ProseMirror. Would you look at building CodeMirror on top of (or at least sharing code with) ProseMirror so both projects can benefit from the effort?
Re:We are rewriting CodeMirror by marijn on Wednesday August 29, 2018 @02:41AM (#17866170)
There's a lot of architectural influence on the new CodeMirror from our ProseMirror work, but the actual systems are different enough that code sharing didn't really work (or, at least, would add enough levels of extra indirection and complexity to the reused code that it's not worth it—code size is a significant cost in JS components)
Re:We are rewriting CodeMirror by amelius on Wednesday August 29, 2018 @05:27AM (#17866910)
This makes me wonder. What would happen if you'd embed a piece of code inside a text document? Would you need to embed a CodeMirror instance inside a ProseMirror instance?
Re:We are rewriting CodeMirror by adrianheine on Wednesday August 29, 2018 @07:09AM (#17867280)
Re:We are rewriting CodeMirror by skybrian on Tuesday August 28, 2018 @02:45PM (#17861642)
I'm curious if you learned anything from studying monoco-editor from VS Code? Do they use a different approach?
Re:We are rewriting CodeMirror by marijn on Tuesday August 28, 2018 @04:27PM (#17862547)
I did study Monaco, but we're using a very different approach (Monaco resembles the current CodeMirror more), because what they do in almost impossible to make work on mobile. When it comes to accessibility, they do a great job, and I'm planning to take more inspiration from their code as I work on things like autocompletion
Re:We are rewriting CodeMirror by nkkollaw on Tuesday August 28, 2018 @06:55PM (#17863647)
Love the software. Awesome job!
Re:We are rewriting CodeMirror by simplify on Tuesday August 28, 2018 @06:15PM (#17863417)
Are you planning to make it easy to add autocomplete support for languages like TypeScript?
Re:We are rewriting CodeMirror by marijn on Wednesday August 29, 2018 @02:46AM (#17866194)
It should not be hard to do this as a plugin, but the core maintainers are unlikely to work on it.
Re:We are rewriting CodeMirror by Scarbutt on Tuesday August 28, 2018 @04:37PM (#17862629)
Why typescript? wouldn't that choice reduce the number people that can contribute?
Re:We are rewriting CodeMirror by marijn on Tuesday August 28, 2018 @05:39PM (#17863136)
It provides significant advantages when it comes to noticing bugs and including types (also for docs) in the code from the start. I feel that TypeScript is widely enough known at this point (and close enough to JavaScript to figure it out quickly) to not be too much of a barrier.
Re:We are rewriting CodeMirror by koolba on Tuesday August 28, 2018 @08:06PM (#17864030)
On the contrary, it makes it easier for people to contribute as their code is more likely to actually work.
Re:We are rewriting CodeMirror by chrisseaton on Tuesday August 28, 2018 @05:41PM (#17863153)
Is the programming language really the important thing that limits who can contribute? People who are skilled in writing text editors and development tools can probably adapt to TypeScript without any issue.
Re:We are rewriting CodeMirror by simplify on Tuesday August 28, 2018 @06:05PM (#17863349)
TypeScript is really just JavaScript with intuitive type checking.