I Want to Write an Editor

Published on to joshleeb's blog

It started in February 2024, this idea to write a code editor. As I write this, I can imagine the look on some faces reading. Perhaps a smile, knowing the pain I am launching myself in to. Perhaps a shake of the head, or maybe a more appropriate bang of the head on the table in front of you.

What made me lose my mind, you ask? What made me want to take the leap and potentially plummet to my death?

Vim/Neovim had served me well for over a decade. I had come to love its modal editing, customizability, minimalistic environment, and its fast, distraction free space. But. The inevitable 'but'... I wanted a smoother, less restrictive experience.

Yes, I had dabbled with Emacs, many times over. It never stuck, despite admiring the philosophy, extensions and aesthetics of this editor. I switched to VSCode for larger codebases and found I could get a lot more done.

Finally, I gave in and started using IntelliJ. Not just for JVM languages, but for all my coding. I appreciated a lot of what IntelliJ gave me: file trees, execution profiles, automated refactoring and better debugging. The Vim plugin wasn’t half bad either. With enough tweaking I could get rid of a few distractions like the inlay code hints and the overly pushy AI features. But I wasn’t happy.

Ah, the itch so many of us have felt. "I could do it myself..." I thought, "I could build a graphical editor, how hard can it be?"

So, I decided that’s exactly what I’d do.

I was going to build an editor, one that I could make better for me. Fittingly, I chose to call it Ica, short for Icarus. You know... the guy that flew too close to the... you get it.

Conceptual Studies, Gaining My Wings

Despite having this grandiose idea, I first had to address the fact I knew absolutely nothing about building an editor, let alone a native, graphical code editor. Nothing about rendering, or graphics, or the GPU. I had no clue which data structures to use for representing the buffer contents, or what the architecture should be for the many visual to logical mappings.

I began with rendering, specifically text rendering, as without it there is no editor. I suppose the same could be said about almost all components of what needs to be built.

For much of my spare time in 2024/25 I worked on studies; throwaway concept projects (repo) to better understand problems, solutions, and everything in between. There were studies on building a glyph atlas, working through text shaping and positioning, and expanding up to a simple file viewer with smooth scrolling. Many of these are discussed in previous log entries.

Some of these concepts were built with software rendering, others used libraries like Skia. But I knew that I wanted to work with the GPU directly, so I started figuring out a possible graphics stack: Rust, WGPU, SDF for rendering shapes for the UI and text rendering with a texture atlas.

The Tera Milestone

Around mid-2025 I took a break from thinking about Ica, text rendering, and building a code editor. There was a lot of life happening (including getting married!) and I had other personal projects I wanted to work on, such as redesigning this blog.

But before the break I had set myself a milestone that would mark the end of the concept phase. I wanted to build a simplified text editor before starting work on Ica. This would be a bigger conceptual study that would help me understand the application architecture and logic.

I was inspired by Antirez's terminal editor Kilo, and wanted to replicate it as a native, graphical application. Kilo's name comes from being an editor written in less than 1k lines of code. I wouldn't impose that constraint and figured even this simple editor would take more code than that, so I named it Tera.

Last month I got stuck back into Ica, and I started with Tera. I chose to focus on the application layer of the editor I built on top of JavaFX as this would let me skip most of the rendering, layout, and reactivity concerns. This decision paid off, as a few weeks later study was complete, and the Tera Milestone was reached.

You can read more about Tera on the project page.

Present Day, Taking Off

With Tera done I feel confident (and overwhelmed) at starting on Ica properly, shifting back to the stack I envisaged many months ago: Rust and WGPU.

"How hard can it be?" Obviously the answer is very hard. But, every one of these problems has been solved before; they are all tractable. We have advanced code editors built by teams at large companies and by individuals which started from one-person side projects - I only just came across FRED today.

I want to build a graphical code editor, for me. I want it to be high quality and have a hand-crafted feel, and I want it to last me decades. So I guess that's what I'll do.

I count myself lucky. In many ways, I have numerous Daedalian figures to look to with helpful, hopefully sanity saving instructions (fingers crossed).