* bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode
@ 2024-10-24 4:06 Yuan Fu
2024-11-09 9:11 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: Yuan Fu @ 2024-10-24 4:06 UTC (permalink / raw)
To: 73978; +Cc: theo
X-Debbugs-CC: theo@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
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode
2024-10-24 4:06 bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode Yuan Fu
@ 2024-11-09 9:11 ` Eli Zaretskii
2024-11-09 16:49 ` Yuan Fu
0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2024-11-09 9:11 UTC (permalink / raw)
To: Yuan Fu, theo; +Cc: 73978
Ping! Theo, can you answer Yuan's questions?
> Cc: theo@thornhill.no
> From: Yuan Fu <casouri@gmail.com>
> Date: Wed, 23 Oct 2024 21:06:40 -0700
>
> X-Debbugs-CC: theo@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
>
>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode
2024-11-09 9:11 ` Eli Zaretskii
@ 2024-11-09 16:49 ` Yuan Fu
0 siblings, 0 replies; 3+ messages in thread
From: Yuan Fu @ 2024-11-09 16:49 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Theodor Thornhill, 73978
> On Nov 9, 2024, at 1:11 AM, Eli Zaretskii <eliz@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@thornhill.no
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Wed, 23 Oct 2024 21:06:40 -0700
>>
>> X-Debbugs-CC: theo@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
>>
>>
>>
>>
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-09 16:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-24 4:06 bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode Yuan Fu
2024-11-09 9:11 ` Eli Zaretskii
2024-11-09 16:49 ` Yuan Fu
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).