From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= 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: Fri, 9 Dec 2022 21:57:28 +0100 Message-ID: <44bc94b1-1c68-f1ff-fc50-bb289fdae2f2@secure.kjonigsen.net> References: <76edd79f-6da1-4c28-b20e-5eb4d9a819b2@app.fastmail.com> <87zgby9pax.fsf@thornhill.no> <8fdc4d5d-17ac-3a06-d602-637df9fe1be1@secure.kjonigsen.net> <87r0xa9mjy.fsf@thornhill.no> <667add54-91b3-f820-3163-0f33d9d97056@secure.kjonigsen.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------21pIo1aFI6Misno7QBqMH0kY" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2333"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Cc: Theodor Thornhill , 59897@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 09 21:58:22 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 1p3kRm-0000Ko-Ud for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 09 Dec 2022 21:58:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3kRZ-0006ww-2g; Fri, 09 Dec 2022 15:58:05 -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 1p3kRW-0006wO-Rx for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 15:58: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 1p3kRW-000587-Jj for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 15:58:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3kRW-0005YE-Ai for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 15:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Dec 2022 20:58:02 +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.167061946521332 (code B ref 59897); Fri, 09 Dec 2022 20:58:02 +0000 Original-Received: (at 59897) by debbugs.gnu.org; 9 Dec 2022 20:57:45 +0000 Original-Received: from localhost ([127.0.0.1]:38458 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3kRE-0005Y0-Ep for submit@debbugs.gnu.org; Fri, 09 Dec 2022 15:57:45 -0500 Original-Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:38815) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3kRC-0005Xt-21 for 59897@debbugs.gnu.org; Fri, 09 Dec 2022 15:57:42 -0500 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id B14433200684; Fri, 9 Dec 2022 15:57:31 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 09 Dec 2022 15:57:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= secure.kjonigsen.net; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1670619451; x= 1670705851; bh=59ccak+4zBQ2yS3aWs+JkLywLsapFg/WrooBtsV4hfU=; b=Y Pq+r84Fy9q95vu4oZR7Nd8JBZeqiDqSTdvqbMc0JV6SszZHfn2RuHtZ7/xJgSK2y N8WlzZuVr1f9z52E+YjA/osoGcIgLqYLu90c6GHivSBTuamgQQO8+gscedj+r5xT A0PafmurQD7lg+/oJ0mRhr+yIQd+cayybOiKf1/ZKcX3u0a4lLfyY4GPhdDW30XP S+QheVgqqYQHseHCrSSfDiRUhy/YJYYiud6Ml+kSUWkVX3M4pGGxNcNS/M07P471 J/wGSCufcT+pcBMOsc906Nk4a/Pu2gQaF1CkH4Q5z7uXzkYAwGcNsuRCS6ySqTPS 5BbOvggNTiuxavrY62EiA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1670619451; x=1670705851; bh=59ccak+4zBQ2yS3aWs+JkLywLsap Fg/WrooBtsV4hfU=; b=h0k9/xyqt6YtYKYI32ipt60qYW+FsO4y1+caOxLOIjTD gHY/XiR59O6bxzJuTaV1plLve+0mgHe1+CjOXuTl6NC2YWpR45vJypaQZmC5lia0 5Us0k7118teiZ73rQzXBf84iMgeK5NmLXDh4lUx0CWpPZE9Ggk4MPLWH3vlgaE+Y PCBE6bx4nZowOJq/ZPtN0ZSrIZoAqqeVC5Yeu8/z7ItZkp6AEYZRuDh68V6UfgLZ C0BXfF5MjwE0rq2DvIY4wy0C/W3dQojt/CELK2mjsPoSN52js4eDTjCDbvtDN4Kq lydimhNVgDv+LOMvfNxfW6J7QqWsJB1Mb1WhxZcjYg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddvgddugeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurheptgfkffggfgfuhffvvehfjgesrgdtreertdefjeenucfhrhhomheplfhoshht vghinhcumfhjpphnihhgshgvnhcuoehjohhsthgvihhnsehsvggtuhhrvgdrkhhjohhnih hgshgvnhdrnhgvtheqnecuggftrfgrthhtvghrnhepvdeijeegkefhjefgveehleekjedu uefhgfdvteeiieeifeetledtudevkefhfeeknecuffhomhgrihhnpegrshhprdhnvghtne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhoshht vghinhesshgvtghurhgvrdhkjhhonhhighhsvghnrdhnvght X-ME-Proxy: Feedback-ID: ib2f84088:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 9 Dec 2022 15:57:30 -0500 (EST) Content-Language: nb-NO In-Reply-To: <667add54-91b3-f820-3163-0f33d9d97056@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:250458 Archived-At: This is a multi-part message in MIME format. --------------21pIo1aFI6Misno7QBqMH0kY Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 08.12.2022 12:31, Jostein Kjønigsen wrote: > On 08.12.2022 12:12, Theodor Thornhill wrote: >> Jostein Kjønigsen writes: >> >>> On 08.12.2022 11:12, Theodor Thornhill wrote: >>>> Jostein Kjønigsen writes: >>>> >>>>> When I use the new csharp-ts-mode, method fontification is usually accurate with only 1 exception which I have >>>>> encountered so far: >>>>> >>>>> When calling methods on objects, and that method accepts a generic type-argument. 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-face (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-variable-name-face. >>>>> >>>> Can you test this patch, Jostein, and if you're happy, please install, >>>> Yuan :-) >>> I beat you by 3 minutes, but I'll be a gentleman and test none the less :D >>> >>> You test mine, and we can see which one we prefer? >> Sure! Both seems to work from what I can tell :-) I'll let you be the >> judge! >> >> Theo > > Your patch solves the issue described in the bug, but does not handle > another fontification error I discovered while testing my patch: > > SimpleGenericMethod(params); > > In the above example SimpleGenericMethod is fontified using > font-lock-type-face instead of font-lock-function-name-face. My patch > fixes that case as well. > > As for which patch to choose: > > * From an objective perspective, the way I understand the code, your > patch overrides an existing fontification to apply variable-name > instead. > * My patch however changes some selectors to be more specific > selectors to avoid fontifying the variable-identifier, and also > creates a new, highly-specific selector to fontify the > variable-name aspect as well. > > From a performance perspective, I would assume the latter approach is > more performant, but I don't know enough tree-sitter internals to say > that with 100% confidence. > > Does anyone else know? > > -- > Jostein > Hey guys. This patch seems to have been left out, or slightly forgotten. Yuan, I think in this case we are going to prefer my patch over Theo's since it fixes 2 issues, instead of just 1. Could you install this? :) -- Jostein --------------21pIo1aFI6Misno7QBqMH0kY Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit On 08.12.2022 12:31, Jostein Kjønigsen wrote:
On 08.12.2022 12:12, Theodor Thornhill wrote:
Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:

On 08.12.2022 11:12, Theodor Thornhill wrote:
Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:

When I use the new csharp-ts-mode, method fontification is usually accurate with only 1 exception which I have
encountered so far:

When calling methods on objects, and that method accepts a generic type-argument. You typically see this in
Startup.cs-like files in ASP.Net Core projects:

services.AddSomeExtensionWithoutTypeArguments();
services.AddSomeExtensionWithTypeArguments<MyType>();

In the above cases we see that fontification of "services" differs.

For the first line, services is fontified using font-lock-variable-name-face (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-variable-name-face.

Can you test this patch, Jostein, and if you're happy, please install,
Yuan :-)
I beat you by 3 minutes, but I'll be a gentleman and test none the less :D

You test mine, and we can see which one we prefer?
Sure!  Both seems to work from what I can tell :-)  I'll let you be the
judge!

Theo

Your patch solves the issue described in the bug, but does not handle another fontification error I discovered while testing my patch:

SimpleGenericMethod<Type>(params);

In the above example SimpleGenericMethod is fontified using font-lock-type-face instead of font-lock-function-name-face. My patch fixes that case as well.

As for which patch to choose:

  • From an objective perspective, the way I understand the code, your patch overrides an existing fontification to apply variable-name instead.
  • My patch however changes some selectors to be more specific selectors to avoid fontifying the variable-identifier, and also creates a new, highly-specific selector to fontify the variable-name aspect as well.

From a performance perspective, I would assume the latter approach is more performant, but I don't know enough tree-sitter internals to say that with 100% confidence.

Does anyone else know?

--
Jostein

Hey guys.

This patch seems to have been left out, or slightly forgotten.

Yuan, I think in this case we are going to prefer my patch over Theo's since it fixes 2 issues, instead of just 1.

Could you install this? :)

--
Jostein

--------------21pIo1aFI6Misno7QBqMH0kY--