all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#71562: treesit-install-language-grammar fails to install typescript
@ 2024-06-14 18:18 Steinar Bang
  2024-06-14 22:18 ` Dmitry Gutov
  0 siblings, 1 reply; 17+ messages in thread
From: Steinar Bang @ 2024-06-14 18:18 UTC (permalink / raw)
  To: 71562

Platform: emacs 29.3 from backports debian package (1:29.3+1-3~bpo12+1)
          debian 12.5 "bookworm" (current stable) on amd64

The 'M-x treesit-install-language-grammar RET typescript RET' fails with:

 ⛔ Warning (treesit): Error encountered when installing language grammar: (file-missing Setting current directory No such file or directory /tmp/treesit-workdirN2u4XF/repo/src)

I used defaults on all questions because I had no idea what else to put
there.

I think the reason the command fails is that the repository
 https://github.com/tree-sitter/tree-sitter-typescript
actually contains two tree-sitter parsers for typescript and tsx:
 https://github.com/tree-sitter/tree-sitter-typescript/tree/master/typescript
 https://github.com/tree-sitter/tree-sitter-typescript/tree/master/tsx





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-14 18:18 bug#71562: treesit-install-language-grammar fails to install typescript Steinar Bang
@ 2024-06-14 22:18 ` Dmitry Gutov
  2024-06-15  6:31   ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Dmitry Gutov @ 2024-06-14 22:18 UTC (permalink / raw)
  To: Steinar Bang, 71562

On 14/06/2024 21:18, Steinar Bang wrote:
> Platform: emacs 29.3 from backports debian package (1:29.3+1-3~bpo12+1)
>            debian 12.5 "bookworm" (current stable) on amd64
> 
> The 'M-x treesit-install-language-grammar RET typescript RET' fails
> with:
> 
>   ⛔ Warning (treesit): Error encountered when installing language
> grammar: (file-missing Setting current directory No such file or
> directory /tmp/treesit-workdirN2u4XF/repo/src)
> 
> I used defaults on all questions because I had no idea what else to put
> there.
> 
> I think the reason the command fails is that the repository
>   https://github.com/tree-sitter/tree-sitter-typescript
> actually contains two tree-sitter parsers for typescript and tsx:
>   https://github.com/tree-sitter/tree-sitter-typescript/tree/master/typescript
>   https://github.com/tree-sitter/tree-sitter-typescript/tree/master/tsx

FWIW, this is more or less intended, since we don't store the exact urls 
for the grammars (in the default settings), and just infer them 
according to the common scheme.

But we could change that in some cases, and perhaps typescript is 
popular enough for us to do that.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-14 22:18 ` Dmitry Gutov
@ 2024-06-15  6:31   ` Eli Zaretskii
  2024-06-15 19:30     ` Dmitry Gutov
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-15  6:31 UTC (permalink / raw)
  To: Dmitry Gutov, Yuan Fu; +Cc: 71562, sb

> Date: Sat, 15 Jun 2024 01:18:50 +0300
> From: Dmitry Gutov <dmitry@gutov.dev>
> 
> On 14/06/2024 21:18, Steinar Bang wrote:
> > Platform: emacs 29.3 from backports debian package (1:29.3+1-3~bpo12+1)
> >            debian 12.5 "bookworm" (current stable) on amd64
> > 
> > The 'M-x treesit-install-language-grammar RET typescript RET' fails
> > with:
> > 
> >   ⛔ Warning (treesit): Error encountered when installing language
> > grammar: (file-missing Setting current directory No such file or
> > directory /tmp/treesit-workdirN2u4XF/repo/src)
> > 
> > I used defaults on all questions because I had no idea what else to put
> > there.
> > 
> > I think the reason the command fails is that the repository
> >   https://github.com/tree-sitter/tree-sitter-typescript
> > actually contains two tree-sitter parsers for typescript and tsx:
> >   https://github.com/tree-sitter/tree-sitter-typescript/tree/master/typescript
> >   https://github.com/tree-sitter/tree-sitter-typescript/tree/master/tsx
> 
> FWIW, this is more or less intended, since we don't store the exact urls 
> for the grammars (in the default settings), and just infer them 
> according to the common scheme.
> 
> But we could change that in some cases, and perhaps typescript is 
> popular enough for us to do that.

We could look for directories names 'src' which have either parser.c
or parser.cc, and take it from there, instead of hard-coding the place
of the 'src' directory in the hierarchy.

I've added Yuan to the discussion.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-15  6:31   ` Eli Zaretskii
@ 2024-06-15 19:30     ` Dmitry Gutov
  2024-06-16  5:16       ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Dmitry Gutov @ 2024-06-15 19:30 UTC (permalink / raw)
  To: Eli Zaretskii, Yuan Fu; +Cc: 71562, sb

On 15/06/2024 09:31, Eli Zaretskii wrote:
> We could look for directories names 'src' which have either parser.c
> or parser.cc, and take it from there, instead of hard-coding the place
> of the 'src' directory in the hierarchy.

In the present case we have two problems:

* https://github.com/tree-sitter/tree-sitter-typescript/ contains two 
different files called parser.c in two different subdirectories (in 
typescript/src and tsx/src).

* The repository for the 'tsx' grammar does not match the common scheme 
- instead it's the same repository as for 'typescript'.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-15 19:30     ` Dmitry Gutov
@ 2024-06-16  5:16       ` Eli Zaretskii
  2024-06-19  6:33         ` Yuan Fu
  2024-06-19 19:51         ` Dmitry Gutov
  0 siblings, 2 replies; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-16  5:16 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: casouri, sb, 71562

> Date: Sat, 15 Jun 2024 22:30:25 +0300
> Cc: sb@dod.no, 71562@debbugs.gnu.org
> From: Dmitry Gutov <dmitry@gutov.dev>
> 
> On 15/06/2024 09:31, Eli Zaretskii wrote:
> > We could look for directories names 'src' which have either parser.c
> > or parser.cc, and take it from there, instead of hard-coding the place
> > of the 'src' directory in the hierarchy.
> 
> In the present case we have two problems:
> 
> * https://github.com/tree-sitter/tree-sitter-typescript/ contains two 
> different files called parser.c in two different subdirectories (in 
> typescript/src and tsx/src).
> 
> * The repository for the 'tsx' grammar does not match the common scheme 
> - instead it's the same repository as for 'typescript'.

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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-16  5:16       ` Eli Zaretskii
@ 2024-06-19  6:33         ` Yuan Fu
  2024-06-19 18:51           ` Steinar Bang
  2024-06-19 19:51         ` Dmitry Gutov
  1 sibling, 1 reply; 17+ messages in thread
From: Yuan Fu @ 2024-06-19  6:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Dmitry Gutov, 71562, sb



> On Jun 15, 2024, at 10:16 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> Date: Sat, 15 Jun 2024 22:30:25 +0300
>> Cc: sb@dod.no, 71562@debbugs.gnu.org
>> From: Dmitry Gutov <dmitry@gutov.dev>
>> 
>> On 15/06/2024 09:31, Eli Zaretskii wrote:
>>> We could look for directories names 'src' which have either parser.c
>>> or parser.cc, and take it from there, instead of hard-coding the place
>>> of the 'src' directory in the hierarchy.
>> 
>> In the present case we have two problems:
>> 
>> * https://github.com/tree-sitter/tree-sitter-typescript/ contains two 
>> different files called parser.c in two different subdirectories (in 
>> typescript/src and tsx/src).
>> 
>> * The repository for the 'tsx' grammar does not match the common scheme 
>> - instead it's the same repository as for 'typescript'.
> 
> 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.

treesit-install-language-grammar works fine if you pass “typescript/src” instead of the default “src” to it, for the third argument, so I don’t think there’s anything to fix here. Installing multiple things “smartly” might be more confusing and error-prone than helpful, IMO.

For reference, the recipe for typescript is

(typescript "https://github.com/tree-sitter/tree-sitter-typescript” nil "typescript/src" nil nil)

Yuan




^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-19  6:33         ` Yuan Fu
@ 2024-06-19 18:51           ` Steinar Bang
  2024-06-19 19:14             ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Steinar Bang @ 2024-06-19 18:51 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Dmitry Gutov, Eli Zaretskii, 71562

>>>>> Yuan Fu <casouri@gmail.com>:

> treesit-install-language-grammar works fine if you pass “typescript/src” instead of the default “src” to it, for the third argument, so I don’t think there’s anything to fix here. Installing multiple things “smartly” might be more confusing and error-prone than helpful, IMO.

FWIW the repo contains two grammars: typescript and tsx

And both grammars are needed (not just typescript).





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-19 18:51           ` Steinar Bang
@ 2024-06-19 19:14             ` Eli Zaretskii
  0 siblings, 0 replies; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-19 19:14 UTC (permalink / raw)
  To: Steinar Bang; +Cc: dmitry, casouri, 71562

> From: Steinar Bang <sb@dod.no>
> Cc: Eli Zaretskii <eliz@gnu.org>,  Dmitry Gutov <dmitry@gutov.dev>,
>   71562@debbugs.gnu.org
> Date: Wed, 19 Jun 2024 20:51:21 +0200
> 
> >>>>> Yuan Fu <casouri@gmail.com>:
> 
> > treesit-install-language-grammar works fine if you pass “typescript/src” instead of the default “src” to it, for the third argument, so I don’t think there’s anything to fix here. Installing multiple things “smartly” might be more confusing and error-prone than helpful, IMO.
> 
> FWIW the repo contains two grammars: typescript and tsx
> 
> And both grammars are needed (not just typescript).

Yes.  Which is why I said that we should find _all_ the subdirectories
called 'src' which have a parser, and produce a shared library in each
one of them.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-16  5:16       ` Eli Zaretskii
  2024-06-19  6:33         ` Yuan Fu
@ 2024-06-19 19:51         ` Dmitry Gutov
  2024-06-20  4:54           ` Eli Zaretskii
  1 sibling, 1 reply; 17+ messages in thread
From: Dmitry Gutov @ 2024-06-19 19:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: casouri, sb, 71562

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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-19 19:51         ` Dmitry Gutov
@ 2024-06-20  4:54           ` Eli Zaretskii
  2024-06-20 10:28             ` Dmitry Gutov
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-20  4:54 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: casouri, sb, 71562

> Date: Wed, 19 Jun 2024 22:51:28 +0300
> Cc: casouri@gmail.com, sb@dod.no, 71562@debbugs.gnu.org
> From: Dmitry Gutov <dmitry@gutov.dev>
> 
> 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?





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-20  4:54           ` Eli Zaretskii
@ 2024-06-20 10:28             ` Dmitry Gutov
  2024-06-20 10:45               ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Dmitry Gutov @ 2024-06-20 10:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: casouri, sb, 71562

On 20/06/2024 07:54, Eli Zaretskii wrote:
>> Date: Wed, 19 Jun 2024 22:51:28 +0300
>> Cc:casouri@gmail.com,sb@dod.no,71562@debbugs.gnu.org
>> From: Dmitry Gutov<dmitry@gutov.dev>
>>
>> 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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-20 10:28             ` Dmitry Gutov
@ 2024-06-20 10:45               ` Eli Zaretskii
  2024-06-20 11:18                 ` Dmitry Gutov
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-20 10:45 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: casouri, sb, 71562

> Date: Thu, 20 Jun 2024 13:28:23 +0300
> Cc: casouri@gmail.com, sb@dod.no, 71562@debbugs.gnu.org
> From: Dmitry Gutov <dmitry@gutov.dev>
> 
> On 20/06/2024 07:54, Eli Zaretskii wrote:
> >> Date: Wed, 19 Jun 2024 22:51:28 +0300
> >> Cc:casouri@gmail.com,sb@dod.no,71562@debbugs.gnu.org
> >> From: Dmitry Gutov<dmitry@gutov.dev>
> >>
> >> 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?





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-20 10:45               ` Eli Zaretskii
@ 2024-06-20 11:18                 ` Dmitry Gutov
  2024-06-20 11:31                   ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Dmitry Gutov @ 2024-06-20 11:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: casouri, sb, 71562

On 20/06/2024 13:45, Eli Zaretskii wrote:
>> Date: Thu, 20 Jun 2024 13:28:23 +0300
>> Cc:casouri@gmail.com,sb@dod.no,71562@debbugs.gnu.org
>> From: Dmitry Gutov<dmitry@gutov.dev>
>>
>> On 20/06/2024 07:54, Eli Zaretskii wrote:
>>>> Date: Wed, 19 Jun 2024 22:51:28 +0300
>>>> Cc:casouri@gmail.com,sb@dod.no,71562@debbugs.gnu.org
>>>> From: Dmitry Gutov<dmitry@gutov.dev>
>>>>
>>>> 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.

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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-20 11:18                 ` Dmitry Gutov
@ 2024-06-20 11:31                   ` Eli Zaretskii
  2024-06-20 15:03                     ` Dmitry Gutov
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-20 11:31 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: casouri, sb, 71562

> Date: Thu, 20 Jun 2024 14:18:42 +0300
> Cc: casouri@gmail.com, sb@dod.no, 71562@debbugs.gnu.org
> From: Dmitry Gutov <dmitry@gutov.dev>
> 
> On 20/06/2024 13:45, Eli Zaretskii wrote:
> >> Date: Thu, 20 Jun 2024 13:28:23 +0300
> >> Cc:casouri@gmail.com,sb@dod.no,71562@debbugs.gnu.org
> >> From: Dmitry Gutov<dmitry@gutov.dev>
> >>
> >> On 20/06/2024 07:54, Eli Zaretskii wrote:
> >>>> Date: Wed, 19 Jun 2024 22:51:28 +0300
> >>>> Cc:casouri@gmail.com,sb@dod.no,71562@debbugs.gnu.org
> >>>> From: Dmitry Gutov<dmitry@gutov.dev>
> >>>>
> >>>> 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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-20 11:31                   ` Eli Zaretskii
@ 2024-06-20 15:03                     ` Dmitry Gutov
  2024-06-20 15:59                       ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Dmitry Gutov @ 2024-06-20 15:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: casouri, sb, 71562

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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-20 15:03                     ` Dmitry Gutov
@ 2024-06-20 15:59                       ` Eli Zaretskii
  2024-06-20 16:08                         ` Dmitry Gutov
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-20 15:59 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: casouri, sb, 71562

> Date: Thu, 20 Jun 2024 18:03:32 +0300
> Cc: casouri@gmail.com, sb@dod.no, 71562@debbugs.gnu.org
> From: Dmitry Gutov <dmitry@gutov.dev>
> 
> 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.

No, it was for _any_ grammar, regardless of its name.

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

They are not too many, but they tend to grow, and maintaining such a
list would be an extra burden.  Why do that when a simpler and more
reliable solution exists?

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

I don't see why that would be a problem.  The grammars that come in
pairs share common parts anyway, so I think updating them all is
actually slightly safer.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71562: treesit-install-language-grammar fails to install typescript
  2024-06-20 15:59                       ` Eli Zaretskii
@ 2024-06-20 16:08                         ` Dmitry Gutov
  0 siblings, 0 replies; 17+ messages in thread
From: Dmitry Gutov @ 2024-06-20 16:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: casouri, sb, 71562

On 20/06/2024 18:59, Eli Zaretskii wrote:
>> Date: Thu, 20 Jun 2024 18:03:32 +0300
>> Cc: casouri@gmail.com, sb@dod.no, 71562@debbugs.gnu.org
>> From: Dmitry Gutov <dmitry@gutov.dev>
>>
>> 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.
> 
> No, it was for _any_ grammar, regardless of its name.

It will work only in the case where Bob specifies 'typescript', not 'tsx'.

>>>> 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.
> 
> They are not too many, but they tend to grow, and maintaining such a
> list would be an extra burden.  Why do that when a simpler and more
> reliable solution exists?

See the previous mentioned problems with it.

>> 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.
> 
> I don't see why that would be a problem.  The grammars that come in
> pairs share common parts anyway, so I think updating them all is
> actually slightly safer.

That might be true, though probably not in all cases.

Our major modes for typescript and tsx do share some parts of the 
definition.





^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-06-20 16:08 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-14 18:18 bug#71562: treesit-install-language-grammar fails to install typescript Steinar Bang
2024-06-14 22:18 ` Dmitry Gutov
2024-06-15  6:31   ` Eli Zaretskii
2024-06-15 19:30     ` Dmitry Gutov
2024-06-16  5:16       ` Eli Zaretskii
2024-06-19  6:33         ` Yuan Fu
2024-06-19 18:51           ` Steinar Bang
2024-06-19 19:14             ` Eli Zaretskii
2024-06-19 19:51         ` Dmitry Gutov
2024-06-20  4:54           ` Eli Zaretskii
2024-06-20 10:28             ` Dmitry Gutov
2024-06-20 10:45               ` Eli Zaretskii
2024-06-20 11:18                 ` Dmitry Gutov
2024-06-20 11:31                   ` Eli Zaretskii
2024-06-20 15:03                     ` Dmitry Gutov
2024-06-20 15:59                       ` Eli Zaretskii
2024-06-20 16:08                         ` Dmitry Gutov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.