add tree-sitter integration #8

Merged
amartin merged 0 commits from refs/pull/8/head into master 2025-09-11 15:30:07 +00:00
amartin commented 2025-09-02 21:58:59 +00:00 (Migrated from codeberg.org)
No description provided.
amartin commented 2025-09-06 11:58:52 +00:00 (Migrated from codeberg.org)

Missing code: Janet runtime files modification to use the tree-sitter bridge and parse the buffer when loading the files in the buffer.janet runtime file.

NB: syntax highlighting will be tricky, and it will require TS queries support in the bridge. I'm not bothered to deal with it right now as we need more work before getting syntax highlighting to work anyway such as proper colorschemes and such. Might be addressed in the future.

Missing code: Janet runtime files modification to use the tree-sitter bridge and parse the buffer when loading the files in the `buffer.janet` runtime file. NB: syntax highlighting will be tricky, and it will require TS queries support in the bridge. I'm not bothered to deal with it right now as we need more work before getting syntax highlighting to work anyway such as proper colorschemes and such. Might be addressed in the future.
amartin commented 2025-09-11 15:22:43 +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.

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.
Sign in to join this conversation.
No reviewers
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!8
No description provided.