all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#62429: 30.0.50; Add jsx faces to typescript-ts-mode
@ 2023-03-24 23:49 Yuan Fu
  2023-03-25  5:47 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-03-25 12:30 ` Eli Zaretskii
  0 siblings, 2 replies; 10+ messages in thread
From: Yuan Fu @ 2023-03-24 23:49 UTC (permalink / raw)
  To: 62429; +Cc: theo

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

X-Debbugs-CC: theo@thornhill.no

Hey Theo, I want to add separate faces for JSX tags and attributes.
Otherwise users will be in a world of pain if they want to use different
fontification for JSX tag and funcall, and JSX attribute and constant. WDYT?

Yuan


[-- Attachment #2: faces.patch --]
[-- Type: application/octet-stream, Size: 2034 bytes --]

From 6a52f34fff83908312881b9f46f07bf54597ff6f Mon Sep 17 00:00:00 2001
From: Yuan Fu <casouri@gmail.com>
Date: Fri, 24 Mar 2023 16:45:15 -0700
Subject: [PATCH] Add two typescript-ts-mode faces

* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-mode-jsx-tag-face)
(typescript-ts-mode-jsx-attribute-face): New faces.
(typescript-ts-mode--font-lock-settings): Use new faces.
---
 lisp/progmodes/typescript-ts-mode.el | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index a9ca85d5d35..207c3f03b88 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -41,6 +41,14 @@ typescript-ts-mode-indent-offset
   :safe 'integerp
   :group 'typescript)
 
+(defface typescript-ts-jsx-tag-face
+  '((t . (:inherit font-lock-function-call-face)))
+  "Face for HTML tags like <div> and <p> in JSX.")
+
+(defface typescript-ts-jsx-attribute-face
+  '((t . (:inherit font-lock-constant-face)))
+  "Face for HTML attributes like name and id in JSX.")
+
 (defvar typescript-ts-mode--syntax-table
   (let ((table (make-syntax-table)))
     ;; Taken from the cc-langs version
@@ -284,17 +292,17 @@ typescript-ts-mode--font-lock-settings
    :feature 'jsx
    `((jsx_opening_element
       [(nested_identifier (identifier)) (identifier)]
-      @font-lock-function-call-face)
+      @typescript-ts-jsx-tag-face)
 
      (jsx_closing_element
       [(nested_identifier (identifier)) (identifier)]
-      @font-lock-function-call-face)
+      @typescript-ts-jsx-tag-face)
 
      (jsx_self_closing_element
       [(nested_identifier (identifier)) (identifier)]
-      @font-lock-function-call-face)
+      @typescript-ts-jsx-tag-face)
 
-     (jsx_attribute (property_identifier) @font-lock-constant-face))
+     (jsx_attribute (property_identifier) @typescript-ts-jsx-attribute-face))
 
    :language language
    :feature 'number
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-04-02 22:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-24 23:49 bug#62429: 30.0.50; Add jsx faces to typescript-ts-mode Yuan Fu
2023-03-25  5:47 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-25 12:30 ` Eli Zaretskii
2023-03-25 19:45   ` Yuan Fu
2023-03-26  4:37     ` Eli Zaretskii
2023-03-30  0:28       ` Yuan Fu
2023-03-30  5:25         ` Eli Zaretskii
2023-03-30  8:11           ` Yuan Fu
2023-03-30 14:31             ` Eli Zaretskii
2023-04-02 22:10               ` Yuan Fu

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.