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#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified Date: Mon, 05 Dec 2022 09:51:55 +0100 Message-ID: <87v8mqxmfo.fsf@thornhill.no> References: <676d4e95-dfe3-5ced-60a3-b2387512ee63@secure.kjonigsen.net> Reply-To: Theodor Thornhill Mime-Version: 1.0 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="27421"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jostein@kjonigsen.net, casuri@gmail.com To: 59831@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 05 09:53:14 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 1p27Du-00070O-6y for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 05 Dec 2022 09:53:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p27Dm-0007PG-8M; Mon, 05 Dec 2022 03:53:06 -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 1p27Dj-0007Md-AQ for bug-gnu-emacs@gnu.org; Mon, 05 Dec 2022 03:53: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 1p27Di-0000e2-MT for bug-gnu-emacs@gnu.org; Mon, 05 Dec 2022 03:53:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p27Di-0001mQ-5T for bug-gnu-emacs@gnu.org; Mon, 05 Dec 2022 03:53:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Dec 2022 08:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59831 X-GNU-PR-Package: emacs Original-Received: via spool by 59831-submit@debbugs.gnu.org id=B59831.16702303236834 (code B ref 59831); Mon, 05 Dec 2022 08:53:02 +0000 Original-Received: (at 59831) by debbugs.gnu.org; 5 Dec 2022 08:52:03 +0000 Original-Received: from localhost ([127.0.0.1]:34708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p27Ck-0001mA-Tu for submit@debbugs.gnu.org; Mon, 05 Dec 2022 03:52:03 -0500 Original-Received: from out-162.mta0.migadu.com ([91.218.175.162]:46475) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p27Cg-0001ll-Mm for 59831@debbugs.gnu.org; Mon, 05 Dec 2022 03:52:02 -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=1670230316; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NdjN/S9VNooD3U2hZE5K+1KkXT/Rly1w/vq/lZ+N4h0=; b=pVgG/iGux/Wr9BKmr1DQ84giysDlEST2jFNVsYSPxEW72ST7BVJrbHy2Y44EEf+LO+haXg uAnt3twQVpJqELgrnGL5FxS5dLhBBvqqznypP7Y1eGq0q2NZDBNvIvdaIzJR5lUPoofvkf yYZyiMjGW3U5FxNw/aIEez810s3g/3Kfruc57v6dHUmlOKUz+trYXCrJlRTAkoeKR5f0Sl jlnu2Ew2k00KtNuFY+oSImRbn7LM4nPwvcJ5Rco92dmhGZI9So34ufCcb0LsUOR/AFJoUh oYxLCdCr95YpxraOopZB7hxsonLuhSOMc1SeF8tiWEkIb7HUX8R3RHtuudYjdg== In-Reply-To: <676d4e95-dfe3-5ced-60a3-b2387512ee63@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:249999 Archived-At: Jostein Kj=C3=B8nigsen writes: > When I create or use a class in a Typescript-file, I often have=20 > properties and field declarations. > > These are all fontified using default-face, instead of=20 > font-lock-property-face. > > Also when creating new objects using bracket syntac { key: value, key:=20 > value, etc: etc }, default-face is used. > > Attached is a patch which improves fontification of these aspects in=20 > both typescript-ts-mode and typescript-tsx-mode. > > It also contains code to further improve fontification of=20 > retuen-statements, which IMO is a little bit lacking. > LGTM :) Yuan, feel free to apply when you have some free time! > From 3bcbd89cc43c6ad7885f11aa4c7c92ebd600a164 Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Jostein=3D20Kj=3DC3=3DB8nigsen?=3D > Date: Mon, 5 Dec 2022 09:31:58 +0100 > Subject: [PATCH] lisp/progmodes/typescript-ts-mode: improve fontification > > - syntax-highlight property and field definitions in class declaration. > - syntax-highlight property-keys in object initializaters. > - syntax-highlight variable-names in function/method return-statements. > --- > lisp/progmodes/typescript-ts-mode.el | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typesc= ript-ts-mode.el > index 48ac1169fe8..48d3c084b6e 100644 > --- a/lisp/progmodes/typescript-ts-mode.el > +++ b/lisp/progmodes/typescript-ts-mode.el > @@ -213,7 +213,9 @@ typescript-ts-mode--font-lock-settings > parameters: > [(_ (identifier) @font-lock-variable-name-face) > (_ (_ (identifier) @font-lock-variable-name-face)) > - (_ (_ (_ (identifier) @font-lock-variable-name-face)))])) > + (_ (_ (_ (identifier) @font-lock-variable-name-face)))]) > + > + (return_statement (identifier) @font-lock-variable-name-face)) >=20=20 > :language language > :override t > @@ -282,7 +284,14 @@ typescript-ts-mode--font-lock-settings > :language language > :override t > :feature 'property > - `((pair value: (identifier) @font-lock-variable-name-face) > + `((property_signature > + name: (property_identifier) @font-lock-property-face) > + (public_field_definition > + name: (property_identifier) @font-lock-property-face) > + > + (pair key: (property_identifier) @font-lock-variable-name-face) > + > + (pair value: (identifier) @font-lock-variable-name-face) >=20=20 > ((shorthand_property_identifier) @font-lock-property-face) >=20=20 Thanks! Theo