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

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

[nongnu] elpa/typescript-mode 367cfb70f5 02/10: fix(fontlock): do not fo


From: ELPA Syncer
Subject: [nongnu] elpa/typescript-mode 367cfb70f5 02/10: fix(fontlock): do not fontify function calls as keywords
Date: Sat, 30 Jul 2022 06:59:04 -0400 (EDT)

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

    fix(fontlock): do not fontify function calls as keywords
    
    If a method/function is named same as keyword or built-in, it should
    still be fontified as method/function call.
---
 typescript-mode-general-tests.el | 11 +++++++++++
 typescript-mode.el               |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/typescript-mode-general-tests.el b/typescript-mode-general-tests.el
index 9c1102b915..d17af4508d 100644
--- a/typescript-mode-general-tests.el
+++ b/typescript-mode-general-tests.el
@@ -383,6 +383,17 @@ snake_cased_function(1, 2, 3)"
       (("endpoint" "data") . nil)
       (("<" ">" ",") . nil))))
 
+(ert-deftest font-lock/method-call-with-keyword-name ()
+  "If the name of the function/method is a keyword, it should still be 
highlighted as function."
+  (test-with-fontified-buffer
+      "const app = express();
+app.get()
+app.post()
+app.delete()"
+    (should (eq (get-face-at "get") 'font-lock-function-name-face))
+    (should (eq (get-face-at "post") 'font-lock-function-name-face))
+    (should (eq (get-face-at "delete") 'font-lock-function-name-face))))
+
 (ert-deftest font-lock/generics ()
   "Tests that type hints within generics are highlighted properly."
   (font-lock-test
diff --git a/typescript-mode.el b/typescript-mode.el
index 268df97395..b3a9a504fa 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -2020,7 +2020,7 @@ This performs fontification according to 
`typescript--class-styles'."
     ,@typescript--font-lock-keywords-3
 
     (,typescript--decorator-re (1 font-lock-function-name-face))
-    (,typescript--function-call-re (1 font-lock-function-name-face))
+    (,typescript--function-call-re (1 font-lock-function-name-face t))
     (,typescript--builtin-re (1 font-lock-type-face))
 
     ;; arrow function



reply via email to

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