[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tree-sitter integration in python.el
From: |
Yuan Fu |
Subject: |
Re: Tree-sitter integration in python.el |
Date: |
Mon, 10 Oct 2022 08:10:32 -0700 |
> On Oct 10, 2022, at 12:16 AM, Augusto Stoffel <arstoffel@gmail.com> wrote:
>
> On Sat, 8 Oct 2022 at 14:06, Yuan Fu wrote:
>
>>> To me, the biggest problem with font-lock-maximum-decoration is that few
>>> major modes bothered to implement levels.
>>
>> That’s their choice. If no one complains it’s not a problem ;-)
>
> Well, I'm complaining now and I think you can solve this :-).
Of course, within my reach I try to stratify font-lock into levels. I meant
major modes not in core.
>
>>> It's exactly the opposite: since you are designing a new systems, you
>>> can create a much nicer customization mechanism on the lines of
>>> font-lock-ignore. For instance, one could select fontification rules
>>> based on the affected node type.
>>>
>>> The “decoration levels” feature can then build up on this, with the
>>> advantage that it would be consistent across languages and require no
>>> extra effort from the major mode developer.
>>
>> It’s a nice idea, but in tree-sitter, different languages tag
>> differently, it could be “function_definition” in python but
>> “function_declaration” in C, etc. So it is not consistent across
>> language. Also, it is often more complicated than a single tag like
>> “function_identifier”, but rather a nested structure like
>> (function_definition (identifier)).
>
> One suggestion then is to allow attaching some “metadata” to the
> fontification rules in `treesit-font-lock-rules'. For instance,
> declare that a rule has :kind function or :level 2.
I’ve added support for :level in treesit-font-lock-rules, yes ;-)
Yuan
- Re: Tree-sitter integration in python.el, (continued)
- Re: Tree-sitter integration in python.el, Yuan Fu, 2022/10/12
- Re: Tree-sitter integration in python.el, Yuan Fu, 2022/10/12
- Re: [SPAM UNSURE] Re: Tree-sitter integration in python.el, Stephen Leake, 2022/10/12
- Re: Tree-sitter integration in python.el, Eli Zaretskii, 2022/10/13
- Re: Tree-sitter integration in python.el, Yuan Fu, 2022/10/15
- Re: Tree-sitter integration in python.el, Augusto Stoffel, 2022/10/08
- RE: [External] : Re: Tree-sitter integration in python.el, Drew Adams, 2022/10/08
- Re: [External] : Re: Tree-sitter integration in python.el, Augusto Stoffel, 2022/10/10
- Re: Tree-sitter integration in python.el, Yuan Fu, 2022/10/08
- Re: Tree-sitter integration in python.el, Augusto Stoffel, 2022/10/10
- Re: Tree-sitter integration in python.el,
Yuan Fu <=
- Re: Tree-sitter integration in python.el, Augusto Stoffel, 2022/10/10
- Re: Tree-sitter integration in python.el, Yuan Fu, 2022/10/12
- Re: Tree-sitter integration in python.el, Stefan Monnier, 2022/10/11
- Re: Tree-sitter integration in python.el, Eli Zaretskii, 2022/10/04
- Re: Tree-sitter integration in python.el, Matthias Meulien, 2022/10/04
- Re: Tree-sitter integration in python.el, Eli Zaretskii, 2022/10/04
- Re: Tree-sitter integration in python.el, Matthias Meulien, 2022/10/04
Re: Tree-sitter integration in python.el, Yuan Fu, 2022/10/03