emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/typescript-mode ba047458dd 03/10: fix(fontlock): fontify r


From: ELPA Syncer
Subject: [nongnu] elpa/typescript-mode ba047458dd 03/10: fix(fontlock): fontify return type in a function type definition
Date: Sat, 30 Jul 2022 06:59:04 -0400 (EDT)

branch: elpa/typescript-mode
commit ba047458ddf57ea4b5a404553292b14e0fc3d069
Author: Matus Goljer <matus.goljer@gmail.com>
Commit: Matus Goljer <matus.goljer@gmail.com>

    fix(fontlock): fontify return type in a function type definition
---
 typescript-mode-general-tests.el | 6 +++++-
 typescript-mode.el               | 3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/typescript-mode-general-tests.el b/typescript-mode-general-tests.el
index 9c1102b915..bd635e8370 100644
--- a/typescript-mode-general-tests.el
+++ b/typescript-mode-general-tests.el
@@ -565,7 +565,11 @@ should be fontified as variable, keyword and type."
   (test-with-fontified-buffer
       "private genericArray3: SomeType<Foo[]>[];"
     (should (eq (get-face-at "SomeType") 'font-lock-type-face))
-    (should (eq (get-face-at "Foo") 'font-lock-type-face))))
+    (should (eq (get-face-at "Foo") 'font-lock-type-face)))
+
+  (test-with-fontified-buffer
+      "const f: () => SomeType = () => {}"
+    (should (eq (get-face-at "SomeType") 'font-lock-type-face))))
 
 (ert-deftest font-lock/type-names-level4-namespaces ()
   "Namespaced Typenames should be highlighted in declarations"
diff --git a/typescript-mode.el b/typescript-mode.el
index 268df97395..7c27593a0b 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -2003,9 +2003,10 @@ This performs fontification according to 
`typescript--class-styles'."
     ;; - private genericArray: SomeType<Foo>[]
     ;; - function testFunc(): SomeType<> {
     ;; - function testFunc(a): a is SomeType<> {
+    ;; - () => SomeType
     ;; TODO: namespaced classes!
     ,(list
-      (concat ":\\s-\\(?:\\s-*\\(" typescript--name-re 
"\\)\\s-*\\(is\\)\\s-*\\)?" "\\(" typescript--type-name-re "\\)\\(<" 
typescript--type-name-re ">\\)?\\(\[\]\\)?\\([,;]\\)?\\s-*{?")
+      (concat "\\(?::\\|=>\\)\\s-\\(?:\\s-*\\(" typescript--name-re 
"\\)\\s-*\\(is\\)\\s-*\\)?" "\\(" typescript--type-name-re "\\)\\(<" 
typescript--type-name-re ">\\)?\\(\[\]\\)?\\([,;]\\)?\\s-*{?")
       '(1 'font-lock-variable-name-face nil t)
       '(2 'font-lock-keyword-face nil t)
       '(3 'font-lock-type-face))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]