From: Yuan Fu <casouri@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: Kohei Tsuruta <seventhepg@gmail.com>,
Eli Zaretskii <eliz@gnu.org>,
75422@debbugs.gnu.org
Subject: bug#75422: 30.0.93; [PATCH] forward-sexp and backward-sexp jump outside of comments in tsx-ts-mode
Date: Tue, 7 Jan 2025 18:29:25 -0800 [thread overview]
Message-ID: <07F33B09-D0C4-4C6A-8F80-10E2173D92FF@gmail.com> (raw)
In-Reply-To: <87ldvmjz7o.fsf@mail.linkov.net>
> On Jan 7, 2025, at 9:44 AM, Juri Linkov <juri@linkov.net> wrote:
>
>> Steps to reproduce
>> - emacs -Q test.tsx
>> - (tsx-ts-mode)
>> - Move point at the end of the comment at line 3
>> - (backward-sexp)
>>
>> The expected point position after (backward-sexp) is "treesit-thing-|settings"
>> or at least stay inside of the comment line, however, point moves to the
>> beginning of "Hello".
>> Likewise, if you C-x C-e at the end of the comment line, it evaluates "Hello".
>>
>> --- test.tsx (| is point) ---
>> export const App = () => {
>> const greeting = "Hello"
>> // treesit-thing-settings|
>> return <>{greeting}</>
>> }
>> --- END test.tsx ---
>>
>> It happens because tsx-ts-mode doesn't recognize comments. In
>> typescript-ts-base-mode, treesit-thing-settings is set to have "text" as
>> a thing for typescript but it's missing in tsx-ts-mode when it's set for
>> tsx.
>
> Thanks for the report. This is fixed in Emacs 31.
>
> However, maybe Yuan will agree to add this small fix to Emacs 30?
>
>> diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
>> index 4a38d1da596..0ffcb144771 100644
>> --- a/lisp/progmodes/typescript-ts-mode.el
>> +++ b/lisp/progmodes/typescript-ts-mode.el
>> @@ -564,7 +564,9 @@ tsx-ts-mode
>> (sentence ,(regexp-opt
>> (append typescript-ts-mode--sentence-nodes
>> '("jsx_element"
>> - "jsx_self_closing_element")))))))
>> + "jsx_self_closing_element"))))
>> + (text ,(regexp-opt '("comment"
>> + "template_string"))))))
I think it’s fine. Though it’s for Eli to decide.
Yuan
next prev parent reply other threads:[~2025-01-08 2:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 16:02 bug#75422: 30.0.93; [PATCH] forward-sexp and backward-sexp jump outside of comments in tsx-ts-mode Kohei Tsuruta
2025-01-07 17:44 ` Juri Linkov
2025-01-08 2:29 ` Yuan Fu [this message]
2025-01-08 7:44 ` Juri Linkov
2025-01-08 13:12 ` Eli Zaretskii
2025-01-09 7:51 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=07F33B09-D0C4-4C6A-8F80-10E2173D92FF@gmail.com \
--to=casouri@gmail.com \
--cc=75422@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=juri@linkov.net \
--cc=seventhepg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).