all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Yuan Fu <casouri@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	 arstoffel@gmail.com,  orontee@gmail.com, emacs-devel@gnu.org
Subject: Re: Tree-sitter integration in python.el
Date: Tue, 11 Oct 2022 18:15:22 -0400	[thread overview]
Message-ID: <jwv5ygqqaho.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <AE96759C-1AD3-4623-9355-0ABD48FE69D9@gmail.com> (Yuan Fu's message of "Sat, 8 Oct 2022 13:57:19 -0700")

>>> The complaint for font-lock-maximum-decoration is that it’s obscure and
>>> too corse-grained. So my idea is for each major mode to provide
>>> fined-grained controls like
>>> python-fontify-type/f-string/assignment/built-in/etc. And tree-sitter
>>> makes it easy to implement this kind of toggle. But I guess a global
>>> control is also nice, I can make tree-sitter respect
>>> font-lock-maximum-decoration, in addition to the fined grained
>>> local-control.
>> 
>> I think having tree-sitter respect font-lock-maximum-decoration would
>> be good, because it allows a major-mode agnostic way of controlling
>> fontifications.  With tree-sitter in mind, we'd need to agree on what
>> kind of syntactic entities are included in each level (which is also a
>> Good Thing, because currently what is level N of font-lock is entirely
>> up to the major-mode, AFAIU).
>
> I think it is difficult to define syntactic entities for each level such
> that it is generally enough to include all kinds of major mode out there,
> and specific enough to be useful. It is easy for common programming
> languages, but hard for others like html, css, prolog, etc.

How 'bout:

- Major modes provide a list of available fontification "features"
  in a buffer-local variable like `treesit-font-lock-features`
  e.g. `(type f-string assignment built-in ...)`.
- the list of features is *ordered* so that
  the user can control the fontification via a Customizable
  `treesit-font-lock-level` that can be set between 0 and 100 to
  select the corresponding proportion of features.
- Users can additionally enable/disable those features individually via
  some `treesit-font-lock-control` variable.


        Stefan




  parent reply	other threads:[~2022-10-11 22:15 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 18:42 Tree-sitter integration in python.el Yuan Fu
2022-09-26 19:10 ` Jostein Kjønigsen
2022-09-27 22:16   ` Yuan Fu
2022-10-03 18:07 ` Matthias Meulien
2022-10-03 18:38   ` Eli Zaretskii
2022-10-03 22:19     ` Matthias Meulien
2022-10-03 22:31       ` Yuan Fu
2022-10-03 22:47         ` Matthias Meulien
2022-10-06  2:56           ` Yuan Fu
2022-10-06  7:18             ` Matthias Meulien
2022-10-06 18:26               ` Yuan Fu
2022-10-06 20:53                 ` Matthias Meulien
2022-10-07  8:25                   ` Yuan Fu
2022-10-07 10:03                     ` Augusto Stoffel
2022-10-07 17:53                       ` chad
2022-10-07 19:09                         ` Eli Zaretskii
2022-10-07 22:17                         ` Yuan Fu
2022-10-07 22:10                       ` Yuan Fu
2022-10-08  6:30                         ` Eli Zaretskii
2022-10-08 20:57                           ` Yuan Fu
2022-10-09  4:13                             ` Eli Zaretskii
2022-10-11 22:15                             ` Stefan Monnier [this message]
2022-10-12  5:04                               ` Yuan Fu
2022-10-12 17:52                                 ` Stefan Monnier
2022-10-12 22:55                                   ` Yuan Fu
2022-10-12 23:43                                     ` Yuan Fu
2022-10-13  0:16                                       ` [SPAM UNSURE] " Stephen Leake
2022-10-13  5:55                                       ` Eli Zaretskii
2022-10-15 23:15                                         ` Yuan Fu
2022-10-08  8:03                         ` Augusto Stoffel
2022-10-08 16:20                           ` [External] : " Drew Adams
2022-10-10 15:38                             ` Augusto Stoffel
2022-10-08 21:06                           ` Yuan Fu
2022-10-10  7:16                             ` Augusto Stoffel
2022-10-10 15:10                               ` Yuan Fu
2022-10-10 15:53                                 ` Augusto Stoffel
2022-10-12  5:08                                   ` Yuan Fu
2022-10-11 22:18                                 ` Stefan Monnier
2022-10-04  6:13       ` Eli Zaretskii
2022-10-04 11:21         ` Matthias Meulien
2022-10-04 12:33           ` Eli Zaretskii
2022-10-04 17:11             ` Matthias Meulien
2022-10-03 22:25   ` Yuan Fu
2022-10-16  7:31     ` Eli Zaretskii
2022-10-16  8:15       ` Yuan Fu
2022-10-16  8:18         ` Eli Zaretskii
2022-10-03 22:35 ` Matthias Meulien
  -- strict thread matches above, loose matches on Subject: below --
2022-10-03 21:53 lkg.ch@pm.me

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=jwv5ygqqaho.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=arstoffel@gmail.com \
    --cc=casouri@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=orontee@gmail.com \
    /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.