Feature: Finish tree-sitter integration #11

Open
opened 2025-09-11 15:30:37 +00:00 by amartin · 1 comment
amartin commented 2025-09-11 15:30:37 +00:00 (Migrated from codeberg.org)

Right now the only things that are missing are:

  • Incremental buffer parsing1.
  • Properly handle queries path2.
  • Syntax highlighting3.

1. It can be done easily I think, we can pass an old parsing tree to the Parser.parseBuffer function (old_tree: ?*const Tree).
2. Currently, I've made it so that embedded tree-sitter parsers install their queries into the ./zig-out/queries/ prefix or whatever the installation directory is when running zig build. However, that is not optimal for release builds yet. Ideally we should embed the whole bundle somehow, maybe using zig-embeddir to alleviate the pain. This will be addressed in another Pull Request as I want to tackle down other concerns at the moment.
3. This is more tricky and requires way more changes and effort, so it is out of the scope of the pull request to fully implement that feature. It requires a colorschemes system (even an unga bunga one would work), tree-sitter interop with vaxis through the Janet runtime and so on.

Originally posted by @amartin in https://codeberg.org/amartin/koa/pulls/8#issuecomment-7115761

Right now the only things that are missing are: - Incremental buffer parsing<sup>1</sup>. - Properly handle queries path<sup>2</sup>. - Syntax highlighting<sup>3</sup>. <sup>1</sup>. It can be done easily I think, we can pass an old parsing tree to the `Parser.parseBuffer` function (`old_tree: ?*const Tree`). <sup>2</sup>. Currently, I've made it so that embedded tree-sitter parsers install their queries into the `./zig-out/queries/` prefix or whatever the installation directory is when running `zig build`. However, that is not optimal for release builds yet. Ideally we should embed the whole bundle somehow, maybe using [zig-embeddir](https://github.com/ringtailsoftware/zig-embeddir) to alleviate the pain. This will be addressed in another Pull Request as I want to tackle down other concerns at the moment. <sup>3</sup>. This is more tricky and requires way more changes and effort, so it is out of the scope of the pull request to fully implement that feature. It requires a colorschemes system (even an unga bunga one would work), tree-sitter interop with vaxis through the Janet runtime and so on. _Originally posted by @amartin in https://codeberg.org/amartin/koa/pulls/8#issuecomment-7115761_
amartin commented 2025-09-12 14:15:29 +00:00 (Migrated from codeberg.org)

Update: 2nd point is missing right now, 1st and 3rd have been implemented.

Update: 2nd point is missing right now, 1st and 3rd have been implemented.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
NTBBloodbath/koa#11
No description provided.