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.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 13:05:04 -0800 Message-ID: <3703C4B6-0BCF-4EFB-A996-F1B0D6896DD6@gmail.com> References: <76edd79f-6da1-4c28-b20e-5eb4d9a819b2@app.fastmail.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="1572"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jostein@kjonigsen.net, Theodor Thornhill , 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 Fri Dec 09 22:06:17 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 1p3kZV-000092-Lb for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 09 Dec 2022 22:06:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3kZJ-0001Yn-3U; Fri, 09 Dec 2022 16:06: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 1p3kZH-0001Uv-3O for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 16:06: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 1p3kZG-00079Z-RE for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 16:06:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3kZG-0005eu-FY for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 16:06:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <76edd79f-6da1-4c28-b20e-5eb4d9a819b2@app.fastmail.com> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Dec 2022 21:06: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.167061991621734 (code B ref 59897); Fri, 09 Dec 2022 21:06:02 +0000 Original-Received: (at 59897) by debbugs.gnu.org; 9 Dec 2022 21:05:16 +0000 Original-Received: from localhost ([127.0.0.1]:38500 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3kYW-0005eU-CW for submit@debbugs.gnu.org; Fri, 09 Dec 2022 16:05:16 -0500 Original-Received: from mail-pl1-f181.google.com ([209.85.214.181]:35711) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3kYT-0005eK-DX for 59897@debbugs.gnu.org; Fri, 09 Dec 2022 16:05:14 -0500 Original-Received: by mail-pl1-f181.google.com with SMTP id t2so3159030ply.2 for <59897@debbugs.gnu.org>; Fri, 09 Dec 2022 13:05:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=kpsGkXqv/dZF8CxIlfe65xwei9Y+AKPxcbNE0cy9mCA=; b=SDtJGA7q+W0tt1966ko8tYeiKh/bbiNGf/0vMSbSfu0U5LguFwilABosdtMo1pB83K U0qVfaoGgYv2v34snyaqcTxnngnJ0go1Y9af9rQQZk82ySwPpGvNyhCZsGwotloYSrmb 8hz/VsbfXLdMxau58UU/EhlHt9JMhEcGGbXSqmLjK1Ta2+d5pJ9NDemypBmSnJ6IyESc Gs2HjyZIz+N2MrAr81fdCk0tqj2AW+Y3WU9+dvI8Y9cctu4rVgxUwrTFtOYHcpLhj9/H Jj4hTQwtngDGGOLwYssKDAPNssayiNFAZ/QlJM2pK8vka9DEykRTq5k0iU36ltbJFlpW sYdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kpsGkXqv/dZF8CxIlfe65xwei9Y+AKPxcbNE0cy9mCA=; b=je0SpCuSw+cMRNE9ejxkrH9Hh+ObX3uTYBCliTyM5BtG5sdvTbl44/uqUK+gkwWwgi tt3bJ8GJcL64QTDR87GW6MaaVuGwfZYoyGCGh64cPny7j9eOnARIAGOneKmtaTJuiqJf eUVClTaLK/tE59K9GWetXubhCBhZjDkAggcuyWOkakOS9lXYtpjnEmWb+shfAoCWTzS0 pC0Kj11rpW7PW1GReUXg9PsmA3zogvfhR6OqhlwpaoFMLJc6FUU/zl39Bl0UMJ5ru93o DRF0Ss0TyFACIEd0gnxhHrVf0k1scCuGCG+b3B8gaS2/SpObE5aBls08Y0I1X98UDSYy +toA== X-Gm-Message-State: ANoB5plODGe0rfeUfiiMKEPBQU9akuF/z23xdz6sAw+kpMBbewpKsc7f 6ZFWahwH+xQgRFtBEKS7jq4= X-Google-Smtp-Source: AA0mqf6Z4yBAvHa6TL12CmKrCgQV11JvA4G1Md3bAQf8Ls7K8deHMRMod86RwT4fsSo8dquLmbhevg== X-Received: by 2002:a05:6a20:441d:b0:a9:af6a:c9ef with SMTP id ce29-20020a056a20441d00b000a9af6ac9efmr13116873pzb.33.1670619907530; Fri, 09 Dec 2022 13:05:07 -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 i134-20020a62878c000000b005761c4754e7sm1672282pfe.144.2022.12.09.13.05.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Dec 2022 13:05:06 -0800 (PST) X-Mailer: Apple Mail (2.3696.120.41.1.1) 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:250460 Archived-At: Jostein Kj=C3=B8nigsen writes: > On 08.12.2022 11:12, Theodor Thornhill wrote: >> Jostein Kj=C3=B8nigsen 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? >> 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 > > It's getting somewhat intricate, agreed. It's IMO not entirely obvious > what the different rules are for or what cases they are meant to > support. We had a discussion on emacs-devel that aims to standardize and define feature names, here is the list so far: Basic tokens: delimiter ,.; (delimit things) operator =3D=3D !=3D || (produces a value) bracket []{}() misc-punctuation constant true, false, null number keyword comment (includes doc-comments) string (includes chars and docstrings) string-interpolation f"text {variable}" escape-sequence "\n\t\\" function every function identifier variable every variable identifier type every type identifier property a.b <--- highlight b key { a: b, c: d } <--- highlight a, c error highlight parse error Abstract features: assignment: the LHS of an assignment (thing being assigned to), eg: a =3D b <--- highlight a a.b =3D c <--- highlight b a[1] =3D d <--- highlight a definition: the thing being defined, eg: int a(int b) { <--- highlight a return 0 } int a; <-- highlight a struct a { <--- highlight a int b; <--- highlight b } > > In that regard, I miss our old test-suite from github's csharp-mode. > It was a nice safety-net when making changes like this. A test suite is most welcome. I think we can even come up with a general framework for testing fontification, indent, defun movement, imenu, etc. To generate a test you would just need to open a file, verify everything is expected, and run a command which records the current fontification and indentation, etc, to a file. Then a test suite will just use that file. I wonder if csharp-mode had something like this? Yuan