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

From: Dmitry Gutov <[email-masked]>
Date: Thu, 20 Jun 2024 18:03:32 +0300

On 20/06/2024 14:31, Eli Zaretskii wrote:

>>> 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?

Because your suggestion is for the case where Bob specifies 'typescript' 
on step 3.

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

There are not too many of them, and out of those TypeScript (and TSX 
with it) is more popular than most of the others as a programming 
language. So even if we add these two it wouldn't follow that we must 
have the rest.

 > which is less reliable.

I suppose we could do both - both update the recipe, and scan the 
directory tree for files named parser.c.

If we aren't concerned about side-effects, such as for example when the 
user wanted to stay on the previous version of the tsx grammar they had 
installed (because the major mode doesn't work with the newer one), but 
they need to update the typescript grammar, and the tsx grammar is 
overwritten in the process too.