gleam-lang / tree-sitter-gleam

🌳 A tree-sitter grammar for the Gleam programming language
Apache License 2.0
66 stars 13 forks source link

Highlighting breaks with Helix editor #79

Closed tynanbe closed 7 months ago

tynanbe commented 7 months ago

It looks like it stopped working at this commit: https://github.com/gleam-lang/tree-sitter-gleam/commit/b7ae2c9374083e4f4569a2f9e218efe409f98664

the-mikedavis commented 7 months ago

Do you have custom config in ~/.config/helix/languages.toml to update the [[grammar]] block? Generally you can't update the parser alone - if there are breaking changes like in https://github.com/gleam-lang/tree-sitter-gleam/commit/23d2b896514087d97f75a62035b325a4704cbae5 (the parent of the commit you linked) then the queries might fail to compile.

Also see https://github.com/helix-editor/helix/pull/9003 - that PR has the updates for the queries that should fix query compilation.

tynanbe commented 7 months ago

Using Helix v23.10, with this in languages.toml:

[[grammar]]
name = "gleam"

[grammar.source]
git = "https://github.com/gleam-lang/tree-sitter-gleam"
rev = "23d2b896514087d97f75a62035b325a4704cbae5"

I do see an error in helix.log stating that the Gleam queries couldn't be parsed, after running the following with any rev newer than the above.

> hx --grammar fetch && hx --grammar build

Sounds like I need a newer Helix build?

the-mikedavis commented 7 months ago

Yep you need the updates to the highlight query that lives in runtime/queries/gleam/highlights.scm. You can overwrite the one in ~/.config/helix/runtime/queries/gleam/highlights.scm (or $HELIX_RUNTIME/queries/gleam/highlights.scm if you set the HELIX_RUNTIME environment variable) with the latest one from the Helix repo if you don't want to rebuild Helix from source.

tynanbe commented 7 months ago

Sure enough, the updated queries resolved the issue. Thanks very much; sorry for taking your time!