@@ -176,6 +176,7 @@ Only intended for use at development time.")
176
176
" case" " comment" " cond" " cond->" " cond->>" " condp"
177
177
" declare" " def" " definline" " definterface" " defmacro" " defmethod"
178
178
" defmulti" " defn" " defn-" " defonce" " defprotocol" " defrecord"
179
+ " >defn" " >defn-"
179
180
" defstruct" " deftype"
180
181
" delay" " doall" " dorun" " doseq" " dosync" " dotimes" " doto"
181
182
" extend-protocol" " extend-type"
@@ -207,13 +208,28 @@ Only intended for use at development time.")
207
208
(defun clojure-ts-symbol-regexp (symbols )
208
209
" Return a regular expression that matches one of SYMBOLS exactly."
209
210
(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))
210
224
211
225
(defvar clojure-ts-function-docstring-symbols
212
226
'(" definline"
213
227
" defmulti"
214
228
" defmacro"
215
229
" defn"
216
230
" defn-"
231
+ " >defn"
232
+ " >defn-"
217
233
" defprotocol"
218
234
" ns" )
219
235
" Symbols that accept an optional docstring as their second argument." )
@@ -278,6 +294,7 @@ if a third argument (the value) is provided.
278
294
; ; Naming another regex is very cumbersome.
279
295
(:match ,(clojure-ts-symbol-regexp
280
296
'(" def" " defonce" " defn" " defn-" " defmacro" " ns"
297
+ " >defn" " >defn-"
281
298
" defmulti" " definterface" " defprotocol"
282
299
" deftest" " deftest-"
283
300
" deftype" " defrecord" " defstruct" ))
@@ -372,6 +389,8 @@ with the markdown_inline grammar."
372
389
(or
373
390
" defn"
374
391
" defn-"
392
+ " >defn"
393
+ " >defn-"
375
394
" defmulti"
376
395
" defmethod"
377
396
" deftest"
@@ -574,7 +593,7 @@ Can be called directly, but intended for use as `treesit-defun-name-function'."
574
593
(treesit-node-text name)))))))
575
594
576
595
(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)
578
597
" Regular expression for matching definition nodes that resemble functions." )
579
598
580
599
(defun clojure-ts--function-node-p (node )
@@ -687,6 +706,7 @@ The possible values for this variable are
687
706
; ; we also explicitly do not match symbols beginning with
688
707
; ; "default" "deflate" and "defer", like cljfmt
689
708
(and line-start " def" )
709
+ (and line-start " >def" )
690
710
; ; Match with-* symbols
691
711
(and line-start " with-" )
692
712
; ; Exact matches
0 commit comments