all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Tree Sitter and highlights.scm file
@ 2023-11-30 11:35 Tad Lispy
  2023-12-01  8:25 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Tad Lispy @ 2023-11-30 11:35 UTC (permalink / raw)
  To: emacs-devel@gnu.org

Hi! It's my first post ever to a mailing list, so I hope I do everything
right.  I'm also not very experienced with Emacs Lisp.

Here is my context. I'm working on a major mode for a new programming
language.  I'd like to leverage the built-in Tree Sitter support for
syntax highlighting.  My colleague works on the Tree Sitter grammar. In
their repository there is a file called `queries/highlights.scm`. It's a
scheme file that contains queries for different syntactic elements. Most
other grammars I see also have such file, so I think it's standard in
Tree Sitter grammars. I think it's generated by the `tree-sitter`
command line program and later customized by a grammar author. It looks
like all the necessary information for syntax highlighting is there.
Since it's also a lisp, it should be possible to use this file to
automatically derive font lock rules. But all examples of tree sitter
modes I see re-implement all the queries in Emacs Lisp with
`treesit-font-lock-rules` function. Why is that?

Before Emacs 29 there was a suite of 3rd party packages maintained by
Tuấn-Anh Nguyễn. One of the packages is a library of Tree Sitter
languages, that for each language contains the `highlights.scm` file.
See for example
https://github.com/emacs-tree-sitter/tree-sitter-langs/blob/master/queries/elm/highlights.scm.
So it looks like previously it was possible to utilize this file. Can we
still do it with Emacs 29?

Kind regards,
Tad Lispy



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-02  3:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-30 11:35 Tree Sitter and highlights.scm file Tad Lispy
2023-12-01  8:25 ` Eli Zaretskii
2023-12-02  3:40   ` Yuan Fu

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.