From: Juri Linkov <juri@linkov.net>
To: Kohei Tsuruta <seventhepg@gmail.com>
Cc: Yuan Fu <casouri@gmail.com>, 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, 07 Jan 2025 19:44:27 +0200 [thread overview]
Message-ID: <87ldvmjz7o.fsf@mail.linkov.net> (raw)
In-Reply-To: <m2bjwiwr2d.fsf@gmail.com> (Kohei Tsuruta's message of "Tue, 07 Jan 2025 08:02:02 -0800")
> 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"))))))
next prev parent reply other threads:[~2025-01-07 17:44 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 [this message]
2025-01-08 2:29 ` Yuan Fu
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ldvmjz7o.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=75422@debbugs.gnu.org \
--cc=casouri@gmail.com \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.