GNU bug report logs - #65470
29.1.50; js-ts-mode: regex pattern can cause incorrect parenthesis matching

Previous Next

Package: emacs;

Reported by: Augustin Chéneau (BTuin) <btuin <at> mailo.com>

Date: Wed, 23 Aug 2023 11:16:01 UTC

Severity: normal

Tags: patch

Found in version 29.1.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: dmitry <at> gutov.dev, casouri <at> gmail.com
Cc: btuin <at> mailo.com, jostein <at> secure.kjonigsen.net, 65470 <at> debbugs.gnu.org, theo <at> thornhill.no, monnier <at> iro.umontreal.ca
Subject: bug#65470: 29.1.50; js-ts-mode: regex pattern can cause incorrect parenthesis matching
Date: Sat, 16 Sep 2023 14:40:02 +0300
> Cc: casouri <at> gmail.com, 65470 <at> debbugs.gnu.org, theo <at> thornhill.no,
>  jostein <at> secure.kjonigsen.net, monnier <at> iro.umontreal.ca, btuin <at> mailo.com
> Date: Sat, 16 Sep 2023 14:20:16 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> > Cc: casouri <at> gmail.com, 65470 <at> debbugs.gnu.org, theo <at> thornhill.no,
> >  jostein <at> secure.kjonigsen.net, btuin <at> mailo.com, jostein <at> kjonigsen.net
> > Date: Sat, 16 Sep 2023 08:54:32 +0300
> > From: Eli Zaretskii <eliz <at> gnu.org>
> > 
> > > Date: Fri, 15 Sep 2023 16:35:55 +0300
> > > Cc: Eli Zaretskii <eliz <at> gnu.org>, Yuan Fu <casouri <at> gmail.com>,
> > >  Theodor Thornhill <theo <at> thornhill.no>,
> > >  Jostein Kjønigsen <jostein <at> kjonigsen.net>, btuin <at> mailo.com,
> > >  65470 <at> debbugs.gnu.org
> > > From: Dmitry Gutov <dmitry <at> gutov.dev>
> > > 
> > > On 15/09/2023 15:11, Jostein Kjønigsen wrote:
> > > >> This patch seems to fix that and bring JSX syntax highlighting back:
> > > >>
> > > >> diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
> > > >> index 57382c9cb31..7108ff49b28 100644
> > > >> --- a/lisp/progmodes/typescript-ts-mode.el
> > > >> +++ b/lisp/progmodes/typescript-ts-mode.el
> > > >> @@ -163,7 +163,7 @@ tsx-ts-mode--font-lock-compatibility-bb1f97b
> > > >>    ;; but then raises an error if the wrong node type is used. So it is
> > > >>    ;; important to check with the new node type (member_expression)
> > > >>    (condition-case nil
> > > >> -      (progn (treesit-query-capture language '((member_expression) @capture))
> > > >> +      (progn (treesit-query-capture language '(jsx_opening_element (member_expression) @capture))
> > > >> 	     '((jsx_opening_element
> > > >> 		[(member_expression (identifier)) (identifier)]
> > > >> 		@typescript-ts-jsx-tag-face)
> > > >>
> > > > I really don’t know this part of the code very well. If you’ve identified an issue/bug for a specific TSX use-case, and found a fix for it, I have no objections to it being applied.
> > > 
> > > No problem, pushed that to emacs-29, thanks.
> > 
> > This seems to cause:
> > 
> >     INFO     Scraping files for loaddefs...85%
> >   typescript-ts-mode:0: Warning: Not registering prefix "ts".  Affects: ("tsx-ts-mode--indent-compatibility-b893426" "tsx-ts-mode--font-lock-compatibility-bb1f97b" "tsx-ts--s-p-query" "tsx-ts--syntax-propertize" "ts-ts--s-p-query" "ts-ts--syntax-propertize" "ts-ts--syntax-propertize-captures")
> > 
> > Stefan, what do we usually do with such warnings?
> 
> This also causes byte-compilation warnings on a system that has no
> tree-sitter installed:
> 
>   In end of data:
>   progmodes/typescript-ts-mode.el:498:17: Warning: the function ‘treesit-node-end’ is not known to be defined.
>   progmodes/typescript-ts-mode.el:497:17: Warning: the function ‘treesit-node-start’ is not known to be defined.
>   progmodes/typescript-ts-mode.el:474:6: Warning: the function ‘treesit-query-compile’ is not known to be defined.
> 
> Could you please fix these?

I fixed this myself by simply declaring the functions the
byte-compiler was complaining about, but I'd be happier if someone
could explain these warnings, since the offending functions are not
called anywhere in the code I could see.  What did I miss?




This bug report was last modified 1 year and 249 days ago.

Previous Next


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