emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Turning on/off tree-sitter modes


From: Dmitry Gutov
Subject: Re: Turning on/off tree-sitter modes
Date: Wed, 4 Dec 2024 15:12:46 +0200
User-agent: Mozilla Thunderbird

On 04/12/2024 14:56, Eli Zaretskii wrote:
Take for example rust-ts-mode, or dockerfile-ts-mode: the body of the
major mode function is wrapped in

    (when (treesit-ready-p 'dockerfile)
       ...
      )

which checks for the grammar, emits the warning and does nothing
otherwise. So dockerfile-ts-mode behaves like prog-mode in this case,
even highlighting strings using the default syntax table.
That's another possibility, indeed.  Its downside is that each mode
author will need to include this boilerplate code.

That's what we recommend already, see the examples in doc/lispref/parsing.texi or admin/notes/tree-sitter/starter-guide.

And all the existing ts modes do this, AFAICS.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]