Skip to content

Commit dd8a193

Browse files
vspinubbatsov
authored andcommitted
Fix font-lock of type hints
#462
1 parent 7055feb commit dd8a193

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

clojure-mode.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ ENDP and DELIM."
439439
(t)))))
440440

441441
(defconst clojure--collection-tag-regexp "#\\(::[a-zA-Z0-9._-]*\\|:?\\([a-zA-Z0-9._-]+/\\)?[a-zA-Z0-9._-]+\\)"
442-
"Collection reader macro tag regexp.
442+
"Collection reader macro tag regexp.
443443
It is intended to check for allowed strings that can come before a
444444
collection literal (e.g. '[]' or '{}'), as reader macro tags.
445445
This includes #fully.qualified/my-ns[:kw val] and #::my-ns{:kw
@@ -880,12 +880,12 @@ any number of matches of `clojure--sym-forbidden-rest-chars'."))
880880
(2 'clojure-keyword-face))
881881

882882
;; type-hints: #^oneword
883-
(,(concat "\\(#^\\)\\(" clojure--sym-regexp "?\\)\\(/\\)\\(" clojure--sym-regexp "\\)")
883+
(,(concat "\\(#?\\^\\)\\(" clojure--sym-regexp "?\\)\\(/\\)\\(" clojure--sym-regexp "\\)")
884884
(1 'default)
885885
(2 font-lock-type-face)
886886
(3 'default)
887887
(4 'default))
888-
(,(concat "\\(#^\\)\\(" clojure--sym-regexp "\\)")
888+
(,(concat "\\(#?\\^\\)\\(" clojure--sym-regexp "\\)")
889889
(1 'default)
890890
(2 font-lock-type-face))
891891

test/clojure-mode-font-lock-test.el

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,10 @@ POS."
347347

348348
;; type-hint
349349
(should (eq (clojure-test-face-at 1 2 "#^ve/yCom|pLex.stu-ff") 'default))
350-
(should (eq (clojure-test-face-at 3 4 "#^ve/yCom|pLex.stu-ff")
351-
'font-lock-type-face))
350+
(should (eq (clojure-test-face-at 3 4 "#^ve/yCom|pLex.stu-ff") 'font-lock-type-face))
352351
(should (eq (clojure-test-face-at 5 21 "#^ve/yCom|pLex.stu-ff") 'default))
352+
(should (eq (clojure-test-face-at 2 3 "^ve/yCom|pLex.stu-ff") 'font-lock-type-face))
353+
(should (eq (clojure-test-face-at 5 20 "^ve/yCom|pLex.stu-ff") 'default))
353354

354355
(should (eq (clojure-test-face-at 3 4 " (ve/yCom|pLex.stu-ff)")
355356
'font-lock-type-face))

0 commit comments

Comments
 (0)