Skip to content

Update grammar for Tree-sitter ABI 14 compatibility #1

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

Closed
wants to merge 1 commit into from

Conversation

BernardIgiri
Copy link

This updates the grammar to work with [Tree-sitter ABI 14](https://tree-sitter.github.io/tree-sitter/using-parsers#abi-compatibility), which is required by Helix Editor 25 and other modern tooling.

I was trying to use this grammar in Helix, but encountered this error:

QueryError { message: "Incompatible language version 8. Expected minimum 13, maximum 14", kind: Language }

To fix it, I re-initialized the grammar with tree-sitter init, then regenerated the parser with:

tree-sitter generate --abi=14

I also verified syntax highlighting by adding a grammar entry to Helix:

# languages.toml
[[grammar]]
name = "fluent"
source = { git = "https://github.com/BernardIgiri/tree-sitter-fluent.git", rev = "master" }

[[language]]
name = "fluent"
scope = "source.fluent"
file-types = ["ftl"]
comment-token = "#"

And using the following highlights.scm query file:

; Comments
(block_comment) @comment
(comment) @comment
(resource_comment) @comment

; Messages and terms
(message) @function
(term) @constant

; Identifiers
(identifier) @variable
(term_identifier) @constant

; Patterns (string content)
(pattern) @string

With this, Fluent .ftl files now display correctly in Helix 25.

Let me know if any changes are required. Thank you!

tree-sitter init
and
tree-sitter generate --abi=14

To enable compatibility with Helix Editor version 25.01.1
@alerque
Copy link
Collaborator

alerque commented Jul 10, 2025

Are all the changes in this PR generated by that one command? Even the .editorconfig addition and stuff like that?

@BernardIgiri
Copy link
Author

BernardIgiri commented Jul 10, 2025

Are all the changes in this PR generated by that one command? Even the .editorconfig addition and stuff like that?

Yes, tree-sitter init alone adds these files:

.editorconfig
.gitattributes
CMakeLists.txt
Cargo.toml
Makefile
Package.swift
bindings/
go.mod
pyproject.toml
setup.py
tree-sitter.json

Then tree-sitter generate --abi=14 modifies:

src/grammar.json
src/parser.c
src/tree_sitter/parser.h

And adds:

src/node-types.json
src/tree_sitter/alloc.h
src/tree_sitter/array.h

I'm thinking that .editorconfig and .gitattributes aren't really necessary though.

@alerque
Copy link
Collaborator

alerque commented Jul 10, 2025

Strictly necessary or not I'll review them differently knowing they are auto-generated from project-adjacent tooling than I would if they were concocted by one party according to their preferences and combined with something else auto-generated.

That being said it probably makes sense to split this into at least 2 commits to see what is happening where, and to make future updates to either of these actions more direly comparable to ease future reviews as well.

@BernardIgiri
Copy link
Author

Strictly necessary or not I'll review them differently knowing they are auto-generated from project-adjacent tooling than I would if they were concocted by one party according to their preferences and combined with something else auto-generated.

That being said it probably makes sense to split this into at least 2 commits to see what is happening where, and to make future updates to either of these actions more direly comparable to ease future reviews as well.

I'm moving this PR to #2 so I can continue using this repo for my personal use of Helix Editor. That PR separates the changes into 2 commits as requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants