Sunday, April 05, 2009

Experimenting with lexical auto-indentation for bespin

While the basic features of the codemirror syntaxengine now are part of bespin (and that is just syntax highlighting), I started today to experiment to add an advanced feature: Auto indenting of current line or a selection based on lexical analysis. The user just has to press CTRL + TAB (but could be any other key binding of course). The information about what codemirror thinks is the correct indentation is already internally stored for each line of the source document, all I had to do was to add some code which inserts or deletes some whitespace at the begin of those lines the user marked for auto-indentation. That is at least what I thought. Unfortunately it doesn't work yet reliable (and that is my fault, because the original codemirror editor does perfectly auto-indent) and also is not yet integrated into bespins undo/redo system, so it needs another iteration, before I can submit a patch, but if anybody wants to help working on it, take a look at the auto-indent code I added.

No comments: