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

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

[nongnu] elpa/typescript-mode e5704af123 09/10: Merge pull request #171


From: ELPA Syncer
Subject: [nongnu] elpa/typescript-mode e5704af123 09/10: Merge pull request #171 from Fuco1/bugfix/fontify-return-type-function-type
Date: Sat, 30 Jul 2022 06:59:04 -0400 (EDT)

branch: elpa/typescript-mode
commit e5704af123d9e77b1f3d716996078ffbdc056ffe
Merge: ec2c4c11fc ba047458dd
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: GitHub <noreply@github.com>

    Merge pull request #171 from Fuco1/bugfix/fontify-return-type-function-type
    
    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 33d5850f80..34add73657 100644
--- a/typescript-mode-general-tests.el
+++ b/typescript-mode-general-tests.el
@@ -589,7 +589,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 98d20eb7ef..e3ad84c499 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -2011,9 +2011,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]