emacs-devel
[Top][All Lists]
Advanced

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

Re: outline-mode treesitter support?


From: Huan Nguyen
Subject: Re: outline-mode treesitter support?
Date: Tue, 19 Dec 2023 14:25:01 +0100


> On Dec 19, 2023, at 14:00, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Huan Nguyen <nguyenthieuhuan@gmail.com>
>> Date: Tue, 19 Dec 2023 12:43:40 +0100
>> 
>> Are there any plans on making outline-mode take tree sitter nodes instead of 
>> regex?
> 
> Is there a tree-sitter grammar available somewhere for Outline mode?
I am not aware of any. I am writing a treesitter based mode for a markup 
language.
It has been manageable to write increase/decrease heading levels and move 
headings up/down yourself. For folding I am was looking how I could do it but I 
only found outline-mode.
> 
>> Is it possible to add that functionality or would a new mode be necessary.
> 
> It depends on how well the existing mode's features map into a
> tree-sitter based one.
The features should be the same but they should work on treesitter nodes 
instead of regexp. The advantage is that it will be more “correct”.

Take the example nodes: 
(heading1 (content ...)) 
You may wish to hide the child content.

(heading1 
        (content
                (heading2 (content …))))
You may wish to promote heading2, removing it from its parent heading.

The problem I see in that is that not all treesitter grammars have this tree 
like structure. 
Doing it yourself is not that hard as I said before, so it is not a high 
priority for me.


reply via email to

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