emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A few questions about c++-ts-mode.


From: Filippo Argiolas
Subject: Re: A few questions about c++-ts-mode.
Date: Thu, 9 May 2024 08:11:53 +0200

On Thu, May 9, 2024 at 7:53 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Filippo Argiolas <filippo.argiolas@gmail.com>
> > Date: Thu, 9 May 2024 07:34:58 +0200
> > Cc: Ergus <spacibba@aol.com>, emacs-devel@gnu.org, casouri@gmail.com
> >
> > > If the only solution is language injection, then doing that our usual
> > > way (with regexps etc.) is easier and more flexible.  I thought I saw
> > > some commits in the C++ grammar that actually support that in the
> > > grammar itself.  If there is such support, we should use it, IMO.
> > >
> >
> > Sorry to intrude, may I ask what's the problem with language
> > injection? it seems the perfect use case for this.
>
> I didn't say there was a problem, I said that doing it with regexp
> etc. would be easier and more flexible.
>
> Language injection AFAIU requires an additional grammar library, which
> means someone must compile it, the end-user must ensure it's
> installed, etc.  IOW, it makes the disadvantages of tree-sitter more
> prominent, for the benefit of a very minor feature.  From where I
> stand, that makes the balance tip in favor of the simpler solution,
> which users could more easily activate and customize.

Thanks for the clarification!
I thought there was some intrinsic limitation either in the injection
feature or in emacs support for it.
Agree that requiring an extra grammar just for highlighting a couple
of @keywords would be too cumbersome.
OTOH from what I can tell injections seem popular in the nvim world so
that must not be that cumbersome for the users.

By the way, about printf format strings I was experimenting a bit here
[1] but refrained from proposing it upstream with the assumption that
it would be refused like for the tree-sitter-go pull request[2].

1. 
https://github.com/tree-sitter/tree-sitter-c/commit/fecec922c21b79ef83851f5028910bc316fcd8e1
2. https://github.com/tree-sitter/tree-sitter-go/pull/88



reply via email to

[Prev in Thread] Current Thread [Next in Thread]