Sunday, October 14, 2007

Finally - A code editor that works

Since last christmas I've been looking for off-the-shelf code editor. The kind that captures tab and insert four spaces, the kind that groks JavaScript syntax and highlights reserved words, etc.

I tried using dojo's editor and editor2, but wasn't satisfied with the code aspect of it all. I didn't need formatting so much as syntax highlighting.

Then I saw Marijn Haverbeke's in-browser javascript editor, which kind of blew me away. It looked to good to be true, which turned out to be the case. Not because Marijn isn't a truly good programmer (I dived quite deep into the code at times), but because he used mochikit (without the optional namespacing).

The resulted in the editor borking most of dojo (which takes great pains to namespace itself and not to collide with other stuff on the page), which I relied on heavily for windowing and diverse stuff. I tried to refactor in namespacing in Marijns codebase for about a week before I gave it up. It was really a shame, and so until today I had just a plain textarea to use as editor for my spanking new online Web IDE. :-P

But I checked Marijn's site a couple of days ago, and he had added a link to realted projects, one of which was editarea by Christofer Dolivet, which turned out to be very well-behaved indeed.

OK, I had to be creative when I created things dynamically all the time, and I couldn't use just one instance of the editor, but had to create new ones and remember them and so on, but on the whole I must say I'm greatly relieved. Not everything works perfectly, but it looks good and it works well enough. And it's LGPL as well! Thanks!!


Marijn said...

(This is a late, late followup, but I happened to come across this while nacristically searching my own name, and I just have to add: The latest versions of CodeMirror no longer pollute your namespace, and play nice with other frameworks/libraries.)

Peter Svensson said...

Marijn, that's great news!
I'll have a look.