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 #93 received at 65470 <at> debbugs.gnu.org (full text, mbox):

From: Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: Yuan Fu <casouri <at> gmail.com>, 65470 <at> debbugs.gnu.org,
 Theodor Thornhill <theo <at> thornhill.no>, btuin <at> mailo.com,
 Eli Zaretskii <eliz <at> gnu.org>,
 Jostein Kjønigsen <jostein <at> kjonigsen.net>
Subject: Re: bug#65470: 29.1.50; js-ts-mode: regex pattern can cause incorrect
 parenthesis matching
Date: Tue, 12 Sep 2023 08:29:41 +0200
[Message part 1 (text/plain, inline)]
On 12 Sep 2023, at 00:23, Dmitry Gutov <dmitry <at> gutov.dev> wrote:
> 
> Hi Jostein!
> 
> The patch looks good overall (though I haven't tested it).
> 
> On 11/09/2023 22:37, Jostein Kjønigsen wrote:
> 
> > So to fix that, I’ve tried to anchor the query to top-level constructs which typically does not nest. Looking at the query for js.el, I can only assume that you were trying to too solve the same problem, Dmitry?
> 
> That's right.
> 
>> +                             ((arguments (jsx_element) @jsx))
>> +                             ((parenthesized_expression (jsx_element) @jsx))))))
> 
> These two contexts actually seem missing in my patch for js-ts-mode. :-)
> 
> OTOH, it seems like the ones that _are_ included there, are missing here. Don't they?
> 
>  ((variable_declarator value: (jsx_element) @jsx))
> 
> corresponds do
> 
>  let v = <div>...</div>
> 
>  ((assignment_expression right: (jsx_element) @jsx))
> 
> corresponds do
> 
>  v = <p>...<p>
> 
> (with variable declared previously), and
> 
>  ((return_statement (jsx_element) @jsx))
> 
> corresponds to
> 
>  function f() {
>    return <div>...<div>;
>  }

Good feedback. I’ve tested and included those as well. Attached is a new patch.

[0001-typescript-ts-mode-Fix-syntax-properties-for-regexp-.patch (application/octet-stream, attachment)]
[Message part 3 (text/plain, inline)]

—
Jostein


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.