Subject: bug#59691: 29.0.60; typescript-ts-mode: any HTML-like elements causes fontification to become invalid and remaining parse-tree to become jsx-expression

From: Eli Zaretskii <[email-masked]>
Date: Wed, 30 Nov 2022 18:05:59 +0200

> Date: Wed, 30 Nov 2022 16:21:37 +0100
> From: Theodor Thornhill <[email-masked]>
> CC: [email-masked], [email-masked], [email-masked]
> 
> >> No strong opinions here, but currently a user could install
> >> tree-sitter-js, and find and enable js-ts-mode, which is
> >> straightforward, which is good. Since these four modes doesn’t require
> >> too much boilerplate, I think it’s pretty good right now.
> >
> >Can we do that automatically?  For example, can typescript-ts-mode call
> >js-ts-mode when it detects that it is necessary?
> 
> That's not what we want. 
> 
> There are three languages here from treesitters pov.
> 
> Typescript
> Tsx
> JavaScript
> 
> They are all different, and should be treated as such, imo :)

Our automatic turning-on of major-modes looks at the file-name extension and
little else (magic-mode-alist is not useful here).  So if a file whose
extension is XYZ can have more than one applicable major-mode, we should try
to do something to turn on the correct mode automatically.  What can we do?