Subject: bug#59660: lisp/progmodes/typescript-ts-mode.el: restore method-name fontification

From: Jostein Kjønigsen <[email-masked]>
Date: Mon, 28 Nov 2022 18:08:01 +0100

All fixes and one more squashed into the attached patch :)

Vennlig hilsen
*Jostein Kjønigsen*

[email-masked] 🍵 [email-masked]
https://jostein.kjønigsen.no <https://jostein.kjønigsen.no>
On 28.11.2022 17:53, Jostein Kjønigsen wrote:
>
> And another improvement.
>
> --
> Kind regards
> *Jostein Kjønigsen*
>
> [email-masked] 🍵 [email-masked]
> https://jostein.kjønigsen.no <https://jostein.kjønigsen.no>
> On 28.11.2022 17:44, Jostein Kjønigsen wrote:
>>
>> This additional patch further improves fontification by fontifying 
>> function-arguments as variables too.
>>
>> --
>>
>> Kind regards
>> *Jostein Kjønigsen*
>>
>> [email-masked] 🍵 [email-masked]
>> https://jostein.kjønigsen.no <https://jostein.kjønigsen.no>
>> On 28.11.2022 16:09, Jostein Kjønigsen wrote:
>>>
>>> Attached is a simple patch which addresses this font-lock issue and 
>>> makes typescript-ts-mode much better to use.
>>>
>>> -- 
>>> Kind regards
>>> *Jostein Kjønigsen*
>>>
>>> [email-masked] 🍵 [email-masked]
>>> https://jostein.kjønigsen.no <https://jostein.kjønigsen.no>

From 8162feb561ab873860accf19e6d384d19ca0fcc3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= <[email-masked]>
Date: Mon, 28 Nov 2022 16:05:27 +0100
Subject: [PATCH 4/4] lisp/progmodes/typescript-ts-mode.el: fontification
 improvements

- restore method-name fontification.
- fontify all types in class-declarations, extendees too
---
 lisp/progmodes/typescript-ts-mode.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index bf483a31d34..6c926a4e3e0 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -150,12 +150,20 @@ typescript-ts-mode--font-lock-settings
 
      (method_definition
       name: (property_identifier) @font-lock-function-name-face)
+     (required_parameter (identifier) @font-lock-variable-name-face)
+     (optional_parameter (identifier) @font-lock-variable-name-face)
 
      (variable_declarator
       name: (identifier) @font-lock-variable-name-face)
 
      (enum_declaration (identifier) @font-lock-type-face)
 
+     (extends_clause value: (identifier) @font-lock-type-face)
+     ;; extends React.Component<T>
+     (extends_clause value: (member_expression
+                             object: (identifier) @font-lock-type-face
+                             property: (property_identifier) @font-lock-type-face))
+
      (arrow_function
       parameter: (identifier) @font-lock-variable-name-face)
 
@@ -267,9 +275,7 @@ typescript-ts-mode--font-lock-settings
    :language 'tsx
    :override t
    :feature 'property
-   `(((property_identifier) @font-lock-property-face)
-
-     (pair value: (identifier) @font-lock-variable-name-face)
+   `((pair value: (identifier) @font-lock-variable-name-face)
 
      ((shorthand_property_identifier) @font-lock-property-face)
 
-- 
2.37.2