@@ -176,6 +176,7 @@ Only intended for use at development time.")
176176 " case" " comment" " cond" " cond->" " cond->>" " condp"
177177 " declare" " def" " definline" " definterface" " defmacro" " defmethod"
178178 " defmulti" " defn" " defn-" " defonce" " defprotocol" " defrecord"
179+ " >defn" " >defn-"
179180 " defstruct" " deftype"
180181 " delay" " doall" " dorun" " doseq" " dosync" " dotimes" " doto"
181182 " extend-protocol" " extend-type"
@@ -207,13 +208,28 @@ Only intended for use at development time.")
207208(defun clojure-ts-symbol-regexp (symbols )
208209 " Return a regular expression that matches one of SYMBOLS exactly."
209210 (concat " ^" (regexp-opt symbols) " $" ))
211+ (defconst clojure-ts--definition-keyword-regexp
212+ (rx
213+ line-start
214+ (or (group (or " ns" " fn" ))
215+ (group " >def"
216+ (+ (or alnum
217+ ; ; What are valid characters for symbols? is a negative match better?
218+ " -" " _" " !" " @" " #" " $" " %" " ^" " &" " *" " |" " ?" " <" " >" " +" " =" " :" )))
219+ (group " def"
220+ (+ (or alnum
221+ ; ; What are valid characters for symbols? is a negative match better?
222+ " -" " _" " !" " @" " #" " $" " %" " ^" " &" " *" " |" " ?" " <" " >" " +" " =" " :" ))))
223+ line-end))
210224
211225(defvar clojure-ts-function-docstring-symbols
212226 '(" definline"
213227 " defmulti"
214228 " defmacro"
215229 " defn"
216230 " defn-"
231+ " >defn"
232+ " >defn-"
217233 " defprotocol"
218234 " ns" )
219235 " Symbols that accept an optional docstring as their second argument." )
@@ -278,6 +294,7 @@ if a third argument (the value) is provided.
278294 ; ; Naming another regex is very cumbersome.
279295 (:match ,(clojure-ts-symbol-regexp
280296 '(" def" " defonce" " defn" " defn-" " defmacro" " ns"
297+ " >defn" " >defn-"
281298 " defmulti" " definterface" " defprotocol"
282299 " deftest" " deftest-"
283300 " deftype" " defrecord" " defstruct" ))
@@ -372,6 +389,8 @@ with the markdown_inline grammar."
372389 (or
373390 " defn"
374391 " defn-"
392+ " >defn"
393+ " >defn-"
375394 " defmulti"
376395 " defmethod"
377396 " deftest"
@@ -574,7 +593,7 @@ Can be called directly, but intended for use as `treesit-defun-name-function'."
574593 (treesit-node-text name)))))))
575594
576595(defvar clojure-ts--function-type-regexp
577- (rx string-start (or " defn" " defmethod" ) string-end)
596+ (rx string-start (or " defn" " defn- " " defmethod" " >defn " " >defn- " ) string-end)
578597 " Regular expression for matching definition nodes that resemble functions." )
579598
580599(defun clojure-ts--function-node-p (node )
@@ -687,6 +706,7 @@ The possible values for this variable are
687706 ; ; we also explicitly do not match symbols beginning with
688707 ; ; "default" "deflate" and "defer", like cljfmt
689708 (and line-start " def" )
709+ (and line-start " >def" )
690710 ; ; Match with-* symbols
691711 (and line-start " with-" )
692712 ; ; Exact matches
0 commit comments