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 12:10:22 -0800 Message-ID: <02C0B7A1-73B7-45FA-8EA9-FD389817099F@gmail.com> References: <87tu36em9t.fsf@thornhill.no> <33EE9B30-C6EC-48D1-BEAF-ABAA1350C870@gmail.com> <87tu2y4qhq.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="4877"; 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 21:11:24 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 1ovOkl-00016F-LT for ged-emacs-devel@m.gmane-mx.org; Wed, 16 Nov 2022 21:11:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovOju-0003kW-5x; Wed, 16 Nov 2022 15:10:30 -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 1ovOjs-0003kA-44 for emacs-devel@gnu.org; Wed, 16 Nov 2022 15:10:28 -0500 Original-Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovOjq-0004xK-6z for emacs-devel@gnu.org; Wed, 16 Nov 2022 15:10:27 -0500 Original-Received: by mail-pg1-x52a.google.com with SMTP id b62so17792973pgc.0 for ; Wed, 16 Nov 2022 12:10:25 -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=zrPNaQxG7x4RPY6+kXspohieeDGUF3HHMQapFzkJ3o0=; b=W8SfpkL94H6mODQOA8NYNV6Gw72AF+4WgHwHFn7Wi4IC7NXRrBqkbR5OvwymKmpYdf km4xaPl5S88T13SmX1duoESjB12Kze7hMO7g/KTi1SGVurEhoNCfTW+ga/Hra7qcWaKM iMO+uKmRUFY3JtgWAPjBPHSl2YrVEBZSwZCdXLMiaz8/s28C85rFNZkzjnMvtapqFUwL 6+StVkBdqMUkou/50hzXAip6RhniYKNausC+mhXEaUKZ3Ic8yUP9QEzWgzrSxSUQSLXP Em82w15K4tuQrY9RcSO/ZADxQEalzp/5tvHadqGKus0a6LJVrCKPVQszfrLWjLL7qAng tomg== 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=zrPNaQxG7x4RPY6+kXspohieeDGUF3HHMQapFzkJ3o0=; b=nWLp4noBU1dgm7sKFOylrEP885iQ9/q3Pc7g9c5FvWU77stjOR2IzQbHrZwxMflkvi 66WiKB1/mj9m3zNov52iw35HNnM4eqKIq3/UMpy4vwJzJOZtTyiSCNMibrf8pA7izQFt AFYA5D6FvrnJQyKUgEQZUmqaInMxErJ2sgAvfJSCepoTAlz8rpYOyKW2NAfvpWgn/fv9 VDLfzjbtbzM6R/QvAYMNC1ldrNunqDx+PPNeE/sLFxFzal+fUOaFXpuXKt10hQYHX1rW qtIICQsdbiMs8YLVgEmYs7u1zLdYVSOuD+IjdGvvjkuwoTWc9+cSi221Pg/jmXACWIqD UcXA== X-Gm-Message-State: ANoB5pkCONviZTF/aBBTEpwpmNaAQx+AXp1+EI0DG/tFtC3iWMA983xF Fgp56Pa0XWTRdJGn5s18FZI= X-Google-Smtp-Source: AA0mqf6jB2HFnujFlzDkNVYHyhSMWbjIvsEJClr80iNzLE1zAjYG2oz2rr4hFWyEbLZpnyipQn0uJw== X-Received: by 2002:a05:6a00:4388:b0:56c:e37d:ec12 with SMTP id bt8-20020a056a00438800b0056ce37dec12mr24770778pfb.80.1668629424508; Wed, 16 Nov 2022 12:10:24 -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 w129-20020a628287000000b00561b455267fsm11275381pfd.27.2022.11.16.12.10.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Nov 2022 12:10:23 -0800 (PST) In-Reply-To: <87tu2y4qhq.fsf@thornhill.no> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=casouri@gmail.com; helo=mail-pg1-x52a.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:299986 Archived-At: > On Nov 16, 2022, at 12:02 PM, Theodor Thornhill = wrote: >=20 > Yuan Fu writes: >=20 >> I noticed that the new fontification is much busier than cc-mode, so = here=E2=80=99s some of my thoughts: >>=20 >=20 > Yeah, I just made it very colorful mostly to prove the point that we > have very granular control. I think Randys patch was very good, = because > imo _most_ of the noise is the bracket/pointer/operators etc. That seems to be a trend for tree-sitter fontification ;-) Neovim does = similar things. >>=20 >> :language mode >> :override t >> :feature 'expression >> '((assignment_expression >> left: (identifier) @font-lock-variable-name-face) >>=20 >> 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] >>=20 >=20 > Sure! >=20 >>=20 >> (call_expression >> function: (identifier) @font-lock-function-name-face) >>=20 >> (field_expression >> field: (field_identifier) @font-lock-variable-name-face) >>=20 >> (field_expression >> argument: (identifier) @font-lock-variable-name-face >> field: (field_identifier) @font-lock-variable-name-face) >>=20 >> (pointer_expression >> argument: (identifier) @font-lock-variable-name-face)) >>=20 >> 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. >=20 > Yep, I agree! Go ahead :-) I should clarify that I =E2=80=9CAnd I=E2=80=99ll disable them = personally=E2=80=9D meant =E2=80=9CI=E2=80=99ll disable them in my = personal config=E2=80=9D, but anyway. >=20 >>=20 >> :language mode >> :override t >> :feature 'statement >> '((expression_statement (identifier) @font-lock-variable-name-face) >> (labeled_statement >> label: (statement_identifier) @font-lock-type-face)) >>=20 >=20 > stuff like: > ``` > add_edge: // <- this thing > gx +=3D WINDOW_LEFT_EDGE_X (w); > gy +=3D WINDOW_TOP_EDGE_Y (w); >=20 > store_rect: // <- and this thing > STORE_NATIVE_RECT (*rect, gx, gy, width, height); >=20 > ``` >=20 > I think you should just tweak it like you want. I think it's very > time-consuming creating separate patches and bug-reports for small > tweaks and maintenance issues. I trust your judgment here, though I > also think that Randy had some nice ideas :) >=20 > Just hack away! Thanks! Will do. Yuan