News for hackers. Stuff that matters.
Re:Emacs Tree-sitter custom highlighting by vzaliva on Sunday March 02, 2025 @01:52PM (#43233640)
I think the main problem is that highligthing framework used by tree-sitter (https://github.com/tree-sitter/tree-sitter/tree/master/highl...) is not easily pluggable into emacs font-lock-mode.
Re:Emacs Tree-sitter custom highlighting by toomim on Sunday March 02, 2025 @04:44PM (#43235498)
I wrote similar code in emacs for harmonia-mode in the past. Let me find and share the source code. We don't need font-lock. We can just borrow the styles it uses.

*Update:* I found the code. Instead of using font-lock, we simply draw our own overlays over the text and color them, which is what font-lock does. Font-lock IIRC is specifically designed to use regexps to parse the text. We don't need that. So throw font-lock away. Tree-Sitter itself knows how the parse tree maps to text regions. Just use that information to draw the overlays directly. It's way simpler that way.

Lemme know if anyone wants the code.

Re:Emacs Tree-sitter custom highlighting by vzaliva on Monday March 03, 2025 @12:05PM (#43243968)
It's starting to sound like it's time to create a GitHub repository and start putting it all together.

My elisp skills are basic, so I could help more with testing, coordination, publishing packages, or documentation.

Shall I create the repo?

Re:Emacs Tree-sitter custom highlighting by vzaliva on Monday March 03, 2025 @05:13PM (#43247493)
repo created. I've sent you a request on github.