r/JavaFX • • 4d ago

AI Assisted/Generated Editora: a keyboard-driven code editor built on JavaFX 27 and RichTextFX (open source, MIT)

I've been building Editora, an open-source code editor for Linux, macOS and Windows, on JDK 25, JavaFX 27, RichTextFX and AtlantaFX. It has LSP and debugger support for a long list of languages, Git with diff and merge views, Local History, a Markdown preview with math, and a Project Map that lays out your project on a canvas (still in beta). The installers bundle their own runtime, so you don't need a JDK.

A few JavaFX things I ran into along the way:

  • I forked RichTextFX to add multiple cursors and column selection. I also forked Flowless, the virtual flow underneath it, because it re-measured every visible line on each layout pass. Fixing that took FX-thread allocation per keystroke from about 7 MB to about 2.4 MB.
  • The packaged builds ship a JDK 25 AOT cache, trained against the app image's own runtime. First paint went from about 1.7 s to about 1.0 s on my machine.
  • When Prism can't start the GPU pipeline (on Linux, usually after a driver update without a reboot), the whole window lags. Editora now tells you in the status bar and in the Doctor, and turns off menu shadows in that mode, since redrawing the blur on every hover is what made the menus slow.
  • The performance tests in CI count frames per keystroke and FX-thread allocations instead of timing things. Counts come out the same on a busy CI runner as on my laptop.

Most of the code is written with Claude Code. I review it and rely on tests and build checks (NullAway, architecture tests, the performance budgets) to catch what I miss. I wrote about that here: https://www.adeleon.dev/blog/editora/

If you try it, I'd like to know how it runs on your setup, especially HiDPI on Windows and rendering on Linux. And if you've used RichTextFX for something big, what problems did you hit?

59 Upvotes

20 comments sorted by

5

u/d3ep4k 3d ago

I love anything built with javafx, building a code editor is hard. Live editor features are hard.

2

u/jacklackofsurprise 3d ago

Yes it is! this started as a simple Notepad clone, and I've learned a lot building it. Mad respect to all the text editors/IDE developers out there!

2

u/PartOfTheBotnet 3d ago

I also forked Flowless, the virtual flow underneath it, because it re-measured every visible line on each layout pass. Fixing that took FX-thread allocation per keystroke from about 7 MB to about 2.4 MB.

Can you open issues in the upstream repo with descriptions of the problems + possibly a PR for solutions to those?

2

u/jacklackofsurprise 3d ago

I don't know if my fix is good enough for upstream ("works for me!") but yeah, I'll open an issue/PR

1

u/john16384 3d ago

What you could check is that richtextfx isn't triggering a parent layout on each character typed. It's a common mistake to call requestLayout when there are no bounds changes but only content changes. If bounds are unchanged just do setNeedsLayout(true)

1

u/Siedlerchr 3d ago

Why not use the new JavaFX richtext incubator instead of the old richtextFX? We have used it at JabRef for a while for displaying and modifying BibTeX entries with few problems. And the maintainer is happy for feedback on the usage.

2

u/jacklackofsurprise 2d ago

I finally tried it.

I skimmed the API and wrote a small benchmark comparing it with the RichTextFX fork Editora uses.

It's a nice control, but a few gaps keep me on RichTextFX for now. Sharing in case they're useful:

Liked:

  • A plain-text model plus a SyntaxDecorator that styles lines on demand is a much nicer design than pushing style spans.
  • 200k lines (about 9 MB) opened in about 0.4 s with about 40 MB of heap. Bare RichTextFX took about 1.3 s and 160 MB, though part of that is my benchmark styling the whole RichTextFX file up front.
  • The left/right side decorators fit a gutter well.
  • Dropping ReactFX, Flowless, UndoFX and WellBehavedFX (and my Flowless fork) would make packaging a lot simpler.

Issues (for me at least):

  1. No public caret or character bounds. getTextPosition(x, y) is the only public hit-test (I think?), and I need caret bounds for things like completion popups and hovers.
  2. No viewport API: I can't get the visible line range or scroll a line to the top. I saw the scroll-caret method in openjdk/jfx#2376 for 28, but I'd need more than that.
  3. Typing cost. In a bare CodeArea, one typed character called the decorator about 260 times (the whole sliding window gets rebuilt) and allocated about 9 MB on the FX thread. RichTextFX allocated about 2.7 MB in the same benchmark, at 2k, 50k and 200k lines alike. It's a very basic benchmark, so maybe I'm missing something obvious.
  4. Multiple carets. I know they're a non-goal, but some kind of hook would let an app build them itself. Multiple carets are the main reason I forked RichTextFX.
  5. Folding. I couldn't find a way to hide lines. Is there an intended way to do it?
  6. Inline nodes in CodeTextModel: does an inline node count as a character in TextPos offsets? I use inline nodes for inlay hints, which must stay out of the text.

If 1 and 2 land and typing gets cheaper, I'd like to move, it does look like good control! Thanks to Andy for the work.

2

u/Siedlerchr 2d ago

I suggest you report those to the mailing list as feature requests

1

u/jacklackofsurprise 2d ago

will do, thanks!

1

u/jacklackofsurprise 3d ago

I've read about it but I have not tried it. I will take another look

1

u/eliezerDeveloper 1d ago

Intellij its so big now around 2gb and consumes so much RAM. Your app consumes less RAM? If it does I willl download and test it here. 

1

u/eliezerDeveloper 1d ago

I am testing here, its good

1

u/eliezerDeveloper 1d ago

Tô gostando demais da sua IDE mano. Ela é muito leve, tô falando em meu idioma agora porque é mais fácil pra mim. Abraços do Brasil.

-3

u/Objective_Pepper_217 3d ago

We already have too many bloated editors... Java is not a suitable choice

2

u/jacklackofsurprise 3d ago

Can you be more specific? In my (very crude) tests, Editora is a tiny bit faster than VSCode at loading and almost twice as fast as IntelliJ: https://editora-project.dev/#performance

I find the Java/JavaFX combo to be very fast. The downside is memory, it does consume a lot of memory for that performance.

Of course text editors like Sublime or Notepad++ are faster, but I wanted a simple text editor that could become a full feature IDE with a click of a button. (That's literal by the way, on my PC I use Editora as a file viewer for text files and if I need more features, just click the "E" button to switch to full IDE mode.

1

u/jacklackofsurprise 3d ago

Oh, I'm also using the AOT cache trick (on the native installers only) and that gives me around a 40% decrease in loading times.