Modern Tree-sitter, part 5: injections

One annoying thing that software developers do is insist on writing in more than one language at once. Web developers are espeically obnoxious about this — routinely, for instance, putting CSS inside their HTML, or HTML inside their JavaScript, or CSS inside their HTML inside their JavaScript.

Code editors like Pulsar need to roll with this, so today we’ll talk about how the modern Tree-sitter system handles what we call injections.


savetheclocktowerNovember 10, 2023
  • dev
  • modernization
  • tree-sitter
About 16 min
Modern Tree-sitter, part 4: indentation and code folding

Last time we looked at Tree-sitter’s query system and showed how it can be used to make a syntax highlighting engine in Pulsar. But syntax highlighting is simply the most visible of the various tasks that a language package performs.

Today we’ll look at two other systems — indentation hinting and code folding — and I’ll explain how queries can be used to support each one.


savetheclocktowerOctober 31, 2023
  • dev
  • modernization
  • tree-sitter
About 13 min
Modern Tree-sitter, part 3: syntax highlighting via queries

Last time I laid out the case for why we chose to embrace TextMate-style scope names, even in newer Tree-sitter grammars. I set a difficult challenge for Pulsar: make it so that a Tree-sitter grammar can do anything a TextMate grammar can do.

Today I’d like to show you the specific problems that we had to solve in order to pull that off.


savetheclocktowerOctober 13, 2023
  • dev
  • modernization
  • tree-sitter
About 16 min