Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treesitter support for syntax highlight #1134

Open
jvalkeal opened this issue Sep 8, 2024 · 0 comments
Open

Treesitter support for syntax highlight #1134

jvalkeal opened this issue Sep 8, 2024 · 0 comments
Labels
type/enhancement Is an enhancement request

Comments

@jvalkeal
Copy link
Contributor

jvalkeal commented Sep 8, 2024

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 and yaml.
  • 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 and match 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 and treesitter highlight commands to spring-shell-sample-ffm loosely mimicking tree-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.
@jvalkeal jvalkeal added the type/enhancement Is an enhancement request label Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Is an enhancement request
Projects
None yet
Development

No branches or pull requests

1 participant