GNU bug report logs - #77727
tsx-ts-mode: fill-paragraph doesn't work for doc-comments

Previous Next

Package: emacs;

Reported by: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>

Date: Fri, 11 Apr 2025 08:12:02 UTC

Severity: normal

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
To: 77727 <at> debbugs.gnu.org
Subject: bug#77727: tsx-ts-mode: fill-paragraph doesn't work for doc-comments
Date: Fri, 11 Apr 2025 11:10:34 +0300
Steps to reproduce:

1. Open `test.tsx` with the following content:

    // File description
    /**
     * Lorem ipsum dolor sit amet consectetur adipiscing elit. Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus duis convallis.
     */
2. Try to "fill" the Lorem ipsum text.

Result: nothing changes, the text doesn't get "filled".

---------

I dug into it, the bug resides in the following condition in
`c-ts-common--fill-paragraph`:

                …
                ;; In rust, NODE will be the body of a comment, and the
                ;; parent will be the whole comment.
                (if-let* ((start (treesit-node-start
                                  (treesit-node-parent node))))
                    (save-excursion
                      (goto-char start)
                      (looking-at "//"))))
                …

The problem is that "(treesit-node-start (treesit-node-parent node))" returns 1.
That happens disregarding the amount of code between the "// File description"
line and where "/* Lorem ipsum…" is. In the actual code there's 51 lines in
between.

Why treesit-node-start does that I don't know, so I decided to report it.




This bug report was last modified 31 days ago.

Previous Next


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