From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#61302: 29.0.60; rust-ts-mode does not show function-invocation on field-properties Date: Sun, 5 Feb 2023 23:44:16 +0200 Message-ID: <457ce1b7-db2f-0956-bfd1-77b1163ff8a1@yandex.ru> References: <6209c097-0369-828a-7513-d8afb73fd7f0@secure.kjonigsen.net> 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="2804"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 To: jostein@kjonigsen.net, 61302-done@debbugs.gnu.org, dev@rjt.dev Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 05 22:45:23 2023 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 1pOmp9-0000cA-4y for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Feb 2023 22:45:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOmoy-0006Qr-At; Sun, 05 Feb 2023 16:45:12 -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 1pOmop-0006Pz-BA for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 16:45:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOmop-0007Fd-1Q for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 16:45:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pOmoo-0000tJ-I5 for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 16:45:02 -0500 Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Feb 2023 21:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 61302 X-GNU-PR-Package: emacs Mail-Followup-To: 61302@debbugs.gnu.org, dgutov@yandex.ru, jostein@kjonigsen.net Original-Received: via spool by 61302-done@debbugs.gnu.org id=D61302.16756334663356 (code D ref 61302); Sun, 05 Feb 2023 21:45:02 +0000 Original-Received: (at 61302-done) by debbugs.gnu.org; 5 Feb 2023 21:44:26 +0000 Original-Received: from localhost ([127.0.0.1]:46617 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOmoE-0000s4-Fx for submit@debbugs.gnu.org; Sun, 05 Feb 2023 16:44:26 -0500 Original-Received: from mail-ej1-f47.google.com ([209.85.218.47]:46832) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOmoC-0000rr-O3 for 61302-done@debbugs.gnu.org; Sun, 05 Feb 2023 16:44:25 -0500 Original-Received: by mail-ej1-f47.google.com with SMTP id p26so29119271ejx.13 for <61302-done@debbugs.gnu.org>; Sun, 05 Feb 2023 13:44:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=IzprTomfvNj2wdrLZzQxGCz36sYB5SkeKdMM/ck7ztA=; b=JqPyigDH0fRkCD8jI3eVSmyCVyWKsJZCzXEKBBdAS9yqYJfEVqFBTvnAuCcBcS26ug nLoVa4wHnqAWp0t9QeE5oDXqgkweaQdXINjAt1kTbQw2wITsck7poLTtDLJFRm2xmoTf ePkd9YyYBma7RMvqX8R5j8MZoJpogqGYrX0QeeKfSz3UC5FfAjqqpT1xeQD90bbmGv8v rl5wqcC9STnwLLOWtGkNaQZwGOX1yosYXRa9Rf7CnZJJhPKBUf7/RwBi2zI02IiuhHyq BMaUnK3xpMwC7gM6SkWxZ4LefcVojCnm00DmdP35c5Y1juU2i+H9VYNFZO6guSCnQevh ruJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IzprTomfvNj2wdrLZzQxGCz36sYB5SkeKdMM/ck7ztA=; b=UlPGB5PRs1dLVtweTuUJi+UIIMWbKJU02WmrCqPvE6Cu3cZUvG8SgU8DTdI5OU/WbQ hh5EFL9fpW23uU1PdFFMXFh1dYiAiR9dPoSjfwQfAPWoM7/pRT4i/9whe4cpCpH5WQcG HLjVoQbs2833IThDZkUv3F60wmD3Fh958rg5SbcocIlWllsDxhd1EDytX9xNpXrt2wWl mT2rIyS0ej1dPZRKo4kBcQId9nc5WtHjZQLYoHExXBWIO7q8dHdyjQHX8Xie+lLHZ/ko 7Rl51hfWBmBlWyyItxXGPPPocvLNydseHQ5pgWuXplq6wOvJg0XK5jt4f/RYyE27NlDH e8Kg== X-Gm-Message-State: AO0yUKWZFaOWnhWa+8c4LHtq7Z6HKzZErZcYR3x1lqXAIRON3hETZWr7 nTSpzT7H7557544uLowk7jY= X-Google-Smtp-Source: AK7set8vyNH2dBorVGY8RvGmvAsbgnDcElRwT8IaW0OTPpX+ZRemkDMV2NAR49oGG97eFot2gD1S5A== X-Received: by 2002:a17:906:e088:b0:889:5861:ad1e with SMTP id gh8-20020a170906e08800b008895861ad1emr21314442ejb.72.1675633458773; Sun, 05 Feb 2023 13:44:18 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id er18-20020a056402449200b0046892e493dcsm4256575edb.26.2023.02.05.13.44.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 Feb 2023 13:44:18 -0800 (PST) Content-Language: en-US In-Reply-To: <6209c097-0369-828a-7513-d8afb73fd7f0@secure.kjonigsen.net> 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:254897 Archived-At: Hi! On 05/02/2023 22:15, Jostein Kjønigsen wrote: > Steps to reproduce: > > - set font-lock level 4 to enable highlighting of function-invocations > - create a new buffer and activate rust-ts-mode > > Try writing a function which invokes functions indirectly trough > field-properties. Example below: > > pub fn should_handle(url: String) -> bool { >     if url.ends_with(".css") >        || url.ends_with(".js") >        || url.ends_with(".png") >        || url.ends_with(".jpg") >     { >         false >     } else { >         true >     } > } > > Observe that: > > - ends_with() is fontified as a property-access, not as a > function-invocation. > - (plain function invocation is highlighted as expected though) > > From my preliminary inspection of the rust-ts-mode source-code, this > seems to be because of a very general override later in the file: > > rust-ts-mode.el, line 248 or so: > >    :language 'rust >    :feature 'property >    :override t >    '((field_identifier) @font-lock-property-face >      (shorthand_field_initializer (identifier) @font-lock-property-face)) > > Dissabling "override" for this feature fixes the fontification of method > invocations, but I haven't done enough testing to see if there are other > unexpected side-effects. Thanks for the report. I've installed the patch below, commit a529b0d6463. Note that I wouldn't recommend using the level 4 straight away, because of the 'variable' feature that's not very precise. It's probably better to use level 3 and add the extra features you need using treesit-font-lock-recompute-features, or use level 4 and drop 'variable'. But that's my opinion. diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index 18b42b9eced..5c71a8ad461 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -234,6 +234,11 @@ rust-ts-mode--font-lock-settings (use_as_clause alias: (identifier) @font-lock-type-face) (use_list (identifier) @font-lock-type-face)) + :language 'rust + :feature 'property + '((field_identifier) @font-lock-property-face + (shorthand_field_initializer (identifier) @font-lock-property-face)) + :language 'rust :feature 'variable '((identifier) @font-lock-variable-name-face @@ -245,12 +250,6 @@ rust-ts-mode--font-lock-settings :override t '((escape_sequence) @font-lock-escape-face) - :language 'rust - :feature 'property - :override t - '((field_identifier) @font-lock-property-face - (shorthand_field_initializer (identifier) @font-lock-property-face)) - :language 'rust :feature 'error :override t