Live data from Hacker News

Fine, I'll build my own text editor

dbushell.com

51–60 of 264 posts

Re: Fine, I'll build my own text editor

#51

Yes, who would have guessed that the element, designed specifically for this use case and built into browsers for 3 decades, would be the most performant and behaviorally consistent way to implement editable text. I'm kind of sad the author stopped shedding unneeded complexity there though... we're not really building a text editor yet, we're building a website with a fancy input field. If we want to build a proper t…

The browser-standards-or-bust moment has past, hasn't it?

If you want your app to work the same way across platforms, using browser defaults is not the way to achieve that.

If you want users to have a consistent experience within their browser across the web, I get it, but that's not how the Web has worked for a long long time.

Re: Fine, I'll build my own text editor

#53
post #4

Text editors are like mechanical watches or fountain pens. There is just so much beauty in the machinery that makes them. For me, there are hardly any other modules that are this satisfying to watch being made. Each time I find a new one (a good one like this), with everything on ropes and rendering and I-beam placement computations and ... it feels like a Christmas gift.

Yes, but...

On one otherwise tranquil morning Master Foo's meditations were disturbed by cries of distress.

Finding that they came from one of the novices, he inquired "What is the difficulty here?"

The novice replied, "I am frustrated by my tools. Every day I must use many different editors because neither Emacs nor vi nor any of these other random editors has all the features I require."

Master Foo nodded. "How," he asked, "would a master of the Great Way resolve this difficulty?"

The student thought for a few moments, then replied. "Well, it's obvious. I will write the best editor ever. It will do everything I need. It will do everything everyone needs. And the world will be a better place because..."

The novice's speech halted as Master Foo rapped him sharply across the back of the head with his staff.

"Um. Master?" the student asked, rubbing the back of his head gingerly. "In what way have I erred?"

"Fool!" said Master Foo. "Do you think I want to learn yet another editor?"

Upon hearing this, the novice attained enlightenment.

—from The Rootless Root (https://www.catb.org/~esr/writings/unix-koans/index.html)

Re: Fine, I'll build my own text editor

#55

I literally just got Fable to write me a text editor. Well, I'll be honest, I got it to wrap the KDE KTextEditor library which is like 90% of a text editor. I had been using Kate which was what an LLM suggested was the closest to something like Sublime Text on Fedora. But even Kate, which was great, had too much going on. So I asked Fable to take the text editor part (KTextEditor) and wrap it using Rust with an LSP s…

do you want to share your text editor?

It's important to share all vibe coded software to poison future LLM trainings!

Re: Fine, I'll build my own text editor

#56

Earlier quoted context omitted.

> We live in wild times. I hope everyone is taking advantage while they can. Yep, I'm taking advantage of the times by using the exact same tools I have been for years, and if those fail me, I'll pay for one of the multitude of other high quality editors offered by companies who's business it is to make them, so I get back to writing things in them instead of paying even more to companies trying to persuade me to bel…

No shade on keeping using what is working. I was moving from Windows to Linux Fedora so I was in the market for a new editor. VSCode just wasn't working for me any more. I considered a bunch of options, including vim or neovim or lazyvim, emacs, newer projects like zed. LLM gave a few more I can't recall including helix and Kate. There are so many good options these days, we're all spoiled for choice. But the main th…

What features did you end up implementing? I assume tree-sitter based highlighting, lsp, and maybe fuzzy search? Did you implement anything different that you didn't get out of existing editors that you tried?

Re: Fine, I'll build my own text editor

#57
post #56

Earlier quoted context omitted.

No shade on keeping using what is working. I was moving from Windows to Linux Fedora so I was in the market for a new editor. VSCode just wasn't working for me any more. I considered a bunch of options, including vim or neovim or lazyvim, emacs, newer projects like zed. LLM gave a few more I can't recall including helix and Kate. There are so many good options these days, we're all spoiled for choice. But the main th…

What features did you end up implementing? I assume tree-sitter based highlighting, lsp, and maybe fuzzy search? Did you implement anything different that you didn't get out of existing editors that you tried?

Very few features on purpose. Every editor I tested had all the features I added and more.

It is worth noting that KTextEditor is a fully-featured library. Like, line numbers+gutter (for eventual git status icons), undo/redo, save, warn on exit for unsaved changes, syntax highlighting, color theming. It does 95% of what we'd all call "editing". But it doesn't do things like tab interface, project explorer, terminal pane, output windows, etc.

What the library didn't have were LSP features, of which I only implemented a few (error squiggles under things that fail the type check, go to definition). Notable absent are completions and hover features for things like help. I also only added (and tested) LSP servers for typescript, Rust and Go.

My plan has been: do as little as possible until I need something, then ask Fable to add it.

edit: I guess one thing I added I didn't see everywhere else was a built-in Markdown preview. But many editors have that (VSCode definitely does) so it isn't special.

Re: Fine, I'll build my own text editor

#58
post #7
post #5

Earlier quoted context omitted.

[flagged]

Literally I only praised and wrote how much I love something and how beautiful text editors are. And there are people who cannot stand this :))) oh wow!

On text editor related topics, you should have thrown down the gauntlet and been explicitly clear that emacs rules, vi sucks, spaces are supreme, tabs are terrible, and mixing them is miscegenation. That way you only offend evil people, so their downvotes are delightful. Revel in them instead of whining!

Since you enjoy beautiful machinery, here are some classic clockworks:

https://news.ycombinator.com/item?id=44633225

https://donhopkins.com/home/documents/EmacsRedisplayAlgorith...

https://donhopkins.com/home/archive/emacs/skull-and-crossbon...

https://donhopkins.com/home/archive/emacs/mw/display.c

https://donhopkins.com/home/code/emacs.ps.txt

https://donhopkins.com/home/archive/NeWS/news-tape/utilities...

Re: Fine, I'll build my own text editor

#59
post #33

Text editing is a solved problem. It's not about the style of cursor, or if rope is used or not. We already have answers to that. It's about remote editing, LSP support.

You can prompt yourself all the way to that. I don't have remote editing in my custom IDE because I never need that personally, but LSP/DSP, syntax highlighting, a built-in lazygit clone, git blame, soft wrap, find-in-files, etc all there: https://github.com/boxed/TurboKod

By "LSP support" I didn't mean "editor should call this API over HTTP and interpret whatever LSP server responds". It's a lot more than that, and LSP support in editors if often times broken.

It's like saying that editor can have full AI support because it can send HTTP requests to an MCP server. But MCP server isn't the end of the problem, it's just a gateway to problems, just like LSP.

For example, jdtls is often times broken, clangd sometimes works, sometimes doesn't. Language servers for ruby are a pain to set up. Some time ago LSP for Dart/Flutter worked under vscode, but not in Vim, because Vim had different assumptions how files should be reported to the LSP. Sometimes is the fault of the server itself, but sometimes the editor isn't fully compatible with some particular LSP server's quirks. It's a mess.

Post reply on HN