[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/typescript-mode d1123e0e96 2/2: Merge pull request #175 fr
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/typescript-mode d1123e0e96 2/2: Merge pull request #175 from Fuco1/bugfix/re-fontify-only-methods |
Date: |
Fri, 5 Aug 2022 16:59:12 -0400 (EDT) |
branch: elpa/typescript-mode
commit d1123e0e96da3535a22380e9345249730e756966
Merge: acd8d79952 b650e42662
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: GitHub <noreply@github.com>
Merge pull request #175 from Fuco1/bugfix/re-fontify-only-methods
fix(fontlock): only re-fontify method calls with reserved words
---
typescript-mode-general-tests.el | 10 +++++++---
typescript-mode.el | 4 +++-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/typescript-mode-general-tests.el b/typescript-mode-general-tests.el
index 686db6bfdf..ff8220b2f5 100644
--- a/typescript-mode-general-tests.el
+++ b/typescript-mode-general-tests.el
@@ -397,15 +397,19 @@ snake_cased_function(1, 2, 3)"
(("<" ">" ",") . 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."
+ "If the name of the method is a keyword, it should still be highlighted as
function."
(test-with-fontified-buffer
"const app = express();
app.get()
app.post()
-app.delete()"
+app.delete()
+if (true) {}
+// for (abc) {}"
(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))))
+ (should (eq (get-face-at "delete") 'font-lock-function-name-face))
+ (should (eq (get-face-at "if") 'font-lock-keyword-face))
+ (should (eq (get-face-at "for") 'font-lock-comment-face))))
(ert-deftest font-lock/generics ()
"Tests that type hints within generics are highlighted properly."
diff --git a/typescript-mode.el b/typescript-mode.el
index 032abbc7a5..47d5c4bd09 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -2137,7 +2137,9 @@ 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 t))
+ (,typescript--function-call-re (1 font-lock-function-name-face))
+ (,(concat "\\(?:\\.\\s-*\\)" typescript--function-call-re)
+ (1 font-lock-function-name-face t))
(,typescript--builtin-re (1 font-lock-type-face))
;; arrow function
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/typescript-mode d1123e0e96 2/2: Merge pull request #175 from Fuco1/bugfix/re-fontify-only-methods,
ELPA Syncer <=