Subject: Re: bug#75217: 31.0.50; tsx-ts-mode has wonky text motions and indentation

From: Juri Linkov <[email-masked]>
Date: Sat, 11 Jan 2025 20:04:01 +0200

> 1. Insert the following into a tsx-ts-mode buffer:
>
> function F() {
>   return (
>     <H>Delete</H>
>   );
> }
>
> 2. Install tree-sitter-tsx v0.23.2
> 3. M-x tsx-ts-mode RET
> 3. M-: (goto-char 39) RET  (somewhere in the middle of "Delete")
> 4. M-b
> 5. Observe that point is not at the start of "Delete"

This is fixed in bug#73978.

> Following that, alter <H> to be <H foo="bar"> and hit RET at the start
> of "Delete", at this point you should see:
>
> function F() {
>   return (
>     <H foo="bar">
> 		   Delete</H>
>   );
> }
>
>
> This is unusual.

What indentation in your opinion would be correct?

> In addition, I just noticed one more thing; make a new file containing:
>
> function F() {
>   return (
>     <H>Delete</H>
>   );
> }
>
> Navigate to the start of "Delete", run M-x treesit-explore RET, hit RET
> and tell the explorer to highlight the jsx_text corresponding to
> "Delete", you should see that the region highlighted is not aligned with
> the end of the word "Delete", and, in turn, all subsequent AST nodes are
> mispositioned too.  Typing again fixes this issue.  It seems that the
> buffer needs to be freshly-started for this to happen for some reason.
>
> I do not have any idea why this might be happening.

I tried, but can't reproduce this treesit-explore issue.