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


Message #11 received at 65470 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dmitry <at> gutov.dev>, Theodor Thornhill <theo <at> thornhill.no>,
 Jostein Kjonigsen <jostein <at> kjonigsen.net>, Yuan Fu <casouri <at> gmail.com>
Cc: btuin <at> mailo.com, 65470 <at> debbugs.gnu.org
Subject: Re: bug#65470: 29.1.50;
 js-ts-mode: regex pattern can cause incorrect parenthesis matching
Date: Thu, 24 Aug 2023 08:59:17 +0300
> Date: Wed, 23 Aug 2023 16:23:13 +0300
> From: Dmitry Gutov <dmitry <at> gutov.dev>
> 
> On 23/08/2023 12:05, Augustin Chéneau (BTuin) wrote:
> > 
> > With the mode js-ts-mode, matching tokens (such as '()', '[]') can be
> > incorrectly paired by `show-paren-mode`. This is trivially reproducible
> > with this simple example:
> > 
> > (/foobar)/)
> > 
> > The first parenthesis is matched with the second one, which is inside a
> > regular expression pattern (between slashes), and the last one is not
> > paired.
> > 
> > The behavior should be the same as for string, the content of the regex
> > pattern should have no influence on the structure of the code. The first
> > parenthesis should match with the third one. Here, the first parenthesis
> > is matched with the last one:
> > 
> > ("foobar)")
> > 
> > js-mode behaves correctly in both cases.
> 
> Sounds like js-ts-mode also needs a syntax-propertize-function, similar 
> to c-ts-mode, ruby-ts-mode and rust-ts-mode.
> 
> Others (typescript-ts-mode?) probably need it as well, at least modes 
> for those languages that have dedicated regexp or heredoc syntax.

Would someone please add syntax-propertize-function in modes that need
it?  I think this should be done on the emacs-29 branch.

TIA




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.