From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Tree sitter support for C-like languages Date: Wed, 16 Nov 2022 09:51:43 -0800 Message-ID: <33EE9B30-C6EC-48D1-BEAF-ABAA1350C870@gmail.com> References: <87tu36em9t.fsf@thornhill.no> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37899"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Theodor Thornhill Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 16 18:52:05 2022 Return-path: Envelope-to: ged-emacs-devel@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 1ovMZw-0009co-WC for ged-emacs-devel@m.gmane-mx.org; Wed, 16 Nov 2022 18:52:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovMZj-00035u-9s; Wed, 16 Nov 2022 12:51:51 -0500 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 1ovMZh-0002x5-JG for emacs-devel@gnu.org; Wed, 16 Nov 2022 12:51:49 -0500 Original-Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovMZg-0002HF-0I for emacs-devel@gnu.org; Wed, 16 Nov 2022 12:51:49 -0500 Original-Received: by mail-pl1-x632.google.com with SMTP id 4so17165230pli.0 for ; Wed, 16 Nov 2022 09:51:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FJ3XXkPPPSYpsEvyimWFa2fE4oB7yw5TlRCnl43sFZU=; b=ZamkZUzaCjQEQCzAaU8vCw9S6JXU4E7B+jkQHXpCdEUL2cIZGAOYbyuMed1zceGX7t uimfG8wVYPvxh6ArwHq0F5uAdjIvpqSdYgNabrQguxcta1d8ESeUuQHOSU9leYxokjbB G3bDFnuvFfLEfW1MABgBOz/oADYRV6epuq3hPokXflPcHnuo/HKnPX+zwR6UWimTlOnT wDEFb0h0fHXRN5wj0JPWA9kSqSfyPxkVi/eOhe0ZsYlpqm4p1eUpfsg1hU0zoGxlaNAW vt48D/UifxDP7G54N4oYL0EcbDYe51Bsw4isbqVh20a5cOwx5rg5l3e5Ccm4R3s+qm7M GWOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FJ3XXkPPPSYpsEvyimWFa2fE4oB7yw5TlRCnl43sFZU=; b=MhTVjvrVzknytEw0K7aMIC1f2CmPmrcbGWmZYew03pNZt9Oc5SA4/xQF26xy9nIiK9 7xK5madhmav7i+7Ss9lhC5xBZy53vyFlHltJElCPI7hcrIYLxZPr9SE7vczsoxSKdX7N /ZbsWFaeQl/a1HmM+nRKN25moRuWZpY0O2w6uEKxKY/zP6aFFxkZkbwHLFF03fY3uwCB wOdGRzO/0x+06ZQMHCPQz8U2E/W1XB9976cuCAeJYRzPWtzjVN+zhZy2SrliE0f619ii WgvSTaZvZlPnRgPZmZ6kcJzXcRNC3SOBJgpL85kGvjFAc/mViHdo1xDu5ufcDHoakY2N PkrA== X-Gm-Message-State: ANoB5pl6meV0BN3LkLyS2P11+iVSfB/cQfSX+av8rTrNhlzsFHcPH7NF MzQBY2CgwKb08lP5sZP7JJ7Tqm+ROLE= X-Google-Smtp-Source: AA0mqf43CgkWNdyJZHbzcMjcS6MKbiUN4RJ+tzxyaOyWOxmP7vQ1d58D0Knup7AVZiAZhS5hY81aLg== X-Received: by 2002:a17:902:6943:b0:187:3a43:3a9d with SMTP id k3-20020a170902694300b001873a433a9dmr9932407plt.152.1668621106529; Wed, 16 Nov 2022 09:51:46 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id v8-20020a17090a00c800b00212e8945d97sm1845535pjd.56.2022.11.16.09.51.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Nov 2022 09:51:46 -0800 (PST) In-Reply-To: <87tu36em9t.fsf@thornhill.no> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=casouri@gmail.com; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299964 Archived-At: I noticed that the new fontification is much busier than cc-mode, so = here=E2=80=99s some of my thoughts: :language mode :override t :feature 'expression '((assignment_expression left: (identifier) @font-lock-variable-name-face) I think assignment should be isolated out to an =E2=80=9Cassignment=E2=80=9D= feature, where we highlight the lhs target of the assignment: the = identifier, the field, etc. For example, the assignment group in Python = [1] (call_expression function: (identifier) @font-lock-function-name-face) (field_expression field: (field_identifier) @font-lock-variable-name-face) (field_expression argument: (identifier) @font-lock-variable-name-face field: (field_identifier) @font-lock-variable-name-face) (pointer_expression argument: (identifier) @font-lock-variable-name-face)) They highlight every single use of functions and fields, so they should = be level 3. (And I=E2=80=99ll disable them personally :-) Highlighting = the field and the functions should be two different features IMO. :language mode :override t :feature 'statement '((expression_statement (identifier) @font-lock-variable-name-face) (labeled_statement label: (statement_identifier) @font-lock-type-face)) What does this rule highlight? [1] :feature 'assignment :language 'python `(;; Variable names and LHS. (assignment left: (identifier) @font-lock-variable-name-face) (assignment left: (attribute attribute: (identifier) @font-lock-variable-name-face)) (pattern_list (identifier) @font-lock-variable-name-face) (tuple_pattern (identifier) @font-lock-variable-name-face) (list_pattern (identifier) @font-lock-variable-name-face) (list_splat_pattern (identifier) @font-lock-variable-name-face)) Yuan=