emacs-devel
[Top][All Lists]
Advanced

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

Re: Tree-sitter api


From: Yuan Fu
Subject: Re: Tree-sitter api
Date: Sun, 8 Aug 2021 17:56:33 -0500


> On Aug 7, 2021, at 10:47 AM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> 
>> We should have a user option to control tree-sitter on major mode
>> level. Maybe an alist where each car is a major node symbol and each cdr is
>> a Boolean value toggling tree-sitter for that node.
> 
> The more traditional approach is to use a buffer-local var set by the
> major mode or set via (add-hook '<MODE>-hook ...).

The major-mode would setup things like font-lock-defaults and 
tree-sitter-defaults before major-mode-hook runs, so I think enabling/disabling 
tree-sitter in the hook is too late, no?

> 
>> As for indentation, we could provide some infrastructure like we do for
>> font-locking, or we can just let major modes implement their indent function
>> with tree-sitter api.
> 
> We should definitely provide the infrastructure (even if it's fairly
> simple) so that major modes only have to provide some rules.

I don’t really know much about indenting but I’ll try my best. Suggestions are 
definitely welcome.

Yuan


reply via email to

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