emacs-devel
[Top][All Lists]
Advanced

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

Re: Tree-sitter documentation


From: Stefan Kangas
Subject: Re: Tree-sitter documentation
Date: Tue, 8 Nov 2022 07:36:43 -0800

Eli Zaretskii <eliz@gnu.org> writes:

>> Alists has too much layers of parenthesizes that is verbose and easy to get 
>> wrong. Compare:

(BTW, they are much easier to edit with something like paredit.
I guess you already use it.)

> I don't share your pessimism about alists.  And the way the functions
> are defined now are also very error-prone and complicate the code,
> which needs to distinguish between several very different signatures.
>
> How about making the query itself the value of a keyword/value pair?
> Like this:
>
>    :language 'python
>    :override t
>    :feature 'string
>    :query '((string :anchor "\"" @python--treesit-fontify-string)
>             (string) @contextual)

I don't mind if it's not a well-formed plist myself, if the last element
is always the query.  It saves some typing.

On that note, I'd probably prefer it if we had something like this:

(treesit-font-lock-rules
 '(;; To avoid repetitive typing:
   (:default t
    :language 'python
    :override t)
   (:feature 'string
    '((string :anchor "\"" @python--treesit-fontify-string)
      (string) @contextual))
   (:feature 'string-interpolation
    '((interpolation (identifier) @font-lock-variable-name-face))))))



reply via email to

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