all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Support multiple tree-sitter grammars
@ 2023-05-07 10:46 Damien Cassou
  2023-05-07 10:59 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Damien Cassou @ 2023-05-07 10:46 UTC (permalink / raw)
  To: emacs-devel

Hi,

some files may consist of several parts requiring different tree-sitter
grammars. For example, a JavaScript file may have its documentation
written with jsdoc: JavaScript and jsdoc have a tree-sitter grammar
each.

Is there a way to use a tree-sitter grammar in parts of the file and
another one in other parts? There could be a main grammar and secondary
grammars would be activated on some kinds of nodes of the main one.

Best

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill



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

* Re: Support multiple tree-sitter grammars
  2023-05-07 10:46 Support multiple tree-sitter grammars Damien Cassou
@ 2023-05-07 10:59 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2023-05-07 10:59 UTC (permalink / raw)
  To: Damien Cassou; +Cc: emacs-devel

> From: Damien Cassou <damien@cassou.me>
> Date: Sun, 07 May 2023 12:46:51 +0200
> 
> Hi,
> 
> some files may consist of several parts requiring different tree-sitter
> grammars. For example, a JavaScript file may have its documentation
> written with jsdoc: JavaScript and jsdoc have a tree-sitter grammar
> each.
> 
> Is there a way to use a tree-sitter grammar in parts of the file and
> another one in other parts? There could be a main grammar and secondary
> grammars would be activated on some kinds of nodes of the main one.

Yes, it should be possible, AFAIU.  See the node "Multiple Languages"
in the ELisp manual, I believe it explains how to do what you want.



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

end of thread, other threads:[~2023-05-07 10:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-07 10:46 Support multiple tree-sitter grammars Damien Cassou
2023-05-07 10:59 ` Eli Zaretskii

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.