At one extreme, you have editors like JetBrains IDEs that have a full and deep understanding of a particular language and can do very powerful things very easily, but require a team of developers to implement and maintain for each language.
At the other extreme, you have Kakoune, which knows almost nothing about any language, but has a bunch of primitives like
]p and regexes that can be composed for each editing task. Kakoune’s primitives are versatile, but it’s always bothered me that Kakoune (and Vim before it) are so heavily based on regexes when they’re often used to edit structured data, and regexes can’t match structured data. Sure, Kakoune provides some special-case structured primitives like
]c, but it’s easy to fool
m with grouping characters inside strings.
I’d like to try (maybe not use, but try) an editor that is to parse-trees what Kakoune is to regexes - you’d need a syntax for defining grammars not much more complex than regex syntax, operators to find text chunks matching a grammar, that kind of thing. Even better, if you had a grammar for some particular file-format, you could use that for syntax highlighting, or to allow structural navigation (imagine consecutive presses of a key selecting the surrounding word, then the surrounding expression, then the surrounding
if block…). You could even let the user reference existing syntax nodes in ad-hoc grammar expressions, so you could say “select string literals” without having to on-the-fly invent a regex for this particular language’s string syntax.
I imagine the result could be something like tree-sitter, but the creating parsers documentation is a lot more heavy-weight than writing a regex.