Skip to content

Commit ec2c4c1

Browse files
authored
Merge pull request #172 from Fuco1/fix/keywords-method-calls
fix(fontlock): do not fontify function calls as keywords
2 parents 35f01b3 + 367cfb7 commit ec2c4c1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

typescript-mode-general-tests.el

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,17 @@ snake_cased_function(1, 2, 3)"
396396
(("endpoint" "data") . nil)
397397
(("<" ">" ",") . nil))))
398398

399+
(ert-deftest font-lock/method-call-with-keyword-name ()
400+
"If the name of the function/method is a keyword, it should still be highlighted as function."
401+
(test-with-fontified-buffer
402+
"const app = express();
403+
app.get()
404+
app.post()
405+
app.delete()"
406+
(should (eq (get-face-at "get") 'font-lock-function-name-face))
407+
(should (eq (get-face-at "post") 'font-lock-function-name-face))
408+
(should (eq (get-face-at "delete") 'font-lock-function-name-face))))
409+
399410
(ert-deftest font-lock/generics ()
400411
"Tests that type hints within generics are highlighted properly."
401412
(font-lock-test

typescript-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2028,7 +2028,7 @@ This performs fontification according to `typescript--class-styles'."
20282028
,@typescript--font-lock-keywords-3
20292029

20302030
(,typescript--decorator-re (1 font-lock-function-name-face))
2031-
(,typescript--function-call-re (1 font-lock-function-name-face))
2031+
(,typescript--function-call-re (1 font-lock-function-name-face t))
20322032
(,typescript--builtin-re (1 font-lock-type-face))
20332033

20342034
;; arrow function

0 commit comments

Comments
 (0)