GNU bug report logs - #62429
30.0.50; Add jsx faces to typescript-ts-mode

Previous Next

Package: emacs;

Reported by: Yuan Fu <casouri <at> gmail.com>

Date: Fri, 24 Mar 2023 23:51:02 UTC

Severity: normal

Found in version 30.0.50

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 62429 in the body.
You can then email your comments to 62429 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to theo <at> thornhill.no, bug-gnu-emacs <at> gnu.org:
bug#62429; Package emacs. (Fri, 24 Mar 2023 23:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Yuan Fu <casouri <at> gmail.com>:
New bug report received and forwarded. Copy sent to theo <at> thornhill.no, bug-gnu-emacs <at> gnu.org. (Fri, 24 Mar 2023 23:51:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Bug Report Emacs <bug-gnu-emacs <at> gnu.org>
Subject: 30.0.50; Add jsx faces to typescript-ts-mode
Date: Fri, 24 Mar 2023 16:49:35 -0700
[Message part 1 (text/plain, inline)]
X-Debbugs-CC: theo <at> thornhill.no

Hey Theo, I want to add separate faces for JSX tags and attributes.
Otherwise users will be in a world of pain if they want to use different
fontification for JSX tag and funcall, and JSX attribute and constant. WDYT?

Yuan

[faces.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62429; Package emacs. (Sat, 25 Mar 2023 11:54:02 GMT) Full text and rfc822 format available.

Message #8 received at 62429 <at> debbugs.gnu.org (full text, mbox):

From: Theodor Thornhill <theo <at> thornhill.no>
To: debbugs-submit <at> debbugs.gnu.org, Yuan Fu <casouri <at> gmail.com>,
 62429 <at> debbugs.gnu.org
Subject: Re: bug#62429: 30.0.50; Add jsx faces to typescript-ts-mode
Date: Sat, 25 Mar 2023 06:47:13 +0100

On 25 March 2023 00:49:35 CET, Yuan Fu <casouri <at> gmail.com> wrote:
>X-Debbugs-CC: theo <at> thornhill.no
>
>Hey Theo, I want to add separate faces for JSX tags and attributes.
>Otherwise users will be in a world of pain if they want to use different
>fontification for JSX tag and funcall, and JSX attribute and constant. WDYT?
>
>Yuan
>

Sounds reasonable :)

Theo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62429; Package emacs. (Sat, 25 Mar 2023 12:31:02 GMT) Full text and rfc822 format available.

Message #11 received at 62429 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: theo <at> thornhill.no, 62429 <at> debbugs.gnu.org
Subject: Re: bug#62429: 30.0.50; Add jsx faces to typescript-ts-mode
Date: Sat, 25 Mar 2023 15:30:37 +0300
> Cc: theo <at> thornhill.no
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Fri, 24 Mar 2023 16:49:35 -0700
> 
> Hey Theo, I want to add separate faces for JSX tags and attributes.
> Otherwise users will be in a world of pain if they want to use different
> fontification for JSX tag and funcall, and JSX attribute and constant. WDYT?

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.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62429; Package emacs. (Sat, 25 Mar 2023 19:46:01 GMT) Full text and rfc822 format available.

Message #14 received at 62429 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: theo <at> thornhill.no, 62429 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#62429: 30.0.50; Add jsx faces to typescript-ts-mode
Date: Sat, 25 Mar 2023 12:45:01 -0700

> On Mar 25, 2023, at 5:30 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> Cc: theo <at> thornhill.no
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Fri, 24 Mar 2023 16:49:35 -0700
>> 
>> Hey Theo, I want to add separate faces for JSX tags and attributes.
>> Otherwise users will be in a world of pain if they want to use different
>> fontification for JSX tag and funcall, and JSX attribute and constant. WDYT?
> 
> 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.

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62429; Package emacs. (Sun, 26 Mar 2023 04:38:02 GMT) Full text and rfc822 format available.

Message #17 received at 62429 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: theo <at> thornhill.no, 62429 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#62429: 30.0.50; Add jsx faces to typescript-ts-mode
Date: Sun, 26 Mar 2023 07:37:11 +0300
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Sat, 25 Mar 2023 12:45:01 -0700
> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>,
>  62429 <at> debbugs.gnu.org,
>  theo <at> thornhill.no
> 
> > On Mar 25, 2023, at 5:30 AM, Eli Zaretskii <eliz <at> 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?

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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62429; Package emacs. (Thu, 30 Mar 2023 00:29:02 GMT) Full text and rfc822 format available.

Message #20 received at 62429 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: theo <at> thornhill.no, 62429 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: 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 <at> gnu.org> wrote:
> 
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Sat, 25 Mar 2023 12:45:01 -0700
>> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>,
>> 62429 <at> debbugs.gnu.org,
>> theo <at> thornhill.no
>> 
>>> On Mar 25, 2023, at 5:30 AM, Eli Zaretskii <eliz <at> 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



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62429; Package emacs. (Thu, 30 Mar 2023 05:26:02 GMT) Full text and rfc822 format available.

Message #23 received at 62429 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: theo <at> thornhill.no, 62429 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#62429: 30.0.50; Add jsx faces to typescript-ts-mode
Date: Thu, 30 Mar 2023 08:25:17 +0300
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Wed, 29 Mar 2023 17:28:40 -0700
> Cc: monnier <at> iro.umontreal.ca,
>  62429 <at> debbugs.gnu.org,
>  theo <at> thornhill.no
> 
> >> 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.

Then it is fine by me, as long as those measures you mentioned are
taken to make sure users know how to customize font-lock with these
faces.




Reply sent to Yuan Fu <casouri <at> gmail.com>:
You have taken responsibility. (Thu, 30 Mar 2023 08:13:02 GMT) Full text and rfc822 format available.

Notification sent to Yuan Fu <casouri <at> gmail.com>:
bug acknowledged by developer. (Thu, 30 Mar 2023 08:13:02 GMT) Full text and rfc822 format available.

Message #28 received at 62429-done <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: theodor thornhill <theo <at> thornhill.no>, 62429-done <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#62429: 30.0.50; Add jsx faces to typescript-ts-mode
Date: Thu, 30 Mar 2023 01:11:48 -0700

> On Mar 29, 2023, at 10:25 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Wed, 29 Mar 2023 17:28:40 -0700
>> Cc: monnier <at> iro.umontreal.ca,
>> 62429 <at> debbugs.gnu.org,
>> theo <at> thornhill.no
>> 
>>>> 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.
> 
> Then it is fine by me, as long as those measures you mentioned are
> taken to make sure users know how to customize font-lock with these
> faces.

Cool. I pushed the change.

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62429; Package emacs. (Thu, 30 Mar 2023 14:32:02 GMT) Full text and rfc822 format available.

Message #31 received at 62429 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: theo <at> thornhill.no, 62429 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#62429: 30.0.50; Add jsx faces to typescript-ts-mode
Date: Thu, 30 Mar 2023 17:31:40 +0300
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Thu, 30 Mar 2023 01:11:48 -0700
> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>,
>  62429-done <at> debbugs.gnu.org,
>  theodor thornhill <theo <at> thornhill.no>
> 
> >>> 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.
> > 
> > Then it is fine by me, as long as those measures you mentioned are
> > taken to make sure users know how to customize font-lock with these
> > faces.
> 
> Cool. I pushed the change.

Thanks, but please also tell in the doc string of the mode which
font-lock level uses these special faces.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62429; Package emacs. (Sun, 02 Apr 2023 22:12:01 GMT) Full text and rfc822 format available.

Message #34 received at 62429 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: theo <at> thornhill.no, 62429 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#62429: 30.0.50; Add jsx faces to typescript-ts-mode
Date: Sun, 2 Apr 2023 15:10:55 -0700

> On Mar 30, 2023, at 7:31 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Thu, 30 Mar 2023 01:11:48 -0700
>> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>,
>> 62429-done <at> debbugs.gnu.org,
>> theodor thornhill <theo <at> thornhill.no>
>> 
>>>>> 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.
>>> 
>>> Then it is fine by me, as long as those measures you mentioned are
>>> taken to make sure users know how to customize font-lock with these
>>> faces.
>> 
>> Cool. I pushed the change.
> 
> Thanks, but please also tell in the doc string of the mode which
> font-lock level uses these special faces.

Done.

Yuan



bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 01 May 2023 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 360 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.