unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jostein Kjønigsen" <jostein@secure.kjonigsen.net>
To: Theodor Thornhill <theo@thornhill.no>,
	jostein@kjonigsen.net, Yuan Fu <casouri@gmail.com>
Cc: 59831@debbugs.gnu.org
Subject: bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified
Date: Wed, 7 Dec 2022 10:42:20 +0100	[thread overview]
Message-ID: <b6d65222-5f66-18fb-5ed6-fa0bd8e39148@secure.kjonigsen.net> (raw)
In-Reply-To: <87mt7zzhg6.fsf@thornhill.no>

[-- Attachment #1: Type: text/plain, Size: 421 bytes --]

On 07.12.2022 10:33, Theodor Thornhill wrote:
>
> Do we need this (this) here, or could that just go into the keyword feature?
>
> Otherwise LGTM.  Go ahead and install, Yuan, unless you have something
> else to add :-)
>
> Theo

You're right. We don't. I've cleaned that up in this patch, and also 
made sure to better support if-statements with negations.

See new, attached patch with all changes applied.

--
Jostein

[-- Attachment #2: 0001-lisp-progmodes-typescript-ts-mode.el-Improve-fontifi.patch --]
[-- Type: text/x-patch, Size: 2590 bytes --]

From f2f79b2bde2147fd0febddea696ab43bcc257b96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= <jostein@kjonigsen.net>
Date: Wed, 7 Dec 2022 09:27:42 +0100
Subject: [PATCH] lisp/progmodes/typescript-ts-mode.el: Improve fontification
 of variables

---
 lisp/progmodes/typescript-ts-mode.el | 42 +++++++++++++++++-----------
 1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index 3da690567e2..fc2f746a0f4 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -220,7 +220,31 @@ typescript-ts-mode--font-lock-settings
      (binary_expression left: (identifier) @font-lock-variable-name-face)
      (binary_expression right: (identifier) @font-lock-variable-name-face)
 
-     (arguments (identifier) @font-lock-variable-name-face))
+     (arguments (identifier) @font-lock-variable-name-face)
+
+     (parenthesized_expression (identifier) @font-lock-variable-name-face)
+     (parenthesized_expression (_ (identifier)) @font-lock-variable-name-face))
+
+   :language language
+   :override t
+   :feature 'property
+   `((property_signature
+      name: (property_identifier) @font-lock-property-face)
+     (public_field_definition
+      name: (property_identifier) @font-lock-property-face)
+     (member_expression
+      object: (identifier) @font-lock-variable-name-face)
+     (member_expression
+      property: (_) @font-lock-property-face)
+
+     (pair key: (property_identifier) @font-lock-variable-name-face)
+
+     (pair value: (identifier) @font-lock-variable-name-face)
+
+     ((shorthand_property_identifier) @font-lock-property-face)
+
+     ((shorthand_property_identifier_pattern)
+      @font-lock-property-face))
 
    :language language
    :override t
@@ -286,22 +310,8 @@ typescript-ts-mode--font-lock-settings
    :override t
    '((escape_sequence) @font-lock-escape-face)
 
-   :language language
-   :override t
-   :feature 'property
-   `((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)
-
-     ((shorthand_property_identifier) @font-lock-property-face)
-
-     ((shorthand_property_identifier_pattern)
-      @font-lock-property-face))))
+   ))
 
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode))
-- 
2.37.2


  reply	other threads:[~2022-12-07  9:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05  8:42 bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified Jostein Kjønigsen
2022-12-05  8:51 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05  9:05   ` Jostein Kjønigsen
2022-12-05  9:24     ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05 20:13       ` Yuan Fu
2022-12-07  9:24         ` Jostein Kjønigsen
2022-12-07  9:33           ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-07  9:42             ` Jostein Kjønigsen [this message]
2022-12-12  7:53               ` Jostein Kjønigsen
2022-12-14 18:46                 ` Jostein Kjønigsen
2022-12-14 19:03                   ` Eli Zaretskii
2022-12-14 19:39                     ` Yuan Fu
2022-12-14 21:56                       ` Jostein Kjønigsen
2022-12-14 22:21                         ` Yuan Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b6d65222-5f66-18fb-5ed6-fa0bd8e39148@secure.kjonigsen.net \
    --to=jostein@secure.kjonigsen.net \
    --cc=59831@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=jostein@kjonigsen.net \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).