bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65470: 29.1.50; js-ts-mode: regex pattern can cause incorrect parent


From: Dmitry Gutov
Subject: bug#65470: 29.1.50; js-ts-mode: regex pattern can cause incorrect parenthesis matching
Date: Tue, 12 Sep 2023 01:23:18 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

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>;
  }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]