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: Initial fontification in sh-mode with tree-sittter Date: Thu, 17 Nov 2022 11:11:48 -0800 Message-ID: <35F3D4B7-B4D0-4F51-B257-57D8288DDEEC@gmail.com> References: <6C8B0F8E-DF61-4BC3-B0D0-56DBB66BE637@gmail.com> <7AE71CCA-6F18-4DE6-8608-7D9B3E9E52FB@gmail.com> <9BA853EA-8B7F-41A0-A174-D86DF5CE7788@gmail.com> <83sfj3cfl0.fsf@gnu.org> <03309451-1AEB-458C-88FD-9715CECC27A2@gmail.com> <83mt9bc9ke.fsf@gnu.org> <8335b19ndr.fsf@gnu.org> <39ECD413-BD10-4BF3-90AC-36F02276607E@gmail.com> <8A2361BB-1081-4550-AC29-B9E99BFC2FB8@gmail.com> <42DBD4F5-71D9-434E-B7B4-4E0FF89F934F@gmail.com> 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="25200"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org To: =?utf-8?Q?Jo=C3=A3o_Paulo_Labegalini_de_Carvalho?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 17 20:12:33 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 1ovkJN-0006Ni-6s for ged-emacs-devel@m.gmane-mx.org; Thu, 17 Nov 2022 20:12:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovkIl-0002Gz-U9; Thu, 17 Nov 2022 14:11:55 -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 1ovkIk-0002Gp-Pa for emacs-devel@gnu.org; Thu, 17 Nov 2022 14:11:54 -0500 Original-Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovkIh-0000ys-TP; Thu, 17 Nov 2022 14:11:54 -0500 Original-Received: by mail-pj1-x1030.google.com with SMTP id u8-20020a17090a5e4800b002106dcdd4a0so6311715pji.1; Thu, 17 Nov 2022 11:11:51 -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=FPa3AzsmEi24McGbgmZr/h5+KpnxDRaqZa/o12S//EA=; b=lq15F66QStsEY8no+gtWorhA9dkoUg6Y58FXEH60VvfRmrdl9LqKY6gPxaIgnM2GC1 7NqTrR4m39R6Hm6lP+UDlpMfwPbn2JpQHiXjgbirDB5jvUwqAO5AAuuMlQoIf0ZRBHxi GiZLFxzmdRRRjQ8RpHiC1fsUTKJ1Sc9hPMcAj8pg78MQ3b6ydvpK/WlE1JW3snXJXTgh GGn7OxiWWvAdyWdZeehqkXCPvQnJ5BTao0i+YYXsUBmHZMbyMtyx/YsiygJjMIaDBZO5 Xo3waaGnbjNDnDfvsoTD6jAKsCIpDgKdGXL7kw60HS9aqLDnzLRMoYYMG6Uai7jDb9ma zayg== 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=FPa3AzsmEi24McGbgmZr/h5+KpnxDRaqZa/o12S//EA=; b=ZQRn5QV83iNT1aNQtBqMLh15jAqKzz2JBnx21CfI1XJisqgDf5WMsQJAhfI8wx/L/Q xoYPSIOb2whAEWtUsGo2NLgtgGyPLvHNXYBGXt9CFNnrioyM/t3Dx7l0gZsgrTVFDRja 3HllpETNZ9Xd0r+rZuHnoh+M/Tsws/HYpqOpWk2VNxHNksyfwNC3lHrUJnIHDLD/n2WG 0xEqGIfUQAllc2bgjZ4p2vOfmuhpZkMU3tTVuosGd9A5E6OrsiaFnsGDcr8y0xVfm4fz HBkdbJZlWM49TNcsqkmOICrx3lhKYSmXSr4QFDdCx+24XRj68Dxk0XyS7c9WkqL7Ben2 ySGw== X-Gm-Message-State: ANoB5pmSGNgAvljkuppx6+m2OSQ8rA/gI0uUVZmGmOIM6lDFdovx6Y8L 9e3yrebQotUFBWy8I/G44CM= X-Google-Smtp-Source: AA0mqf7bNB+gCwY94lSWPNX2i8+5eL7aYAUNIZcnkTdELqJw5f2T6GP7XOsUeF5hxbDvtzZsO3CK9g== X-Received: by 2002:a17:902:f78c:b0:186:8c13:50b3 with SMTP id q12-20020a170902f78c00b001868c1350b3mr3942940pln.153.1668712309803; Thu, 17 Nov 2022 11:11:49 -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 c85-20020a621c58000000b0056eaa577eb0sm1460990pfc.215.2022.11.17.11.11.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Nov 2022 11:11:49 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=casouri@gmail.com; helo=mail-pj1-x1030.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:300071 Archived-At: > On Nov 17, 2022, at 10:53 AM, Jo=C3=A3o Paulo Labegalini de Carvalho = wrote: >=20 > =20 > 1. I added commit message for your patch as an example. For future = patches it=E2=80=99s best if you can also have this ChangeLog style = commit message, I think you can find more detailed explanation in in = CONTRIBUTE file. >=20 > (I don=E2=80=99t know if you know the following already, bug FYI:) >=20 > 2. Docstring sentences always end with a period > 3. All comments and sentences should be complete sentences, with two = spaces at the end. > 4. The first line of a docstring shouldn=E2=80=99t exceeds 80 columns. >=20 > I did not. Thanks for the corrections and improvements. I will keep = those in mind for future patches.=20 >=20 > For the second commit, I changed all the feature names to singular, = and decl-commands to declaration-command. I also simplified the rule for = declaration-command, IIUC you want to highlight the command keywords? >=20 > The changes to singular make sense to me. I considered your simplified = version as well, but decided against alternation queries to avoid = hardcoded command names. Matching a node via its type rather than = comparing the spelling might be fast, but my code also had a string=3D = there, so in the end the simpler version works well. It should be safe to hardcode these command keywords, because they are = hardcoded in the grammar anyway (and I don=E2=80=99t see them used = elsewhere): declaration_command: $ =3D> prec.left(seq( choice('declare', 'typeset', 'export', 'readonly', 'local'), repeat(choice( $._literal, $._simple_variable_name, $.variable_assignment )) )), >=20 > Also, right now these command keywords are highlighted in builtin = face, should they be fontified in keyword face? I=E2=80=99m no expert of = bash so I can=E2=80=99t tell. But keyword face seems more natural to me. >=20 > You are correct in the sense that all declaration commands are builtin = commands. I decided to highlight them differently than other builtin = commands because they are used to define variables, and it might be = useful to be able to distinguish them visually. But this is not required = nor more correct than using the builtin face for both types of commands.=20= I meant to highlight them all in keyword face, but if you don=E2=80=99t = have objections I=E2=80=99ll make that change :-) Thanks! Yuan=