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: Dmitry Gutov <dmitry <at> gutov.dev>
To: Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>
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: bug#65470: 29.1.50; js-ts-mode: regex pattern can cause incorrect parenthesis matching
Date: Thu, 7 Sep 2023 15:09:39 +0300
On 05/09/2023 22:31, Jostein Kjønigsen wrote:
> The patch so far is attached. It’s intentionally -not- optimized to 
leave room for TSX cases which may arise, so hopefully no need to 
nitpick this yet.

I was going to nitpick it, but then read the rest of your message ;-(

> However the patch for js-ts-mode has lots of … interesting stuff about jsx I have not included, for no other reason than not understanding what type of use-cases they are meant to support.
> 
> If someone can provide me some examples for the JSX use-cases, I can try to make room for TSX-variants of the same code.

The idea was to "enclose" every TSX in "generic string" syntax so that 
whatever unpaired characters are inside (such as (, ", ...), won't 
affect syntax-ppss status on the outside. I'm not sure how critical that 
is, but I guess some users might encounter such situations.

Examples like:

  ReactDOM.render(
    <div className="">
      <h1>Hello, Welcome to React and TypeScript ;-(</h1>
    </div>,
    // type closing paren here and see that it's matched to opener above
    document.getElementById("root")
  );





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.