From: Dmitry Gutov <dgutov@yandex.ru>
To: Randy Taylor <dev@rjt.dev>
Cc: 61205@debbugs.gnu.org, yuan fu <casouri@gmail.com>
Subject: bug#61205: 'function' in 3rd element of treesit-font-lock-feature-list
Date: Thu, 2 Feb 2023 13:11:30 +0200 [thread overview]
Message-ID: <064e85bd-704e-8def-577f-b30fed449e21@yandex.ru> (raw)
In-Reply-To: <CcUDXBRpAzhAIj7cOe8jZx9eQVLOfQVCJaisMgsN33iydKgsPnSjGgam5GXB1Ho7D2_jxIqgaKO7aLD3pcXLMVkGo42rKOUBXTFn738txtc=@rjt.dev>
On 02/02/2023 05:29, Randy Taylor wrote:
> On Wednesday, February 1st, 2023 at 21:44, Dmitry Gutov <dgutov@yandex.ru> wrote:
>> On 02/02/2023 04:34, Randy Taylor wrote:
>>
>>> On Tuesday, January 31st, 2023 at 21:08, Dmitry Gutovdgutov@yandex.ru wrote:
>>>
>>>> X-Debbugs-Cc: Yuan Fucasouri@gmail.com, Randy Taylordev@rjt.dev
>>>>
>>>> Some new built-in modes has 'function' feature highlighting thus enabled
>>>> by default.
>>>>
>>>> rust-ts-mode, go-ts-mode, cmake-mode
>>>>
>>>> Should we move it to 4 for consistency with the rest?
>>>>
>>>> Previously, we talked about that and concluded that function calls are
>>>> usually everywhere and are easy to notice without additional highlighting.
>>>> If that's what folks decided on then we should keep everything consistent.
>>>
>>> Personally, I find it odd that out of the box default highlighting wouldn't highlight function calls.
>>
>>
>> I think that's more useful in some languages, and less in others.
>
> Sure, and people will have different opinions on it too. But I still think out of the box we should be highlighting most things like other editors do.
Perhaps we should have an extra level between 3 (highlight sparingly
like other Emacs modes do) and 4 (highlight everything including stuff
that doesn't always look great).
> It's easy enough to take out what you don't like.
Note that in this case "taking out" some things uncovered that the
highlighting really isn't great in a different configuration.
>> I guess we settled on this particular convention to be more consistent
>> with existing major modes in Emacs. But I can see how it can be
>> appealing, especially in languages with more complex syntax such as Rust.
>>
>> Same for 'property'.
>>
>> The one feature that I'm fairly certain is currently useless is
>> 'variable', because we don't have any variable scope tracking (yet), and
>> the grammars don't do it for us. So too many tokens get highlighted with
>> font-lock-variable-name-face. Try the current rust-ts-mode, for example:
>> almost everything ends up with that face.
>
> If anything that isn't a variable is getting highlighted, then that's a bug. Anything it's catching that isn't a variable can probably be dealt with similar to how token_tree is dealt with.
With a list of exceptions? I hadn't thought about that. But it sounds
like it might be a fair amount of work. Depends on the specific grammar,
of course.
Note that you'd also need to add such rules for every "feature" that
might be disabled by the user, for its identifier tokens not to start
being highlighted as a variable (if the user kept 'variable' in the
features list). That's the current design we're working off.
And tree-sitter has a recommended mechanism for highlighting locals. We
just haven't implemented it yet.
prev parent reply other threads:[~2023-02-02 11:11 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-01 2:08 bug#61205: 'function' in 3rd element of treesit-font-lock-feature-list Dmitry Gutov
2023-02-01 5:18 ` Yuan Fu
2023-02-02 2:34 ` Dmitry Gutov
2023-02-02 3:18 ` Randy Taylor
2023-02-02 11:03 ` Dmitry Gutov
2023-02-02 20:25 ` Dmitry Gutov
2023-02-03 2:38 ` Yuan Fu
2023-02-03 2:51 ` Dmitry Gutov
2023-02-03 6:45 ` Eli Zaretskii
2023-02-03 6:46 ` Eli Zaretskii
2023-02-03 11:42 ` Dmitry Gutov
2023-02-03 12:19 ` Eli Zaretskii
2023-02-03 15:15 ` Dmitry Gutov
2023-02-03 15:54 ` Eli Zaretskii
2023-02-03 17:10 ` Dmitry Gutov
2023-02-04 3:36 ` Dmitry Gutov
2023-02-04 6:53 ` Eli Zaretskii
2023-02-04 23:44 ` Dmitry Gutov
2023-02-05 6:05 ` Eli Zaretskii
2023-02-05 13:52 ` Dmitry Gutov
2023-02-02 2:34 ` Randy Taylor
2023-02-02 2:44 ` Dmitry Gutov
2023-02-02 3:29 ` Randy Taylor
2023-02-02 11:11 ` Dmitry Gutov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=064e85bd-704e-8def-577f-b30fed449e21@yandex.ru \
--to=dgutov@yandex.ru \
--cc=61205@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=dev@rjt.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.