Skip to content

Commit

Permalink
Fix font-lock of type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
vspinu authored and bbatsov committed Oct 24, 2018
1 parent 7055feb commit dd8a193
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions clojure-mode.el
Expand Up @@ -439,7 +439,7 @@ ENDP and DELIM."
(t)))))

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

;; type-hints: #^oneword
(,(concat "\\(#^\\)\\(" clojure--sym-regexp "?\\)\\(/\\)\\(" clojure--sym-regexp "\\)")
(,(concat "\\(#?\\^\\)\\(" clojure--sym-regexp "?\\)\\(/\\)\\(" clojure--sym-regexp "\\)")
(1 'default)
(2 font-lock-type-face)
(3 'default)
(4 'default))
(,(concat "\\(#^\\)\\(" clojure--sym-regexp "\\)")
(,(concat "\\(#?\\^\\)\\(" clojure--sym-regexp "\\)")
(1 'default)
(2 font-lock-type-face))

Expand Down
5 changes: 3 additions & 2 deletions test/clojure-mode-font-lock-test.el
Expand Up @@ -347,9 +347,10 @@ POS."

;; type-hint
(should (eq (clojure-test-face-at 1 2 "#^ve/yCom|pLex.stu-ff") 'default))
(should (eq (clojure-test-face-at 3 4 "#^ve/yCom|pLex.stu-ff")
'font-lock-type-face))
(should (eq (clojure-test-face-at 3 4 "#^ve/yCom|pLex.stu-ff") 'font-lock-type-face))
(should (eq (clojure-test-face-at 5 21 "#^ve/yCom|pLex.stu-ff") 'default))
(should (eq (clojure-test-face-at 2 3 "^ve/yCom|pLex.stu-ff") 'font-lock-type-face))
(should (eq (clojure-test-face-at 5 20 "^ve/yCom|pLex.stu-ff") 'default))

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

0 comments on commit dd8a193

Please sign in to comment.