[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/typescript-mode 35f01b3aeb 07/10: Merge pull request #173
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/typescript-mode 35f01b3aeb 07/10: Merge pull request #173 from Fuco1/fix/keywords-in-interfaces |
Date: |
Sat, 30 Jul 2022 06:59:04 -0400 (EDT) |
branch: elpa/typescript-mode
commit 35f01b3aeb0c02edc44508ab7271cfdca318b701
Merge: 83bf47e406 9bd226b386
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: GitHub <noreply@github.com>
Merge pull request #173 from Fuco1/fix/keywords-in-interfaces
fix(fontlock): do not fontify builtins in object/interface key context
---
typescript-mode-general-tests.el | 13 +++++++++++++
typescript-mode.el | 8 ++++++++
2 files changed, 21 insertions(+)
diff --git a/typescript-mode-general-tests.el b/typescript-mode-general-tests.el
index 9c1102b915..ad5ed6220f 100644
--- a/typescript-mode-general-tests.el
+++ b/typescript-mode-general-tests.el
@@ -287,6 +287,19 @@ a severity set to WARNING, no rule name."
" * @param {Something} bar A parameter. References [[moo]] and [[foo]].
* @param second May hold ``x`` or ``y``.")
+(ert-deftest font-lock/interface-builtin-key-context-unfontify ()
+ "Builtins should not be fontified when they are in object or
+interface key context."
+ (test-with-fontified-buffer
+ "interface Foo { type: number; unknown: string; foo: boolean }"
+ (should (eq (get-face-at "type") 'default))
+ (should (eq (get-face-at "unknown") 'default)))
+
+ (test-with-fontified-buffer
+ "const x = { type: 4; unknown: 'bar'; foo: true }"
+ (should (eq (get-face-at "type") 'default))
+ (should (eq (get-face-at "unknown") 'default))))
+
(ert-deftest font-lock/documentation-in-documentation-comments ()
"Documentation in documentation comments should be fontified as
documentation."
diff --git a/typescript-mode.el b/typescript-mode.el
index 268df97395..215a5d8585 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -1737,6 +1737,14 @@ and searches for the next token to be highlighted."
`(
,@typescript--font-lock-keywords-2
+ ;; Remove the fontification of keywords and built-ins when they
+ ;; are keys in an interface, object or class.
+ (,(rx "{")
+ (,(concat "\\(" typescript--keyword-re "\\):")
+ (save-excursion (ignore-errors (up-list)) (point))
+ nil
+ (1 'default t t)))
+
(typescript--jsdoc-param-matcher (1 'typescript-jsdoc-tag t t)
(2 'typescript-jsdoc-type t t)
(3 'typescript-jsdoc-value t t))
- [nongnu] elpa/typescript-mode updated (83bf47e406 -> acd8d79952), ELPA Syncer, 2022/07/30
- [nongnu] elpa/typescript-mode d21c9837cb 04/10: feat(fontlock): fontify arrow fn arguments, ELPA Syncer, 2022/07/30
- [nongnu] elpa/typescript-mode 84bab53b7a 05/10: test(fontlock): update tests related to arglist fontification, ELPA Syncer, 2022/07/30
- [nongnu] elpa/typescript-mode acd8d79952 10/10: Merge pull request #170 from Fuco1/feature/fontify-arrow-fn-args, ELPA Syncer, 2022/07/30
- [nongnu] elpa/typescript-mode 93e1040ea9 01/10: feat(tests): use font-lock-ensure instead of font-lock-fontify-buffer, ELPA Syncer, 2022/07/30
- [nongnu] elpa/typescript-mode e5704af123 09/10: Merge pull request #171 from Fuco1/bugfix/fontify-return-type-function-type, ELPA Syncer, 2022/07/30
- [nongnu] elpa/typescript-mode ec2c4c11fc 08/10: Merge pull request #172 from Fuco1/fix/keywords-method-calls, ELPA Syncer, 2022/07/30
- [nongnu] elpa/typescript-mode 367cfb70f5 02/10: fix(fontlock): do not fontify function calls as keywords, ELPA Syncer, 2022/07/30
- [nongnu] elpa/typescript-mode 9bd226b386 06/10: fix(fontlock): do not fontify builtins in object/interface key context, ELPA Syncer, 2022/07/30
- [nongnu] elpa/typescript-mode ba047458dd 03/10: fix(fontlock): fontify return type in a function type definition, ELPA Syncer, 2022/07/30
- [nongnu] elpa/typescript-mode 35f01b3aeb 07/10: Merge pull request #173 from Fuco1/fix/keywords-in-interfaces,
ELPA Syncer <=