Subject: bug#71562: treesit-install-language-grammar fails to install typescript

From: Eli Zaretskii <[email-masked]>
Date: Thu, 20 Jun 2024 14:31:06 +0300

> Date: Thu, 20 Jun 2024 14:18:42 +0300
> Cc: [email-masked], [email-masked], [email-masked]
> From: Dmitry Gutov <[email-masked]>
> 
> On 20/06/2024 13:45, Eli Zaretskii wrote:
> >> Date: Thu, 20 Jun 2024 13:28:23 +0300
> >> Cc:[email-masked],[email-masked],[email-masked]
> >> From: Dmitry Gutov<[email-masked]>
> >>
> >> On 20/06/2024 07:54, Eli Zaretskii wrote:
> >>>> Date: Wed, 19 Jun 2024 22:51:28 +0300
> >>>> Cc:[email-masked],[email-masked],[email-masked]
> >>>> From: Dmitry Gutov<[email-masked]>
> >>>>
> >>>> On 16/06/2024 08:16, Eli Zaretskii wrote:
> >>>>> I'm saying that we should run the build commands in every subdirectory
> >>>>> called 'src' that has parser.c or parser.cc in it.  Each shared
> >>>>> library thus created should be installed.  The name of the library is
> >>>>> derived from the parent of the 'src' subdirectory.
> >>>> I suppose the downside is when you pass 'tsx' as the language you still
> >>>> get nothing.
> >>> I don't understand: pass 'tsx' as language to what interface and in
> >>> which situation?
> >> 1. Bob is a user who wants to edit a tsx file.
> >> 2. He tries the tsx-ts-mode and sees the error "TSX grammar not found".
> >> 3. He calls 'M-x treesit-install-language-grammar' and inputs 'tsx' as
> >> the language.
> > And what do you think should happen next?  Or where's the problem in
> > the above 3 steps?
> 
> Next he presses RET a few times and the installation fails.

Why would it fail, if my suggestion is implemented?

> If we added two entries to treesit-language-source-alist by default, 
> OTOH (one for typescript, and another for tsx), then Bob would be able 
> to install the grammar easily.

But then we'd need to maintain a DB of all the "abnormal" repositories
(and there a few of them), which is less reliable.