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#60376: 29.0.60; Standardize csharp-ts-mode's font-lock features Date: Fri, 30 Dec 2022 20:30:43 +0100 Message-ID: <87r0wgpu3g.fsf@thornhill.no> References: <83v8ls6gvb.fsf@gnu.org> <07332CE6-C6A9-469A-9C41-B47841D8798D@secure.kjonigsen.net> 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="1914"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60376@debbugs.gnu.org, casouri@gmail.com To: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 30 20:31:34 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 1pBL6M-0000Lq-GJ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Dec 2022 20:31:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pBL5v-0007vd-HG; Fri, 30 Dec 2022 14:31: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 1pBL5s-0007vJ-3R for bug-gnu-emacs@gnu.org; Fri, 30 Dec 2022 14:31: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 1pBL5q-00022g-AD for bug-gnu-emacs@gnu.org; Fri, 30 Dec 2022 14:31:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pBL5p-0000Rs-PD for bug-gnu-emacs@gnu.org; Fri, 30 Dec 2022 14:31:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Dec 2022 19:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60376 X-GNU-PR-Package: emacs Original-Received: via spool by 60376-submit@debbugs.gnu.org id=B60376.16724286501704 (code B ref 60376); Fri, 30 Dec 2022 19:31:01 +0000 Original-Received: (at 60376) by debbugs.gnu.org; 30 Dec 2022 19:30:50 +0000 Original-Received: from localhost ([127.0.0.1]:36124 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBL5d-0000RP-JD for submit@debbugs.gnu.org; Fri, 30 Dec 2022 14:30:50 -0500 Original-Received: from out-65.mta0.migadu.com ([91.218.175.65]:53978) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBL5a-0000RG-OI for 60376@debbugs.gnu.org; Fri, 30 Dec 2022 14:30:48 -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=1672428645; 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=TFS3WOsx+qnb6BFVdSJNGfAgr9eFkSoH6Z4zcAVFVOk=; b=fmDIohNfoEfdC8pb4DRVG6KAAeQHOSkGzmZ96A8mJsGnIAUvs/kLUTVekhQgcwcL9CldtX WF+5Cjahd1XlvUo6ZZaY6kDtJxbguCnoJ+WYRouBKKrR3nq4mpLcIyER2r3J43aeCX9b5y W+WPxeqEuX1PbOec5C9KEXej/zuwktsAiq5r73/YgZKA4CNY2UDMzWZyla4VtlMqxwGq4I SsWf55mkABfszNHBFgkMw5Z1B9rz+XFsLIRwJbguCjACCbAql5BEfEGiYOv4gYMyYhtqMn VUQknQqRlmSm2ioZH+Ufd9h248tSdOIOdqvyA8tb7lvDEumOKg63T2XFYyHqQQ== In-Reply-To: <07332CE6-C6A9-469A-9C41-B47841D8798D@secure.kjonigsen.net> 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:252151 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Jostein Kj=C3=B8nigsen writes: >> On 30 Dec 2022, at 16:46, Eli Zaretskii wrote: >>=20 >> =EF=BB=BF >>>=20 >>> Date: Fri, 30 Dec 2022 15:39:20 +0100 >>> Cc: casouri@gmail.com, 60376@debbugs.gnu.org, theo@thornhill.no >>> From: Jostein Kj=C3=B8nigsen >>>=20 >>> To be clear: I think csharp-ts-mode works well beyond 85% (it's what I= =20 >>> use as my daily driver), but the syntax-highlighting at level 3 may be= =20 >>> more excessive than some people (like Stefan) prefer. >>>=20 >>> If we instead for these "major" changes suggested by Yuan, instead aim= =20 >>> for just moving some "smaller" implementation-detail=20 >>> (function-invocations and property-highlighting) to level 4, I think we= =20 >>> she be able to get something which is mostly what Stefan would expect=20 >>> and prefer, and it would be a much smaller change. >>>=20 >>> Then we can take a look at those bigger changes (standardized features,= =20 >>> enabling/disabling them individually, as end-users, etc) for Emacs-30. >>>=20 >>> I think that's a more realistic plan. Does that sound OK? >>=20 >> Yes, it does. And I urge you to submit patches to that effect. >>=20 >> Thanks. > > Theo has offered to come up with some patches and I=E2=80=99ll do my best= to battle-test them.=20 > > Hopefully we can get this done quickly enough to suit your taste ;) > Let's start here! If you're satisfied, Jostein, report back, then you install, Yuan? Then rinse repeat :-) Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Tweak-csharp-mode-font-lock-settings.patch >From 36ba718d0f4c528b7518da33d9c4e591f578ab10 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Fri, 30 Dec 2022 20:26:09 +0100 Subject: [PATCH] Tweak csharp-mode font-lock-settings * lisp/progmodes/csharp-mode.el (csharp-ts-mode--font-lock-settings): Rearrange features. (csharp-ts-mode): Rearrange features. --- lisp/progmodes/csharp-mode.el | 53 +++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index 66e4a65184..bd0e023db1 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -692,25 +692,47 @@ csharp-ts-mode--keywords (defvar csharp-ts-mode--font-lock-settings (treesit-font-lock-rules + :language 'c-sharp + :feature 'expression + '((conditional_expression (identifier) @font-lock-variable-name-face) + (postfix_unary_expression (identifier)* @font-lock-variable-name-face) + (assignment_expression (identifier) @font-lock-variable-name-face)) + + :language 'c-sharp + :feature 'bracket + '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face) + + :language 'c-sharp + :feature 'delimiter + '((["," ":" ";"]) @font-lock-delimiter-face) + + :language 'c-sharp + :feature 'error + '((ERROR) @font-lock-warning-face) + :language 'c-sharp :override t :feature 'comment - '((comment) @font-lock-comment-face) + '((comment) @font-lock-comment-face) + :language 'c-sharp :override t :feature 'keyword `([,@csharp-ts-mode--keywords] @font-lock-keyword-face (modifier) @font-lock-keyword-face (this_expression) @font-lock-keyword-face) + :language 'c-sharp :override t - :feature 'attribute + :feature 'property `((attribute (identifier) @font-lock-property-face (attribute_argument_list)) (attribute (identifier) @font-lock-property-face)) + :language 'c-sharp :override t :feature 'escape-sequence '((escape_sequence) @font-lock-escape-face) + :language 'c-sharp :override t :feature 'literal @@ -718,6 +740,7 @@ csharp-ts-mode--font-lock-settings (real_literal) @font-lock-number-face (null_literal) @font-lock-constant-face (boolean_literal) @font-lock-constant-face) + :language 'c-sharp :override t :feature 'string @@ -730,6 +753,7 @@ csharp-ts-mode--font-lock-settings "$\"" "@$\"" "$@\""] @font-lock-string-face) + :language 'c-sharp :override t :feature 'type @@ -750,14 +774,14 @@ csharp-ts-mode--font-lock-settings target: (identifier) @font-lock-type-face) (type_of_expression (identifier) @font-lock-type-face) (object_creation_expression (identifier) @font-lock-type-face)) + :language 'c-sharp :feature 'definition :override t '((qualified_name (identifier) @font-lock-type-face) (using_directive (identifier) @font-lock-type-face) (using_directive (name_equals - (identifier) @font-lock-type-face - ["="] @default-face)) + (identifier) @font-lock-type-face)) (enum_declaration (identifier) @font-lock-type-face) (enum_member_declaration (identifier) @font-lock-variable-name-face) @@ -820,24 +844,11 @@ csharp-ts-mode--font-lock-settings (binary_expression (identifier) @font-lock-variable-name-face) (argument (identifier) @font-lock-variable-name-face)) - :language 'c-sharp - :feature 'expression - '((conditional_expression (identifier) @font-lock-variable-name-face) - (postfix_unary_expression (identifier)* @font-lock-variable-name-face) - (assignment_expression (identifier) @font-lock-variable-name-face)) - :language 'c-sharp - :feature 'bracket - '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face) - - :language 'c-sharp - :feature 'delimiter - '((["," ":" ";"]) @font-lock-delimiter-face) :language 'c-sharp :feature 'escape-sequence :override t - '((escape_sequence) @font-lock-escape-face - (ERROR) @font-lock-warning-face))) + '((escape_sequence) @font-lock-escape-face))) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode)) @@ -903,9 +914,9 @@ csharp-ts-mode (setq-local treesit-font-lock-settings csharp-ts-mode--font-lock-settings) (setq-local treesit-font-lock-feature-list '(( comment definition) - ( keyword string escape-sequence type) - ( attribute constant expression literal) - ( bracket delimiter))) + ( keyword string type) + ( constant escape-sequence expression literal property) + ( bracket delimiter error))) ;; Imenu. (setq-local treesit-simple-imenu-settings -- 2.34.1 --=-=-=--