Subject: bug#63708: 29.0.60; rust-ts-mode not properly handling apostrophe

From: Randy Taylor <[email-masked]>
Date: Mon, 29 May 2023 13:34:46 +0000

On Monday, May 29th, 2023 at 07:25, Eli Zaretskii <[email-masked]> wrote:
> > Date: Sun, 28 May 2023 19:52:38 +0000
> 
> > From: Йордан Миладинов [email-masked]
> > Cc: Eli Zaretskii [email-masked], [email-masked], [email-masked]
> > (while (re-search-forward (rx (or "<" ">")) end t)
> > - (pcase (treesit-node-type
> > - (treesit-node-parent
> > - (treesit-node-at (match-beginning 0))))
> > - ("type_arguments"
> > - (put-text-property (match-beginning 0)
> > - (match-end 0)
> > - 'syntax-table
> > - (pcase (char-before)
> > - (?< '(4 . ?>))
> > - (?> '(5 . ?<))))))))
> > + (let ((parent-type (treesit-node-type
> > + (treesit-node-parent
> > + (treesit-node-at (match-beginning 0))))))
> > + (when (or (string-equal parent-type "type_arguments")
> > + (string-equal parent-type "type_parameters"))
> > + (put-text-property (match-beginning 0)
> > + (match-end 0)
> > + 'syntax-table
> > + (pcase (char-before)
> > + (?< '(4 . ?>))
> > + (?> '(5 . ?<))))))))
> 
> 
> Here, AFAIU you needed to add a single line, but instead you rewrote a
> 'pcase' as a 'when', and got a much larger change. Was that really
> needed?
> 

I think keeping the existing loop as is but making a slight modification:
-      ("type_arguments"
+      ((or "type_arguments" "type_parameters")

should be enough?

> I also don't understand how a bug for go-ts-mode led to a change that
> also affects rust-ts-mode. Can you explain?
> 

The go-ts-mode change does not affect rust-ts-mode. The same bug is present in go-ts-mode.