Skip to content

Commit d7c28eb

Browse files
author
Bozhidar Batsov
committed
Simplify font-locking of types used as type hints
1 parent bcaf807 commit d7c28eb

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

clojure-mode.el

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,10 +490,6 @@ Called by `imenu--generic-function'."
490490
("\\\\[a-z0-9]+\\>" 0 'clojure-character-face)
491491
;; Constant values (keywords), including as metadata e.g. ^:static
492492
("\\<^?:\\(\\sw\\|\\s_\\)+\\(\\>\\|\\_>\\)" 0 'clojure-keyword-face)
493-
;; Meta type hint #^Type or ^Type
494-
("\\(#?^\\)\\(\\(\\sw\\|\\s_\\)+\\)"
495-
(1 font-lock-preprocessor-face)
496-
(2 font-lock-type-face))
497493
;; cljx annotations (#+clj and #+cljs)
498494
("#\\+cljs?\\>" 0 font-lock-preprocessor-face)
499495
;; Java interop highlighting
@@ -502,7 +498,7 @@ Called by `imenu--generic-function'."
502498
;; .foo .barBaz .qux01 .-flibble .-flibbleWobble
503499
("\\<\\.-?[a-z][a-zA-Z0-9]*\\>" 0 'clojure-interop-method-face)
504500
;; Foo Bar$Baz Qux_ World_OpenUDP Foo. Babylon15.
505-
("\\(?:\\<\\|\\.\\|/\\)\\([A-Z][a-zA-Z0-9_]*[a-zA-Z0-9$_]+\\.?\\>\\)" 1 font-lock-type-face)
501+
("\\(?:\\<\\|\\.\\|/\\|#?^\\)\\([A-Z][a-zA-Z0-9_]*[a-zA-Z0-9$_]+\\.?\\>\\)" 1 font-lock-type-face)
506502
;; foo.bar.baz
507503
("\\<[a-z][a-z0-9_-]+\\.\\([a-z][a-z0-9_-]+\\.?\\)+" 0 font-lock-type-face)
508504
;; foo/ Foo/

test/clojure-mode-test.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ POS."
8686
:tags '(fontification syntax-table)
8787
(should (eq (clojure-test-face-at 1 9 "SomeClass") 'font-lock-type-face)))
8888

89+
(ert-deftest clojure-mode-syntax-table/type-hint ()
90+
:tags '(fontification syntax-table)
91+
(clojure-test-with-temp-buffer "#^SomeClass"
92+
(should (eq (clojure-test-face-at 3 11) 'font-lock-type-face))
93+
(should (eq (clojure-test-face-at 1 2) nil))))
94+
8995
(ert-deftest clojure-mode-syntax-table/constructor ()
9096
:tags '(fontification syntax-table)
9197
(should (eq (clojure-test-face-at 2 11 "(SomeClass.)") 'font-lock-type-face))

0 commit comments

Comments
 (0)