Subject: Re: bug#60087: 29.0.60; c++-ts-mode conflict with electric-pair-mode

From: Daniel Martín <[email-masked]>
Date: Thu, 15 Dec 2022 22:34:08 +0100

João Távora <[email-masked]> writes:

> I don't know how this can work if '<' is going to be used to input
> the less-than operator.  I think more complex syntax-propertization
> functionality is going to be needed here.  I don't have a tree-sitter
> build to test, but I'd say that the tree-sitter backend should be asked
> about what kind of '<' and '>' we're talking about.  AFAICT, just
> saying that '<' has the delimiter syntax in C++ is wrong. It's not
> like '(' or '{.'

Yes, you are right.  I think for now it's better to consider them as
punctuation.

A better idea may be to add a syntax-table text property to "<" and ">"
when they define a C++ template (or a Java generic).  Tree-sitter can
match something like a "template_argument_list" node easily, but I
wonder how to keep this information in sync with the buffer text in the
most efficient way?

I thought about adding a custom parser notifier via
treesit-parser-add-notifier and remove/add the text properties for the
template argument list delimiters.  WDYT?  Of course, C would not use
this extra processing at all.  I've CC'ed Yuan for feedback.