GNU bug report logs - #73978
31.0.50; Text syntax applied on too many things in tsx-ts-mode

Previous Next

Package: emacs;

Reported by: Yuan Fu <casouri <at> gmail.com>

Date: Thu, 24 Oct 2024 04:08:02 UTC

Severity: normal

Found in version 31.0.50

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Theodor Thornhill <theo <at> thornhill.no>, 73978 <at> debbugs.gnu.org
Subject: bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode
Date: Sat, 9 Nov 2024 08:49:55 -0800

> On Nov 9, 2024, at 1:11 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
> Ping! Theo, can you answer Yuan's questions?

I’ve been using my local fix at work for a while now and it seems to work fine. I’ll make a patch and apply in a few days.

Yuan

> 
>> Cc: theo <at> thornhill.no
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Wed, 23 Oct 2024 21:06:40 -0700
>> 
>> X-Debbugs-CC: theo <at> thornhill.no
>> 
>> In tsx-ts-mode we use this query to apply syntax properties:
>> 
>> 
>> (defvar tsx-ts--s-p-query
>>  (when (treesit-available-p)
>>    (treesit-query-compile 'tsx
>>                           '(((regex pattern: (regex_pattern) @regexp))
>>                             ((variable_declarator value: (jsx_element) @jsx))
>>                             ((assignment_expression right: (jsx_element) @jsx))
>>                             ((arguments (jsx_element) @jsx))
>>                             ((parenthesized_expression (jsx_element) @jsx))
>>                             ((return_statement (jsx_element) @jsx))))))
>> 
>> 
>> And then in tsx-ts--syntax-propertize-captures we mark everything
>> enclosed by the captured jsx_element nodes in text fences.
>> 
>> Then for the following code
>> 
>> <button onClick={() => {
>>  func();
>>  return true;
>> }}>
>>  Text
>>  {func();}
>> </button>
>> 
>> All the func() and other code will be considered text because the whole
>> jsx tag (<button>...</button>) are wrapped in string fences. Theo,
>> what’s the original intention for marking jsx_elements as text? Can we
>> only mark jsx_text as string?
>> 
>> Yuan
>> 
>> 
>> 
>> 
>> 





This bug report was last modified 133 days ago.

Previous Next


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