From: Ergus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 71784@debbugs.gnu.org, Yuan Fu <casouri@gmail.com>
Subject: bug#71784: 31.0.50; Inconsistent fontification for field_identifier in c++-ts-mode
Date: Thu, 27 Jun 2024 00:24:46 +0200 [thread overview]
Message-ID: <uhdwl57n7kkbmtifir6q6djqvdqyryvuplocxqweeezmdjn23d@xzu424wx3jb5> (raw)
In-Reply-To: <8634oz9077.fsf@gnu.org>
On Wed, Jun 26, 2024 at 06:46:04PM GMT, Eli Zaretskii wrote:
>> Date: Wed, 26 Jun 2024 16:13:47 +0200
>> From: Ergus via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>
>> Using the c++-ts-mode I found that there is some inconsistent
>> fontification for the `fields_identifier`:
>>
>> See the fontification in this example with `emacs -Q`.
>>
>> ```test.cpp
>>
>> std::string key;
>> bool inserted;
>>
>> struct name_t {
>> std::string key;
>> bool inserted;
>> };
>>
>> name_t keys = {"aaa", true};
>>
>> keys.inserted = false;
>> bool a = keys.inserted;
>> ```
>>
>> 1. The `keys.inserted` values are shown differently before or after the
>> = (the inserted word is fontified is some cases, but not in all)
>>
>> 2. The variable names are fontified differently outside or
>> inside the struct.
>>
>> 3. The escape sequence (\t) is fontified differently to the rest of the
>> text inside the string. I don't know if that is intentional or not. If
>> it is intentional, just ignore this comment.
>>
>> The inconsistencies 1 and 2 are not only different to c++-mode but they
>> are semantically incorrect.
>
>What does treesit-explore-mode tell you about these instances of
>keys.inserted?
This is the whole explorer buffer for the example code:
(translation_unit
(declaration
type: (qualified_identifier scope: (namespace_identifier) :: name: (type_identifier))
declarator: (identifier) ;)
(declaration type: (primitive_type) declarator: (identifier) ;)
(struct_specifier struct name: (type_identifier)
body:
(field_declaration_list {
(field_declaration
type: (qualified_identifier scope: (namespace_identifier) :: name: (type_identifier))
declarator: (field_identifier) ;)
(field_declaration type: (primitive_type) declarator: (field_identifier) ;)
}))
;
(declaration type: (type_identifier)
declarator:
(init_declarator declarator: (identifier) =
value:
(initializer_list {
(string_literal " (string_content) ")
, (true) }))
;)
(expression_statement
(assignment_expression
left: (field_expression argument: (identifier) operator: . field: (field_identifier))
operator: = right: (false))
;)
(declaration type: (primitive_type)
declarator:
(init_declarator declarator: (identifier) =
value: (field_expression argument: (identifier) operator: . field: (field_identifier)))
;))
The faces are:
1. Inside the struct insert has: font-lock-property-name-face
It says `declarator: (field_identifier)` and I thin is applying the
function c-ts-mode--fontify-declarator.
2. In `keys.inserted = false;` the `insert` words has: font-lock-property-use-face
It says `field: (field_identifier)` and applies (I think) :feature 'property
3. In `bool a = keys.inserted;` is not fontified.
But it says `field: (field_identifier)` like in 2.
Hope this helps.
Ergus
next prev parent reply other threads:[~2024-06-26 22:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87pls394h0.fsf.ref@aol.com>
2024-06-26 14:13 ` bug#71784: 31.0.50; Inconsistent fontification for field_identifier in c++-ts-mode Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-26 15:46 ` Eli Zaretskii
2024-06-26 22:24 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-06-27 7:16 ` Yuan Fu
2024-06-27 14:33 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-17 6:27 ` Yuan Fu
2024-08-04 7:13 ` Eli Zaretskii
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=uhdwl57n7kkbmtifir6q6djqvdqyryvuplocxqweeezmdjn23d@xzu424wx3jb5 \
--to=bug-gnu-emacs@gnu.org \
--cc=71784@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=eliz@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.