emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More font-lock faces for tree-sitter


From: Stefan Monnier
Subject: Re: More font-lock faces for tree-sitter
Date: Fri, 28 Oct 2022 08:48:00 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> Here are some that I had in mind:
> - font-lock-escape-face
> - For escape characters in strings.
> - font-lock-property-face
> - Usually an object property, like a member in a class or struct.
> - font-lock-punctuation-face
> - In addition, we could get even more specific: 
> font-lock-punctuation-{delimiter, bracket, special}
> - font-lock-number-face
> - font-lock-operator-face

Note that most of the above faces relate to the lexical category of the
element, i.e. things that are usually very easy to handle with regexps
and which thus aren't made significantly easier by tree-sitter (whose
strength is to recognize actual syntactic structures).

Where tree-sitter shines is for example when you need to distinguish the
two different kinds of commas in a code like:

    x = foo (y++, (z++, y+z));


-- Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]