bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#62429: 30.0.50; Add jsx faces to typescript-ts-mode


From: Yuan Fu
Subject: bug#62429: 30.0.50; Add jsx faces to typescript-ts-mode
Date: Wed, 29 Mar 2023 17:28:40 -0700


> On Mar 25, 2023, at 9:37 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Sat, 25 Mar 2023 12:45:01 -0700
>> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
>> 62429@debbugs.gnu.org,
>> theo@thornhill.no
>> 
>>> On Mar 25, 2023, at 5:30 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>>> 
>>> We never had any mode-specific faces for font-lock, AFAIK.  Why is
>>> this case different?  Why not use one of the existing font-lock faces,
>>> or even add new ones (but not specific to JSX)?
>>> 
>>> (Adding Stefan.)
>> 
>> IFIAK, css-mode has its own face. These two faces are specific to HTML and 
>> not widely applicable to other languages like other font-lock faces do.
>> 
>> JSX is basically HTML mixed with Javascript, so JSX tags and attributes are 
>> just HTML tags and attributes. Normally it’s fine to just use some 
>> semi-related font-lock face for them; mhtml.el uses function-call-face and 
>> constant-face for tags and attributes. But because in JSX, HTML tags and 
>> attribtues appear in the same buffer with Javascript code, if we use 
>> function-call-face and constant-face for tags and attributes, it’s 
>> impossible to change their appearance and not affect the functions and 
>> constants in Javascript code, because we are using the same face for JS 
>> functions and HTML tags, and JS constants and HTML attributes.
> 
> OK, but then how will these JSX-specific faces fit into the overall
> scheme of treesit-font-lock faces?  For example, in what level will
> they be used, and how will users know what level to set to see these
> faces in their buffers?

At level 3 for tsx-ts-mode, under the “jsx” feature. So they are enabled by 
default. Though it’s true that it’s not immediately obvious what face to 
customize. At the very least these faces appear in the customize group of 
typescript. We can add something to the docstring of the major mode, too.

> 
> These are the downsides of mode-specific faces, and if we think it's
> important enough to have them, we should resolve these issues when we
> install such faces.


Yuan




reply via email to

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