GNU bug report logs - #75217
31.0.50; tsx-ts-mode has wonky text motions and indentation

Previous Next

Package: emacs;

Reported by: Arsen Arsenović <arsen <at> aarsen.me>

Date: Tue, 31 Dec 2024 01:39:01 UTC

Severity: minor

Found in version 31.0.50

Full log


View this message in rfc822 format

From: Arsen Arsenović <arsen <at> aarsen.me>
To: Juri Linkov <juri <at> linkov.net>
Cc: 75217 <at> debbugs.gnu.org
Subject: bug#75217: 31.0.50; tsx-ts-mode has wonky text motions and indentation
Date: Sat, 11 Jan 2025 20:30:21 +0100
[Message part 1 (text/plain, inline)]
Juri Linkov <juri <at> linkov.net> writes:

>> 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.

Yes, seems fixed now.

>> 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?

A shift level extra compared to the opening < of the <H:

  function F() {
    return (
      <H foo="bar">
        Delete</H>
    );
  }

Currently, the indentation engine prefers:

  function F() {
    return (
      <H foo="bar">
                     Delete
      </H>
    );
  }

... which looks odd.

>> 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.

Hmm, yes, seems that this went away also.  

That's great!  Thank you so much!
-- 
Arsen Arsenović
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 106 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.