From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#59897: 29.0.60; csharp-ts-mode: variable-name fontified as method when invoking method with generic type-argument. Date: Thu, 08 Dec 2022 11:12:54 +0100 Message-ID: <87zgby9pax.fsf@thornhill.no> References: <76edd79f-6da1-4c28-b20e-5eb4d9a819b2@app.fastmail.com> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29610"; mail-complaints-to="usenet@ciao.gmane.io" Cc: casouri@gmail.com, 59897@debbugs.gnu.org To: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 08 11:15:01 2022 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 1p3Dvg-0007Oc-JO for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 08 Dec 2022 11:15:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3Dup-0004xa-T9; Thu, 08 Dec 2022 05:14:07 -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 1p3Dun-0004w9-4t for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 05:14:05 -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 1p3Dum-0000oY-LR for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 05:14:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3Dum-0008Ft-HF for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 05:14:04 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Dec 2022 10:14:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59897 X-GNU-PR-Package: emacs Original-Received: via spool by 59897-submit@debbugs.gnu.org id=B59897.167049438331605 (code B ref 59897); Thu, 08 Dec 2022 10:14:04 +0000 Original-Received: (at 59897) by debbugs.gnu.org; 8 Dec 2022 10:13:03 +0000 Original-Received: from localhost ([127.0.0.1]:55790 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Dtm-0008Dh-Ip for submit@debbugs.gnu.org; Thu, 08 Dec 2022 05:13:02 -0500 Original-Received: from out-40.mta0.migadu.com ([91.218.175.40]:48238) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Dth-0008DG-0q for 59897@debbugs.gnu.org; Thu, 08 Dec 2022 05:13: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=1670494375; 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: in-reply-to:in-reply-to:references:references; bh=kEbOlDclbWvkUdYDC743lWfLbvpFPDkff8gRnxIwRWg=; b=QxT0rQl4lsP61kWDnctGnzVDC+F4dQCLYpzRMxk/gvxcOS0lWmb+XMjhoIGdmg0xrGMtPO qJ0LDbcaiHC0KQdeOq0ulNVERqzXwCLAtR9xtypBNXcm5AlSpTMEgUZsqY6oI2WH8UCnO0 oDV7Y/lIxZGDQs0lLL50oapHIWR4VJRjYH534ZBbNHRdadEqFu6x/XFdpMJ86cu+f9rsws tfXLHmMfZ7WvQk5wG7shOaqQZ8LWaSmln/EWfl22pwYV2KyvgsuD3Ay9ySo1CfkQ794SX5 ez4c28sNN6rMsWkOa1QRzuAo69L40nm7MnPiYaNv3Ap8AASaXsdmDAh/9fRt/g== In-Reply-To: <76edd79f-6da1-4c28-b20e-5eb4d9a819b2@app.fastmail.com> ("Jostein =?UTF-8?Q?Kj=C3=B8nigsen?="'s message of "Thu, 08 Dec 2022 10:29:15 +0100") X-Migadu-Flow: FLOW_OUT 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:250262 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Jostein Kj=C3=B8nigsen writes: > When I use the new csharp-ts-mode, method fontification is usually accura= te with only 1 exception which I have > encountered so far: > > When calling methods on objects, and that method accepts a generic type-a= rgument. You typically see this in > Startup.cs-like files in ASP.Net Core projects: > > services.AddSomeExtensionWithoutTypeArguments(); > services.AddSomeExtensionWithTypeArguments(); > > In the above cases we see that fontification of "services" differs. > > For the first line, services is fontified using font-lock-variable-name-f= ace (correct), but in the latter case services > is fontified using font-lock-function-name-face (incorrect). > > In both cases I expected services to be fontified using font-lock-variabl= e-name-face. > Can you test this patch, Jostein, and if you're happy, please install, Yuan :-) BTW, I think the ruleset is getting pretty gnarly in csharp-mode, so maybe we should consider slimming it down a little (without losing granularity) for perf reasons down the line! Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-expression-for-generic_name-in-csharp-ts-mode.patch >From 34fa2bc67ddffca65f219644f055f75a2b073aba Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Thu, 8 Dec 2022 11:08:28 +0100 Subject: [PATCH] Add expression for generic_name in csharp-ts-mode Given the below example, we want 'services' to be font-locked in 'font-lock-variable-name-face' in all cases. Previously this only worked in the first case, and the other was font-locked as 'font-lock-function-name-face'. namespace Foo { void Foo() { services.Add(); services.Add(); } } * lisp/progmodes/csharp-mode.el (csharp-ts-mode--font-lock-settings): Add new query that makes the mentioned example work. (bug#59897) --- lisp/progmodes/csharp-mode.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index 82e3bc0d54..bedf3f4342 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -784,6 +784,10 @@ csharp-ts-mode--font-lock-settings (invocation_expression (member_access_expression (generic_name (identifier) @font-lock-function-name-face))) + (invocation_expression + (member_access_expression + expression: (identifier) @font-lock-variable-name-face + name: (generic_name (type_argument_list (identifier))))) (invocation_expression (member_access_expression ((identifier) @font-lock-variable-name-face -- 2.34.1 --=-=-=--