New Project: SyntaxArea

I feel like I'm constantly reinventing the wheel.

I have an app in mind that I want to build with Xojo. A central component of that app is a text editor that's able to colourise Markdown, HTML and a few programming languages. There are several code editors available to the Xojo developer (including a pretty good one that I wrote and currently sell called XUICodeEditor) but none of them meet all of my requirements so I'm going to create my own (again).

The editor must meet the following criteria:

  1. Fast enough to edit documents containing hundreds of lines of code / Markdown without slowing down.
  2. Be able to highlight different languages within the same document. For example, Xojo code within a code fence of a Markdown document.
  3. Fully API 2.0.
  4. Support autocompletion.
  5. The syntax highlighting colours and the colours of all the components of the editor must be user customisable.
  6. Fully supports dark mode.
  7. Handles emoji.

I looked at the following code editors available for Xojo:


My commercial code editor for Xojo. Don't get me wrong, I think this is a great editor for most developers. The only requirement from above that it doesn't meet is that it's not fast enough to handle documents containing hundreds of lines of code. In some respects this is by design. The original use case for XUICodeEditor was to highlight small blocks of code, perhaps a hundred lines or so. For that purpose it works very well. The other issue with XUICodeEditor is that it highlights characters using small parser classes which, by their nature, are inherently slower than regex-based highlighters. Also, they're a bit more involved to write.


CustomEditField is a venerable syntax highlighting text area based on the native Xojo canvas. It was originally written many years ago by Alex Restrepo and is now maintained on GitHub by Thomas Tempelmann. This is an excellent editor and I thought it would work in this new project but it's API 1.0 so is a no-go. That's a shame because it handles enormous documents with no slow down.

MonkeyBread Scintilla Plugin

Hardly surprising but Christian over at MonkeyBread Software has a source code editor plugin. I say hardly surprising because Christian seems to have a plugin for everything! His plugin wraps the Scintilla editor and makes it available to Xojo developers. I don't mind using a closed source plugin if necessary but the issue with Scintilla is adding support for new languages ("lexers") has to be done via C and Christian would need to add them. Additionally, the existing lexer for Markdown does not highlight code within code fences so this won't work either.


The last contender on my list is Anthony Cypher's GraffitiSyntaxEditor. This isn't a bad option - Anthony has essentially wrapped the Javascript-based open source Ace editor editor. I have a couple of concerns however. Firstly it's ridiculously expensive. I really cannot justify $399 dollars per year to use it. Secondly, whilst Anthony is very responsive, I would likely be beholden to him to add new lexers to the editor.

What I've decided to do is create a brand new text editor. It's called SyntaxArea and I'm planning on developing it in the open with the code freely visible to anyone. It already has it's own GitHub repository. You might wonder why on Earth would I create a competitor to XUICodeEditor and give it away for free. Well, I think developing this editor will be interesting and will give me something to write about here and if the code is open source then that makes it easier to do so. Furthermore, I'm going to use some of the techniques in CustomEditField in SyntaxArea and since that's open source I feel better about using Alex and Thomas' code if I also make SyntaxArea open source.

I've already begun working on the project. I'll warn you about the repository however. The code will almost certainly frequently break in the early phases as I iterate on how best to implement something. I'm pretty confident this will ship since I've already written a full featured editor previously so I know I can do it.

Subscribe to

Sign up now and never miss a new post. It's free.
Jamie Larson