unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Yuan Fu <casouri@gmail.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Status update of tree-sitter features
Date: Thu, 29 Dec 2022 02:34:47 +0200	[thread overview]
Message-ID: <0f099d93-64c3-59be-9d5d-9b23ca1ecd2e@yandex.ru> (raw)
In-Reply-To: <D3CB232D-068D-4E10-9B80-D5F5E3E857D8@gmail.com>

On 29/12/2022 02:23, Yuan Fu wrote:

>>> function                every function identifier
>>
>> The description makes it easy to mistake for function definitions as well. Whereas the place where this category is used is function/method calls, right? And perhaps some other references to methods inside the code where the language parser can distinguish those from property access, etc.
>>
>> If it's only about calls, maybe call this category funcall?
> 
> Function, property and variable are for every occurrence of them (the touted “consistent highlighting”). So there will be a bit of overlap between function, variable, and definition.

By "overlap", do you mean that font-lock rules should also have entries 
for variable/function definitions with category 'variable'/'function'?

In case somebody removes 'definition' from their list of enabled 
features but keeps 'variable' and 'function' there?

>>> variable                every variable identifier
>>
>> 'variable', so far, seems like the least useful. When enabled, it lights up every bit of text that remained from other matchers -- because identifier are everywhere.
> 
> Yes, but apparently people want it ;-)

Well, if they really do.

I figured that people who added this maybe haven't tested this 
thoroughly. And that maybe they expected the effect of that "local 
variables highlights" feature that some editors showcase already.

>> There is this more advanced prior art for highlighting variables, by tracking the scopes using custom annotations, see locals.scm here:
>>
>> https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
>>
>> What's displayed under "Result" would be really handy to have in Ruby.
>>
>> It's nothing urgent, of course. Maybe for Emacs 30?
> 
> Yeah, this requires some non-trivial addition to the current fontification code.

Thank you.

>> For Emacs 29, though, I would discourage the use of 'variable’.
> 
> It’s on level 4, meaning not enabled by default, so I think it’s fine.

Fair enough. If someone wants function/property but not variable, they 
could fine-tune the list.



  reply	other threads:[~2022-12-29  0:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-28  9:44 Status update of tree-sitter features Yuan Fu
2022-12-28 15:40 ` Mickey Petersen
2022-12-29  0:15   ` Yuan Fu
2022-12-28 23:27 ` Dmitry Gutov
2022-12-29  0:23   ` Yuan Fu
2022-12-29  0:34     ` Dmitry Gutov [this message]
2022-12-29  9:21       ` Yuan Fu
2022-12-29 16:38         ` Dmitry Gutov
2022-12-30 11:16           ` Yuan Fu
2022-12-30 23:41             ` Dmitry Gutov
2022-12-31 22:15               ` Yuan Fu
2022-12-29  3:28     ` Stefan Monnier
2022-12-29  9:23       ` Yuan Fu
2022-12-30 14:27       ` Jostein Kjønigsen
2022-12-30 15:37         ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0f099d93-64c3-59be-9d5d-9b23ca1ecd2e@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=casouri@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).