Astedit

Download demo video here
Source code on github

astedit is a little text editor project that I started because I wanted to experiment with the implementation of basic IDE functionality, such as syntax highlighting and code navigation. The goal is to create something that can give instantaneous feedback for almost all interactions and editing operations that developers typically do, even in huge code bases. Unlike most large IDEs, which are often sluggish and sometimes have glitches in their syntax highlighting.

Currently, astedit is not very useful. Only basic text editing functionality is implemented. But I think the source code already has solid foundations, and should be easy to read and modify/extend. It's written entirely in C, and the nice thing about the code is that it is pretty small and self-contained, using only libc, Freetype2 and GLFW3 / OpenGL 3 as dependencies. It compiles and runs on Windows (Visual Studio) and on Linux (with the exception that sometimes new platform specific implementations are missing for some time), and can easily be ported to other platforms.

astedit can already load huge files and carry out most user interactions without noticeable latency (most operations take < 50 us, many take < 20 us, tested with an 1.8G text file).

Next, I hope to add an incremental parser for a C-like programming language, providing instanteneous and complete syntax highlighting, among other features.

References

After implementing the internal data structures for this editor, I found Raph Levien's documentation of his Xi Editor project. I highly recommend the "Rope science" pages there. I noticed that he has taken a very similar approach (combining a balanced search tree with monoids, if you like buzzwords), only even more principled and general. On the other hand, I suppose astedit is faster and easier to read (it's less general, not implemented in Rust, has no distributed architecture, does not depend on > 100 crates).


Page Created: 2019-08-11