[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Support multiple tree-sitter grammars
From: |
Eli Zaretskii |
Subject: |
Re: Support multiple tree-sitter grammars |
Date: |
Sun, 07 May 2023 13:59:38 +0300 |
> 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.