unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Status update of tree-sitter features
Date: Sat, 31 Dec 2022 14:15:39 -0800	[thread overview]
Message-ID: <D65FD24D-7B5C-463A-95D3-595425D83E76@gmail.com> (raw)
In-Reply-To: <3ea7bb36-b524-1a39-598f-18d344826b0d@yandex.ru>



> On Dec 30, 2022, at 3:41 PM, Dmitry Gutov <dgutov@yandex.ru> wrote:
> 
> On 30/12/2022 13:16, Yuan Fu wrote:
> 
>>> Yes, but is that classification useful enough to justify the duplication in the font-lock rules' definitions?
>>> 
>>> FWIW, I "broke" python-ts-mode in 8503b370be1, according to this definition. Sorry?
>>> 
>>> But what do we get by this particular classification?
>>> 
>>> The user will be able to disable 'definitions' and still have all function definitions highlighted? But not, say, variable definitions?
>>> 
>>> That doesn't strike me as particularly more useful than e.g. disabling 'definitions' and having all function references highlighted (but not definitions). Which we would make possible by limiting 'function' to non-definitions.
>> Right now you can choose to highlight:
>> 1. Only definition identifiers, be it function, variable, class, etc
>> 2. All function identifiers
>> 3. All variable identifiers
>> There could be better features, but the existing ones still have their merits. If you want a feature that highlights only funcalls, maybe we can add them, if there are enough time & interest.
> 
> I'm mostly worried about having to duplicate font-lock rules between categories at this point. It just looks impractical to me.

I’d say we judge it case-by-case. In this case it seems fine to me.

> 
>>> Okay, I also have a different, somewhat related question.
>>> 
>>> Certain languages have a special syntax for "variables".
>>> 
>>> Ruby has @instance_variable and $global_variable -- the @ and $ are used both during assignment and for later reference.
>>> 
>>> Perl has $var and @array_var.
>>> 
>>> PHP has $local_var.
>>> 
>>> Up until now we've highlighted those with font-lock-variable-name-face. Except for @array_var in Perl, which has separate derived face. Either way, we did highlight them.
>>> 
>>> What category should we use for them in ts-based modes? If it's 'variable', then won't be highlighted by default.
>>> 
>>> If 'variable' matchers in other existing ts modes didn't include all identifiers everywhere, we could put 'variable' into level 3.
>>> 
>>> Or we could add a separate category for all those, I guess.
>> If a major mode thinks highlighting all variables is the best default behavior, it can support the variable feature and put it at level 3. The standard list is just a guideline.
> 
> So you're suggesting ruby-ts-mode changes treesit-font-lock-feature-list locally, and either moves 'variable' to a lower level, or adds a new category for said vars.
> 
> We can do that, thank you.

Yeah, ultimately it’s your judgement.

Yuan


  reply	other threads:[~2022-12-31 22:15 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
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 [this message]
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=D65FD24D-7B5C-463A-95D3-595425D83E76@gmail.com \
    --to=casouri@gmail.com \
    --cc=dgutov@yandex.ru \
    --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).