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 07:34:58 +0200

> > It looks like tree sitter already supports this using language injection:
> >
> > <https://github.com/tree-sitter/tree-sitter-cpp/issues/116>
> >
> > I am not sure if we can handle this same way in emacs. Or if it is a better 
> > or worst approach than using a made in home workaround.
>
> 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.
According to Yuan this should already be supported with emacs (at
least the parser part, you would probably need to add some specific
rule for fontification).
Yuan, a complete example would be great!

Another use case in c-ts-mode would be fontifying format strings in
printf functions. There was some discussion about doing that in the Go
grammar and there too they concluded injections was the canonical
treesitter way for stuff like this and dropped the pull request.

Thanks,
Filippo



reply via email to

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