Tree Sitter Grammar and Helix Editor Support #1555
gruhn
started this conversation in
Show and tell
Replies: 1 comment 3 replies
-
Amazing! Will give it a try in Neovim! Another cool thing about Tree-Sitter grammars is that one can use them to build a formatter using Topiary, one of the few things left that I find myself wanting in Quint. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey guys, I tried to bring editor support for Quint to my favorite editor Helix. Two days ago the pull request got merged. Getting support for a new language into Helix mainly requires two things: a language server and a Tree Sitter grammar. I'm glad the language server was already provided.
Tree sitter, if you don't know, is a framework for specifying the syntax of a programming language. Editors/IDEs only need to know how to talk to tree sitter, then they can use syntax highlighting for all languages that have a tree sitter grammar. This is in a similar spirit to the language server protocol. Except language servers would be too slow to provide syntax highlighting themselves. Tree Sitter grammars can also provide more "nuanced" syntax highlighting, because they completely define the language. Classic regex based methods usually just highlight keywords (
and
,or
,iff
, ...), but with tree sitter bracedand { ... }
and infixp and q
could be highlighted differently for example.Here is the (probably still quite buggy) Tree Sitter grammar I hacked together for Quint. Thanks to the detailed Language Manual this was not too hard. I was struggling quite a bit with those locally defined operators though:
I'm still not sure, I dealt with this correctly 😅
Beta Was this translation helpful? Give feedback.
All reactions