Calling all web coders - have you tried Bespin yet? It's a new project from Mozilla Labs attempting to bring a full-featured, collaborative editor to the web. Right now it's in the early stages of development (version 0.2.2) but you can take it for a test run today.
Bespin includes syntax highlighting, pop-up status messages and a command line; the editing component is a bit glitchy under Firefox 3.0 but these are early days. At the recent Yahoo Hack Day event we had a quick chat with Joe Walker, one of the four Mozilla Labs developers working on Bespin, to find out where this rather cool project is heading. Best of all, we met up on the brilliant Yahoo Bus...
TuxRadar: So, another code editor - what's special about this one?
Joe Walker: There've been plenty of attempts to write code editors on the web, and they're generally very slow. They're slow because they're using the DOM to handle potentially big files, and as soon as you get towards a thousand lines, it becomes quite unmanageable.
So our approach was... What can we do with the web to make this work? And the other thing is that you can do collaboration on the web.
TR: Collaboration would be the biggest deal on the web...
JW: One of the key concepts is the status message - a bit like Twitter for developers in that you can say what you're doing. If you're working on a bug you can say "I'm working on bug 54" and those status messages pop up everywhere.
It would be handy if, whenever you commit a file, it remembers the status messages that you had already seen when you saved it. Then, when you commit it, it regurgitates those status messages - do you want to use these as part of your commit message?
And then: what are my team members doing? You can see all their status messages. But the really cool thing would be... someone on a different branch is editing the same file as you, and you want to avoid a merge conflict, but normally you wouldn't know. But if this thing is online and you go and edit a file, it says "Oh by the way, some other guy is editing it and look, here's what he's doing - he's working on bug 29, he's going to make those changes, and you might want to hold off for a while".
TR: There must be a timeout period though - if some guy starts working on a file and then gets bored and does something else, you don't want to be told that he's still working on it!
JW: Well because this is all online, we know if he's actually doing something right now. And actually, the information "he did this a year ago and hasn't done anything since" might still be interesting. He might've had something interesting to do a year ago, he might've left it now, but that still could be useful.
Collaboration is unexplored territory. We've got IRC chat, but there's a whole bunch of interesting stuff we could do here.
JW: Part of the reason is, in HTML 5 there's a bunch of stuff like Web Workers. You can offload onto a different thread some processing. We have two syntax highlighters: one's very simple and one's far cleverer. Actually, if you want to do a really good job with syntax highlighting, you've got to basically write a compiler.
You're looking at the bottom of a file, and the very first line might be a comment character! And then all of a sudden the whole thing is going to be a comment! So if you've got a 26,000 line file, and you want to do a proper job of syntax highlighting, you've got to read all 26,000 lines.
I think the idea is, you'd start off by doing a quick render just on the lines that are visible, and then on a different thread we can go through and do the whole thing properly. There are a bunch of tricks we can do like that.
TR: There's heavy use of the canvas tag in this, which puts IE out of the question right?
JW: We have nothing against IE - it's just that, part of the experiment is what can we do with standard web stuff, and how far can we take the web, and what barriers do we need to run in to, so that we can go back to our canvas guys and say "we really need this".
There's two halves to it - one half is experiments, where it's just "what can we do?" and the other half is a very practical, "let's actually write a real editor". I think it needs a grounding in real work - it's not just a toy!
TR: What timeframe are you looking at for 1.0?
JW: I have no idea - we're just planning 0.3 at the moment! We're saying to ourselves: what do we want to get done this year? Collaboration features are one of those, and the biggest thing we're working on is working with other people - a bunch of people want to use Bespin in various different projects. Top priority at the moment is making all that kind of stuff work.
TR: So it'll be ready when it's ready!
JW: Yeah... Which is a naff answer I know! But a whole bunch of other people have jumped on it already and contributed cool things. A lot of the syntax highlighting is not done by any of us. There's a whole bunch of cool stuff there. And it's all MPL.
You should follow us on Identi.ca or Twitter