[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mod
From: |
Yuan Fu |
Subject: |
bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode |
Date: |
Tue, 24 Dec 2024 00:52:24 -0800 |
> On Dec 24, 2024, at 12:31 AM, Juri Linkov <juri@linkov.net> wrote:
>
>> While testing forward-sexp in tsx-ts-mode I noticed that
>> this line in 'tsx-ts--s-p-query':
>>
>> ((jsx_text) @jsx)
>>
>> disrupts syntax-based navigation for forward-sentence-default-function.
>
> With this patch everything works perfectly:
>
> diff --git a/lisp/progmodes/typescript-ts-mode.el
> b/lisp/progmodes/typescript-ts-mode.el
> index 5c3c9a24ff4..01dd8297996 100644
> --- a/lisp/progmodes/typescript-ts-mode.el
> +++ b/lisp/progmodes/typescript-ts-mode.el
> @@ -630,7 +640,8 @@ tsx-ts--s-p-query
> (when (treesit-available-p)
> (treesit-query-compile 'tsx
> '(((regex pattern: (regex_pattern) @regexp))
> - ((jsx_text) @jsx)))))
> + ((jsx_opening_element) @jsx)
> + ((jsx_closing_element) @jsx)))))
>
> (defun typescript-ts--syntax-propertize (beg end)
> (let ((captures (treesit-query-capture 'typescript typescript-ts--s-p-query
> beg end)))
Thanks for looking into this! But what’s the intention of this change? In a
snippet like this:
<button onClick={() => {
func();
return true;
}}>
Text
{func();}
</button>
Only the “Text” part should be marked as string. With the change you proposed,
the <button …> and </button> part would be marked as string.
We must mark text as strings because they could include </>/(/) etc and mess
with syntax-ppss.
Yuan
- bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode, Juri Linkov, 2024/12/24
- bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode, Juri Linkov, 2024/12/24
- bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode,
Yuan Fu <=
- bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode, Juri Linkov, 2024/12/24
- bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode, Yuan Fu, 2024/12/24
- bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode, Juri Linkov, 2024/12/25
- bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode, Yuan Fu, 2024/12/25
- bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode, Dmitry Gutov, 2024/12/26