unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Ergus <spacibba@aol.com>
Cc: "Ergus via Emacs development discussions." <emacs-devel@gnu.org>,
	Eli Zaretskii <eliz@gnu.org>
Subject: Re: A few questions about c++-ts-mode.
Date: Wed, 8 May 2024 17:16:11 -0700	[thread overview]
Message-ID: <C5E53505-87DA-47B1-A34A-FCC998AF060F@gmail.com> (raw)
In-Reply-To: <E757F13C-9BE7-4B3A-B830-32DB2488F106@aol.com>



> On May 8, 2024, at 2:05 PM, Ergus <spacibba@aol.com> wrote:
> 
> Hi Eli and Yuan
> 
> On May 8, 2024 3:35:52 PM GMT+02:00, Eli Zaretskii <eliz@gnu.org> wrote:
>>> From: Yuan Fu <casouri@gmail.com>
>>> Date: Tue, 7 May 2024 17:19:53 -0700
>>> Cc: emacs-devel@gnu.org
>>> 
>>>> 1. namespaces are not fontified like in c-mode (i.e in std::string the
>>>> `std` used to have font-lock-constant-face while `string` used to have
>>>> font-lock-type-face). It seems like tresitter identifies properly them
>>>> like (namespace_identifier) and (type_identifier)
>>> 
>>> Then we probably want to fontify namespaces in constant face. Or perhaps add a namespace-face that inherits from constant face.
>> 
>> I think using font-lock-constant-face is fine.  Patches welcome.
>> 
>>>> 2. Doc string comments are fontified like normal comments. It looks like
>>>> treesiter does not recognize them at all. Is this something we need to
>>>> report to treesitter or we need to workaround it in emacs side?
>>> 
>>> I’m working on that. I think the best way is to workaround it in Emacs.
>> 
>> Please note that some of those specially-formatted comments are
>> explicitly supported by the grammar.
>> 
> 
> 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.

Emacs supports language injection (in the name of embedded parser), see 38.7 Parsing Text in Multiple Languages in elisp manual.

The workaround we were talking about is just fontifynig the /** comments with font-lock-doc-face, nothing fancy. For more elaborate effect you’d need doxygen grammar. 

Yuan




  reply	other threads:[~2024-05-09  0:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fakigaygsqcunvvbm2zscn7qlkxi234f574ul3hl5vrhymm22k.ref@syjmsievkpp3>
2024-05-07 22:59 ` A few questions about c++-ts-mode Ergus
2024-05-08  0:19   ` Yuan Fu
2024-05-08  1:26     ` Ergus
2024-05-09  4:29       ` Yuan Fu
2024-05-09  6:18         ` Filippo Argiolas
2024-05-12 20:11         ` Ergus
2024-05-08 13:35     ` Eli Zaretskii
2024-05-08 21:05       ` Ergus
2024-05-09  0:16         ` Yuan Fu [this message]
2024-05-09  5:17           ` Eli Zaretskii
2024-05-09  5:03         ` Eli Zaretskii
2024-05-09  5:34           ` Filippo Argiolas
2024-05-09  5:53             ` Eli Zaretskii
2024-05-09  6:11               ` Filippo Argiolas
2024-05-09  7:03                 ` Eli Zaretskii
2024-05-13  6:23               ` Filippo Argiolas
2024-05-13  8:10                 ` Filippo Argiolas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C5E53505-87DA-47B1-A34A-FCC998AF060F@gmail.com \
    --to=casouri@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=spacibba@aol.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).