Subject: bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode

From: Yuan Fu <[email-masked]>
Date: Wed, 25 Dec 2024 00:33:10 -0800

> On Dec 24, 2024, at 11:40 PM, Juri Linkov <[email-masked]> wrote:
> 
>>> ReactDOM.render(
>>> <div>
>>> <h1>Hello, Welcome to React and TypeScript</h1>
>>> </div>,
>>> document.getElementById("root")
>>> );
>>> 
>>> 1. move point to the beginning of <h1>
>>> 2. type C-M-b
>>> 3. point incorrectly moves to inside <div>
>>> 
>>> However, this the above patch, point doesn't move
>>> that is correct.
>>> 
>>> Another test case:
>>> 
>>> 1. move point to the beginning of the word "Welcome"
>>> 2. type C-M-b
>>> 3. point incorrectly moves to the letter "e" instead of correct "H"
>>> 
>>> 4. type C-M-f a few times until the end of text
>>> 5. point stops at the letter "t" instead of moving after the last letter
>>> 
>>> All these cases work correctly with the patch above.
>> 
>> I understand the problem you want to solve, but the patch above will
>> bring back the bug I was trying to fix in the first place.
> 
> The patch just demonstrated one of possible ways to solve the problem.
> 
>> And I still don’t understand the intention of your patch.  Maybe
>> I missed something.  Am I correct that you want to apply string syntax
>> on the tags, eg, <div>, <button>, </button>, </div>?
> 
> I don't need to apply string syntax on the tags.  I just found
> that currently C-M-f navigation was broken.  Maybe there are
> other ways to fix it?

Then let’s look for other ways to solve the problem you demonstrated. Dmitry, would there be any negative effects if we apply the whitespace syntax on all the text (rather than string syntax)? Ah, I guess skip-syntax wouldn’t work right. Is there another way to tell syntax-ppss to skip a chunk of text when scanning?

Yuan