From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Wilhelm Kirschbaum Newsgroups: gmane.emacs.bugs Subject: bug#67246: 30.0.50; elixir-ts-mode uses faces inconsistently Date: Mon, 5 Feb 2024 19:34:16 +0200 Message-ID: <557bf51e-be4c-46c5-b2c5-8d06d28b7943@gmail.com> References: <87y1ewgnn7.fsf@gmail.com> <9ae8eb33-fd8b-f8d6-dd7f-79f8d4464a51@gutov.dev> <87a5r2p4pq.fsf@gmail.com> <87bkbfkr1h.fsf@gmail.com> <22ea1559-f44e-933d-e60a-9caa62b376a8@gutov.dev> <878r69vow6.fsf@gmail.com> <95509dbc-7c71-4996-84f5-d37976e2661f@gutov.dev> <0d483c86-7e70-433c-8cea-15ac9238983c@gutov.dev> <627331b9-5759-43b1-a319-712c11ead2f6@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26684"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Andrey Listopadov , 67246@debbugs.gnu.org To: Dmitry Gutov , Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 05 18:35:14 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 1rX2sC-0006e9-1t for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 05 Feb 2024 18:35:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rX2rt-0005pl-PA; Mon, 05 Feb 2024 12:34:53 -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 1rX2rr-0005kk-M4 for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2024 12:34:51 -0500 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 1rX2rp-0007eD-Dh for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2024 12:34:49 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rX2s2-0000Q1-02 for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2024 12:35:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Wilhelm Kirschbaum Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Feb 2024 17:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67246 X-GNU-PR-Package: emacs Original-Received: via spool by 67246-submit@debbugs.gnu.org id=B67246.17071544821576 (code B ref 67246); Mon, 05 Feb 2024 17:35:01 +0000 Original-Received: (at 67246) by debbugs.gnu.org; 5 Feb 2024 17:34:42 +0000 Original-Received: from localhost ([127.0.0.1]:52243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rX2ri-0000PM-CZ for submit@debbugs.gnu.org; Mon, 05 Feb 2024 12:34:42 -0500 Original-Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:48280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rX2rf-0000P4-EG for 67246@debbugs.gnu.org; Mon, 05 Feb 2024 12:34:41 -0500 Original-Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40fb3b5893eso38457395e9.0 for <67246@debbugs.gnu.org>; Mon, 05 Feb 2024 09:34:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707154461; x=1707759261; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Jt60fR+tHH6RTtrRDCIo8URdJzJkOElbzr4F/FcgUC4=; b=PEv4Xqoxux5KqR1rUFse8Jnlswe83j26D8F5tfrjTgcsLImNQOsOGg2Jl0SRoraxbu 2V8wn1O9vauyKuKSslZFHC9CZDs+C0vAW8n3h08pKE0HleqdaWgulSrX/NuxwG/ZyxFQ taODjZEjU6vEzwSkgpWEdO+TqIDA7Aicag0cHpUiid7lXx3M09NSt4xkCutMkTj1poRe IQhsUbRW4yMGcw3X+M6jN25M1exR8RO9GeiJmScIuVj7XJJPfVIUw11egvlNqT1C5wz9 BHP9NvAaIm77uNVyoU7fg+NG5+7TJfeZA2UgVQCFy8G54WTcPHA6Bzx/QaLF+lLqdnX8 qT9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707154461; x=1707759261; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Jt60fR+tHH6RTtrRDCIo8URdJzJkOElbzr4F/FcgUC4=; b=QHWu8bXwywKL0Eem4J6rOs/UZhgPMOS0/unItpVgKRREaip4Gd95rKBG8Me7PzW6QD WO/BFtZYeKIKqg0Sn7Ps7KjJrdxxLHAZvB17q+7lriNz1LLfKtx0Ym+732Uuez6xY6Xf Nr/JCd5MG2FjoOd1PFnTzSHwi8s8k/Mj/Xqbqs2Iuwb7v/PAdaMSdp/KKa6yLHacR9EB lkH+7yUeTJixeiGBJDSg6oIIg5CXG76ryPYyHU5fTgz33gy7EJwRsCAVyiIhfQoApruV 0HVIrMvYJczMERrHFc7IiyQFH2OHMQgkk4XyS8cTHgYyn73jtmY33A3pW/jODa+gemVe dl7g== X-Gm-Message-State: AOJu0YxtxSMUiFwaQOScK3/UlWpIDEAhD0DRgEslCRoT+f5vuLtxiKgO gt8PQZabDPRXZj54IcHBOnW0a6gcPtY8wnh0NYeer7TjQvbyWmpPzVGy0B9GsqfBdg== X-Google-Smtp-Source: AGHT+IElliLhhRj/cnpCavkpE3rHTfqgLfd/KvQ94zZ7KWk6eMia8IIaBP5tAJOVCrF747ND8xtWhQ== X-Received: by 2002:adf:e5cf:0:b0:33a:e51e:ddaf with SMTP id a15-20020adfe5cf000000b0033ae51eddafmr144112wrn.27.1707154460679; Mon, 05 Feb 2024 09:34:20 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWe0MvsAQlWodGNBuvlNXrJQLf680rg+Pa+anEVvKnvw5UgH3pAVDewdf5sAtzcDtI4xNgIbecJy4brXXlCemTtYJGnNYeTJR01eNjO0SNXUJAWIP5HZf69eRDZ+IU= Original-Received: from [192.168.88.31] ([102.135.241.76]) by smtp.gmail.com with ESMTPSA id l6-20020a5d6d86000000b0033ad47d7b86sm99616wrs.27.2024.02.05.09.34.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Feb 2024 09:34:20 -0800 (PST) Content-Language: en-US In-Reply-To: <627331b9-5759-43b1-a319-712c11ead2f6@gmail.com> 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:279459 Archived-At: On 2024/02/05 19:05, Wilhelm Kirschbaum wrote: > On 2024/01/30 03:59, Dmitry Gutov wrote: > >> On 29/01/2024 06:08, Dmitry Gutov wrote: >>> Hi! >>> >>> On 13/01/2024 10:50, Wilhelm Kirschbaum wrote: >>>> + (access_call target: (identifier) @font-lock-variable-name-face) >>>> + (access_call "[" key: (identifier) @font-lock-variable-name-face >>>> "]")) >>> >>> This should use font-lock-variable-use-face. And all other "variable >>> reference" highlights should use it too. >>> >>> OTOH, the method parameters are still highlighted with >>> font-lock-variable-use-face, which should be >>> font-lock-variable-name-face. >>> >>> This happens inside the first 'elixir-variable' highlight. Perhaps >>> elixir-ts--definition-keywords-re could be used there to >>> disambiguate as well. >> >> See this combined patch: >> >> 1. Your additions from the last attachment (access target highlighting). >> 2. All instances of font-lock-variable-name-face swapped for >> font-lock-variable-use-face (since most of those match variable >> references). > Thanks, this makes sense. >> 3. Added highlighting for method parameters with >> font-lock-variable-name-face. > I had a look and think it covers most instances ( some should arguably > not be highlighted as use-face, but can be debated ). >> 4. Feature elixir-function-name renamed to elixir-definition since it >> now touches both function and variable (parameter) definitions. > Makes sense >> 5. Feature elixir-variable moved to the feature level 4, since that's >> where it is in other built-in ts modes. >> > Agreed. >> Any objections to it? > Thanks for the effort and I have no objections. > > There are however some more issues I spotted on the function-name and > function-call matches which I will be looking into. Adding this as the first item to :feature 'elixir-definition fixes the function-call/name issue: @@ -360,13 +360,19 @@ elixir-ts--indent-rules  (defvar elixir-ts--font-lock-settings    (treesit-font-lock-rules     :language 'elixir -   :feature 'elixir-function-name +   :feature 'elixir-definition     `((call target: (identifier) @target-identifier +           (arguments +            (call target: (identifier) @font-lock-function-name-face +                  (arguments))) +           (:match ,elixir-ts--definition-keywords-re @target-identifier)) +     (call target: (identifier) @target-identifier             (arguments (identifier) @font-lock-function-name-face) I will be working in Elixir this week and will set different fonts for to test it during the week, but don't think it should hold up installing the suggested patch so long.