Skip to content

Commit 84a56ce

Browse files
committed
Correctly font-lock docstring in def/defn with meta data
1 parent 56fbdbc commit 84a56ce

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

clojure-ts-mode.el

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ if a third argument (the value) is provided.
260260
(defun clojure-ts--docstring-query (capture-symbol)
261261
"Return a query that captures docstrings with CAPTURE-SYMBOL."
262262
`(;; Captures docstrings in def
263-
((list_lit :anchor (sym_lit) @_def_symbol
263+
((list_lit :anchor (meta_lit) :?
264+
:anchor (sym_lit) @_def_symbol
264265
:anchor (comment) :?
265266
:anchor (sym_lit) ; variable name
266267
:anchor (comment) :?
@@ -288,7 +289,8 @@ if a third argument (the value) is provided.
288289
@_def_symbol)
289290
(:equal @_doc-keyword ":doc"))
290291
;; Captures docstrings defn, defmacro, ns, and things like that
291-
((list_lit :anchor (sym_lit) @_def_symbol
292+
((list_lit :anchor (meta_lit) :?
293+
:anchor (sym_lit) @_def_symbol
292294
:anchor (comment) :?
293295
:anchor (sym_lit) ; function_name
294296
:anchor (comment) :?

test/samples/test.clj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ clojure.core/map
289289

290290
(def ^Integer x 1)
291291

292+
^{:foo true}
293+
(defn b "hello" [] "world")
294+
292295
(comment
293296
(defrecord TestRecord [field]
294297
AutoCloseable

0 commit comments

Comments
 (0)