tree-sitter / tree-sitter-go

Go grammar for tree-sitter
MIT License
310 stars 65 forks source link

bump tree-sitter to 0.23, hide newline tokens #146

Closed amaanq closed 2 months ago

amaanq commented 2 months ago

This now uses tree-sitter-language to export the grammar, instead of relying on a cyclic dependency of itself, which caused a whole slew of issues.

smoelius commented 1 month ago

This now uses tree-sitter-language to export the grammar, instead of relying on a cyclic dependency of itself, which caused a whole slew of issues.

Sorry for the naive question, but how would one adapt an expression like this?

    Query::new(&tree_sitter_go::language(), source).unwrap()
smoelius commented 1 month ago

Sorry, I think I figured it out. I need to call <Language as From<LanguageFn>>::from: https://docs.rs/tree-sitter/0.23.0/tree_sitter/struct.Language.html#impl-From%3CLanguageFn%3E-for-Language

amaanq commented 1 month ago

Yeah, something like Query::new(&tree_sitter_go::LANGUAGE.into(), source).unwrap() should work.