unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jostein Kjønigsen" <jostein@secure.kjonigsen.net>
To: 59660@debbugs.gnu.org, Theodor Thornhill <theo@thornhill.no>,
	Yuan Fu <casouri@gmail.com>
Subject: bug#59660: lisp/progmodes/typescript-ts-mode.el: restore method-name fontification
Date: Mon, 28 Nov 2022 18:08:01 +0100	[thread overview]
Message-ID: <f21dc128-85fb-07f9-4b9c-de044f948f3c@secure.kjonigsen.net> (raw)
In-Reply-To: <fd600c73-9bd8-0f15-eeb9-993e495f80b3@secure.kjonigsen.net>


[-- Attachment #1.1: Type: text/plain, Size: 1117 bytes --]

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

Vennlig hilsen
*Jostein Kjønigsen*

jostein@kjonigsen.net 🍵 jostein@gmail.com
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*
>
> jostein@kjonigsen.net 🍵 jostein@gmail.com
> 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*
>>
>> jostein@kjonigsen.net 🍵 jostein@gmail.com
>> 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*
>>>
>>> jostein@kjonigsen.net 🍵 jostein@gmail.com
>>> https://jostein.kjønigsen.no <https://jostein.kjønigsen.no>

[-- Attachment #1.2: Type: text/html, Size: 3661 bytes --]

[-- Attachment #2: 0004-lisp-progmodes-typescript-ts-mode.el-fontification-i.patch --]
[-- Type: text/x-patch, Size: 1898 bytes --]

From 8162feb561ab873860accf19e6d384d19ca0fcc3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= <jostein@kjonigsen.net>
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


  reply	other threads:[~2022-11-28 17:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 15:04 bug#59660: 29.0.50; typescript-ts-mode consistently fontifies method-names incorrectly Jostein Kjønigsen
2022-11-28 15:09 ` bug#59660: lisp/progmodes/typescript-ts-mode.el: restore method-name fontification Jostein Kjønigsen
2022-11-28 16:44   ` Jostein Kjønigsen
2022-11-28 16:53     ` Jostein Kjønigsen
2022-11-28 17:08       ` Jostein Kjønigsen [this message]
2022-11-28 17:27         ` Eli Zaretskii
2022-11-28 18:00           ` Jostein Kjønigsen
2022-11-28 23:02         ` Yuan Fu
2022-11-28 23:06 ` bug#59660: 29.0.50; typescript-ts-mode consistently fontifies method-names incorrectly Yuan Fu
2022-11-29 12:10   ` Eli Zaretskii
2022-11-29 13:58     ` Jostein Kjønigsen
2022-11-29 14:30       ` Eli Zaretskii
2022-11-29 15:10       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-29 16:35         ` Jostein Kjønigsen
2022-11-29 16:39           ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=f21dc128-85fb-07f9-4b9c-de044f948f3c@secure.kjonigsen.net \
    --to=jostein@secure.kjonigsen.net \
    --cc=59660@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).