From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71784: 31.0.50; Inconsistent fontification for field_identifier in c++-ts-mode Date: Thu, 27 Jun 2024 00:24:46 +0200 Message-ID: References: <87pls394h0.fsf.ref@aol.com> <87pls394h0.fsf@aol.com> <8634oz9077.fsf@gnu.org> Reply-To: Ergus Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30820"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71784@debbugs.gnu.org, Yuan Fu To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 27 00:27:20 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sMb6m-0007nR-GS for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 Jun 2024 00:27:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMb5V-0006qX-ON; Wed, 26 Jun 2024 18:26:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMb5T-0006bP-KX for bug-gnu-emacs@gnu.org; Wed, 26 Jun 2024 18:25:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMb5T-0003YX-AQ for bug-gnu-emacs@gnu.org; Wed, 26 Jun 2024 18:25:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sMb5V-0003Gp-PH for bug-gnu-emacs@gnu.org; Wed, 26 Jun 2024 18:26:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ergus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Jun 2024 22:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71784 X-GNU-PR-Package: emacs Original-Received: via spool by 71784-submit@debbugs.gnu.org id=B71784.171944070512499 (code B ref 71784); Wed, 26 Jun 2024 22:26:01 +0000 Original-Received: (at 71784) by debbugs.gnu.org; 26 Jun 2024 22:25:05 +0000 Original-Received: from localhost ([127.0.0.1]:40565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMb4b-0003FX-5h for submit@debbugs.gnu.org; Wed, 26 Jun 2024 18:25:05 -0400 Original-Received: from sonic305-3.consmr.mail.bf2.yahoo.com ([74.6.133.42]:34326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMb4Z-0003Ez-KP for 71784@debbugs.gnu.org; Wed, 26 Jun 2024 18:25:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1719440694; bh=SQvGSsa/X1MQ+N0UFsyzhE7LcU7U7z6LIC5Ecw4dze4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=aD3sKaKHbH1j1ysu2xMySx+ADFLBg12NwMV7JDFmpIvwQuncFiUBN2rzg4pk/Nu52wK1m9pI60j039hlphuoGQJ6uloqTuLXxKOa8hd4QKaSjz0C6dotBTGMpMtodz5op4UUhQX1BL1mWtIk/ocdAF60c32Zokm1/3TIjdNBpaR/DV7U81fL8qEOonp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WVXez.lJeJORQ37Gna0kwmEwwkC3kj0IeTX qj8kaUhsC7fn__fiKfmEhC0RPOp_vikrEGimYXT0KqrOiiQ.NDfYu80fEgRalJEf_fFfnfplrqbB A9X8uoEUkex8.snTUHJBPO2YZRcpSTNAde6K_2E.NU9ArYz2KcheX80RWmT65NkleRWxdOLs.kfG kuP1Y_b8CjOHqvy13ttj5eM5HqKBsu9YOlwXDgD5KRlwC_VoaD1R.Qah40JhwmKgadcWYAUavR2f NjDrf6u3vdaKsekY7fSS4UgnEiR4EVYLFXRbMKAYB46D1epDh._CYE1XIaYUEIZufxesH8Yg0Qwo a8lCf4kMGLfgcZAWWIOOeeTf3Q75nMXSBA872bnrz_pO2phdlGWz1UkDZrDaLXZfgPGKEtN3cQoJ 1EKuBTamNjL_vAs91fBDj_RxC1RA3uA2EYLHN8.VjK X-Sonic-MF: X-Sonic-ID: 7f4984d9-53de-4518-8eea-27b976e4e8e4 Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.bf2.yahoo.com with HTTP; Wed, 26 Jun 2024 22:24:54 +0000 Original-Received: by hermes--production-ir2-85cf877599-cnwg7 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID be2ffa867787b383860766c9644321c8; Wed, 26 Jun 2024 22:24:48 +0000 (UTC) Content-Disposition: inline In-Reply-To: <8634oz9077.fsf@gnu.org> X-Mailer: WebService/1.1.22407 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:287972 Archived-At: 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" >> >> 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