From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill Newsgroups: gmane.emacs.devel Subject: Re: Tree sitter support for C-like languages Date: Wed, 16 Nov 2022 21:02:41 +0100 Message-ID: <87tu2y4qhq.fsf@thornhill.no> References: <87tu36em9t.fsf@thornhill.no> <33EE9B30-C6EC-48D1-BEAF-ABAA1350C870@gmail.com> Mime-Version: 1.0 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="1555"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 16 21:03:27 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 1ovOd2-00006p-Kp for ged-emacs-devel@m.gmane-mx.org; Wed, 16 Nov 2022 21:03:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovOch-0001iI-G8; Wed, 16 Nov 2022 15:03:03 -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 1ovOcf-0001hx-Ep for emacs-devel@gnu.org; Wed, 16 Nov 2022 15:03:01 -0500 Original-Received: from out2.migadu.com ([2001:41d0:2:aacc::]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovOcX-0003YC-LG for emacs-devel@gnu.org; Wed, 16 Nov 2022 15:03:01 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1668628970; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SiAx8oYslUOdjxYKHNJb+YWdWYtzTVDd5fjAigPFhBM=; b=CsBD/GuDgUV8S4CT1A2GJ34moaky9lMt7f8lf0yCwAbjCOGQ/pqUFvTEA+lljZKBV7I6nn Rm7UMS8LXoRl/6AUo/Dq87qUNfEMJ/gu6lBQjyA5Arj0JzIyMUiLNUyGrsVGw21veUlqZj AXyRese0v8FwUOOgvh6vRtnO5/p8U9nueUhYxwjRFvexG0XMwh6NupJDct/NK8YFPoJZDE zJ6hBeZC8g3QlqyV+mzjX26Dk7GAkabAv1MbH5Uqf0InfuM3NlHe/C0ETyTaIbXBwF5oCw LNGedk+CH/zwpOb2+ndwPRxGzadj5Z8Hi/LFeFsDJI9QCd/ZOOPVy88a9srIPQ== In-Reply-To: <33EE9B30-C6EC-48D1-BEAF-ABAA1350C870@gmail.com> X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:2:aacc::; envelope-from=theo@thornhill.no; helo=out2.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-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:299984 Archived-At: Yuan Fu writes: > I noticed that the new fontification is much busier than cc-mode, so here= =E2=80=99s some of my thoughts: > 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. > > :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] > Sure! > > (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 b= e level 3. (And I=E2=80=99ll disable them personally :-) Highlighting the f= ield and the functions should be two different features IMO. Yep, I agree! Go ahead :-) > > :language mode > :override t > :feature 'statement > '((expression_statement (identifier) @font-lock-variable-name-face) > (labeled_statement > label: (statement_identifier) @font-lock-type-face)) > stuff like: ``` add_edge: // <- this thing gx +=3D WINDOW_LEFT_EDGE_X (w); gy +=3D WINDOW_TOP_EDGE_Y (w); store_rect: // <- and this thing STORE_NATIVE_RECT (*rect, gx, gy, width, height); ``` 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 :) Just hack away!