It would be interesting to know how many sales you get from a niche book like this though.
It would be interesting to know how many sales you get from a niche book like this though.
For example, the multiple cursor thing at the end is enabled by having the concrete syntax tree from Tree-sitter's parse, but Tree-sitter has nothing whatsoever to do with the cursors: it just provides locations in the text based on particular queries (like "all `identifier` nodes named 'foo' that are sub-nodes of this other node").
Even the headliner feature, syntax highlighting, isn't provided directly by Tree-sitter. It's up to the client system to inspect the syntax tree and apply attributes to its rendered text -- however it does that rendering.
Somewhat of an aside about building grammars, I have found that the grammars are relatively hard to make small modifications or extensions to. Whereas it's relatively easy with e.g. traditional Vim syntax highlighting. Making grammars easier to extend would be valuable for users of languages like SQL that have a zillion custom dialects.
That's interesting; what do they use the results for?
> I have found that the grammars are relatively hard to make small modifications or extensions to
Definitely true. I think this may be an inherent problem of the system and the parser generation, though. I am not sure it's solvable by the grammar authors.
- Much better (and faster) syntax hilighting
- Shrink and expand selection (select variable, all variables inside parentheses, the whole block, the whole function)
- Select next or previous sibling node
- Goto matching bracket from where I am right now
- Jump between functions
- Jump between type definitions
- Jump between parameters
- Jump between comments
- Jump between tests
I think Helix must be the easiest way to start experimenting with tree-sitter. You need no plugins, just install the editor and start experimenting: