[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A few questions about c++-ts-mode.
From: |
Ergus |
Subject: |
Re: A few questions about c++-ts-mode. |
Date: |
Wed, 08 May 2024 23:05:10 +0200 |
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.
>> > 3. macros like `#if defined(something)` fontifies the whole macro with
>> > same font (the `identifier` used to have no colors in c++-mode)
>>
>> We should update the fontification to leave out the identifier.
>
>We seem to have the technology already, but we are overwriting it?
>Observe:
>
> (preproc_defined) @font-lock-preprocessor-face
> (preproc_defined (identifier) @font-lock-variable-name-face)
> [,@c-ts-mode--preproc-keywords] @font-lock-preprocessor-face)
>
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
- A few questions about c++-ts-mode., Ergus, 2024/05/07
- Re: A few questions about c++-ts-mode., Yuan Fu, 2024/05/07
- Re: A few questions about c++-ts-mode., Eli Zaretskii, 2024/05/08
- Re: A few questions about c++-ts-mode., Eli Zaretskii, 2024/05/09
- Re: A few questions about c++-ts-mode., Filippo Argiolas, 2024/05/09
- Re: A few questions about c++-ts-mode., Eli Zaretskii, 2024/05/09
- Re: A few questions about c++-ts-mode., Filippo Argiolas, 2024/05/09
- Re: A few questions about c++-ts-mode., Eli Zaretskii, 2024/05/09
- Re: A few questions about c++-ts-mode., Filippo Argiolas, 2024/05/13
- Re: A few questions about c++-ts-mode., Filippo Argiolas, 2024/05/13