[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] treesit.el: New function to describe font-lock rules
From: |
Yuan Fu |
Subject: |
Re: [PATCH] treesit.el: New function to describe font-lock rules |
Date: |
Fri, 6 Oct 2023 00:05:17 -0700 |
Hi Huan,
> On Oct 3, 2023, at 6:32 AM, Huan Thieu Nguyen <nguyenthieuhuan@gmail.com>
> wrote:
>
> Hello emacs maintainers,
>
> I think most major modes don't need to use multiple tree-sitter grammars, so
> I made a function called `treesit-font-lock-simple-rules' which saves the
> user from typing `:language` for every query-spec.
>
> I have not added an announcement in the news file yet.
Sorry for the late response. I agree it’s somewhat tedious. I didn’t came up
with a clean solution for it at the time and left it be.
Instead of finding :feature keywords and appending :language keywords after
them, maybe we could introduce a secret keyword (say, :default-language or
:global-language) to treesit-font-lock-rules, and make
treesit-font-lock-simple-rules use that.
We could also just add the :default-language or :global-language keyword to
treesit-font-lock-rules. If we do that, we can also add :default-override, too.
But adding global keywords doesn’t look super clean to me (and it might be a
bit confusing), that’s why I didn’t implement it in the first place.
Yuan