Treesitter support for syntax highlight
jvalkeal opened this issue · 0 comments
jvalkeal commented
This is an issue to add initial support for syntax highlighting powered by treesitter.
Treesitter is a c language based library providing fast opinionated parsing of a different language syntaxes(aka grammars). It's currently used i.e. in GitHub and NeoVim to provide various language features which don't need deep contextual knowledge what Language Servers typically are able to provide.
For basic FFM support there is #1131 and to continue these stories going beyond what we're able to do natively in a pure java we should experiment adding FFM native side where we compile shared libraries and use those via FFM.
What we're focusing:
- Building
spring-shell-treesitter
core treesitter bindins and core java based classes. - Generic integration with existing grammars by mostly generating language modules automatically.
- Grammar support starting with 3 languages;
java
,json
andyaml
. - Cross compiling shared libraries using zig initially targeting x86_64(windows, linux, macos) and arm64(macos).
- Support for common treesitter query predicates starging with
eq
andmatch
families. - Don't keep compiled shared libraries in a git tree(binaries cause issues with repo size), instead build/compile everything on github actions and provide support to compile things locally to support development.
- Add
treesitter query
andtreesitter highlight
commands tospring-shell-sample-ffm
loosely mimickingtree-sitter-cli
.
What we're not focusing:
- Generic purpose java bindings for treesitter.
- While we may end up with a generic binding library(some time in future) we want to keep things opinionated/closed towards providing syntax highlighting while we learn more about using FFM in Spring Shell.
- Supporting grammars which are not pure c based. There are semi-deprecated c++ support in treesitter which some community based grammars are using. Treesitter's focus is to solely recommend c based grammars which follow common grammar project structure.