Hacker News new | comments | show | ask | jobs | submit login

Can anyone compare this to Ace [1], if you've used both?

1: https://github.com/ajaxorg/ace




CodeMirror and Ace both have a long history of sane competition, and copied many of the ideas from one another. So much, in fact, that whenever I find myself in front of an Ace editor, I open up the DevTools and change the CSS to make the cursor 1 pixel wide. They have pretty much the same cursor display system!

A great difference, in my opinion, is the syntax highlighting systems. Ace's is more rule-based (as in, regex matches and regions), while CodeMirror's is more programmatic, which helps its JS mode show local variables in a different color.

There are also differences in the data structures used internally, afaik. Marijn can probably talk more about that.

On a different note, CodeMirror is being seriously considered independently in WebKit's and Firefox' DevTools, built-in. You may soon use it every day without even knowing!


Developer for Ace here.

The syntax highlighting rules for Ace were largely derived from tmlanguage files. This allows us to pretty easily import existing definitions. For example, Google had a tmlanguahe file for Dart that I was able to translate in less than an hour.

Could you describe more about what you like about CM's highlight rules? I admit I've never really looked into them. But I'm guessing by "show local variables in a different color" there's some parsing going on?


  > CodeMirror is being seriously considered independently in WebKit's and Firefox' DevTools, built-in.
Whoa, can you cite sources for these?



Wow, so it's already landed in Webkit, presumably behind some experimental flag. This is really neat, thanks.


As Marijn himself said ACE ≈ furniture CodeMirror ≈ timber [1].

Ace is more optimized for code -- multiple selections, indent guides, better folding.

Codemirror is smaller, and have better support for non english text (variable size and bidirectional). Also new features added in v3 -- lines with variable height, arbitrary widgets inside code, are quite impressive.

[1] http://marijnhaverbeke.nl/talks/goto2012/#4


> better folding

I'd argue that's not the case. The folding in CodeMirror v3 is on par with or even more powerful than ACE's.

> indent guides

If you mean the vertical rulers, they're not built into CM, but you can add one with a few lines of custom code.

> multiple selections

Should be coming to CM soon! https://groups.google.com/forum/?fromgroups=#!topic/CodeMirr...


>The folding in CodeMirror v3 is on par with or even more powerful than ACE's.

I agree that CodeMirrors general infrastructure for folding is more powerful than ACE's. But CodeMirror still lacks fold buttons on the gutter.

> If you mean the vertical rulers, they're not built into CM, but you can add one with a few lines of custom code.

True, but still when i use jsbin or cssdeck i wish they were built into CM:)

> multiple selections Should be coming to CM soon!

That's very good!

Also i forgot to mention that one of CodeMirrors advantages is a better name:)


> I agree that CodeMirrors general infrastructure for folding is more powerful than ACE's. But CodeMirror still lacks fold buttons on the gutter.

The folding utility in the distribution does lack them. But adding them (as in the 2.x code folder) is, again, just a few lines of code -- there's support for showing gutter widgets in the core, and the only reason the folding utility doesn't use that that I felt they didn't add much.


Codemirror is much more pleasant to develop with, and also (IMO) much better to use.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: