@@ -371,18 +371,22 @@ Only intended for use at development time.")
371
371
" Return a regular expression that matches one of SYMBOLS exactly."
372
372
(concat " ^" (regexp-opt symbols) " $" ))
373
373
374
- (defvar clojure-ts-function-docstring-symbols
375
- '(" definline"
376
- " defmulti"
377
- " defmacro"
378
- " defn"
379
- " defn-"
380
- " defprotocol"
381
- " ns" )
374
+ (defconst clojure-ts-function-docstring-symbols
375
+ (eval-and-compile
376
+ (rx line-start
377
+ (or " definline"
378
+ " defmulti"
379
+ " defmacro"
380
+ " defn"
381
+ " defn-"
382
+ " defprotocol"
383
+ " ns" )
384
+ line-end))
382
385
" Symbols that accept an optional docstring as their second argument." )
383
386
384
- (defvar clojure-ts-definition-docstring-symbols
385
- '(" def" )
387
+ (defconst clojure-ts-definition-docstring-symbols
388
+ (eval-and-compile
389
+ (rx line-start " def" line-end))
386
390
" Symbols that accept an optional docstring as their second argument.
387
391
Any symbols added here should only treat their second argument as a docstring
388
392
if a third argument (the value) is provided.
@@ -428,7 +432,7 @@ if a third argument (the value) is provided.
428
432
:anchor (str_lit (str_content) , capture-symbol ) @font-lock-doc-face
429
433
; ; The variable's value
430
434
:anchor (_))
431
- (:match ,( clojure-ts-symbol-regexp clojure-ts- definition-docstring-symbols)
435
+ (:match , clojure-ts-definition-docstring-symbols
432
436
@_def_symbol))
433
437
; ; Captures docstrings in metadata of definitions
434
438
((list_lit :anchor [(comment) (meta_lit) (old_meta_lit)] :*
@@ -456,7 +460,7 @@ if a third argument (the value) is provided.
456
460
:anchor (sym_lit)
457
461
:anchor [(comment) (meta_lit) (old_meta_lit)] :*
458
462
:anchor (str_lit (str_content) , capture-symbol ) @font-lock-doc-face)
459
- (:match ,( clojure-ts-symbol-regexp clojure-ts- function-docstring-symbols)
463
+ (:match , clojure-ts-function-docstring-symbols
460
464
@_def_symbol))
461
465
; ; Captures docstrings in defprotcol, definterface
462
466
((list_lit :anchor [(comment) (meta_lit) (old_meta_lit)] :*
@@ -1498,7 +1502,15 @@ function literal."
1498
1502
" definline"
1499
1503
" defrecord"
1500
1504
" defmacro"
1501
- " defmulti" )
1505
+ " defmulti"
1506
+ " defonce"
1507
+ " defprotocol"
1508
+ " deftest"
1509
+ " deftest-"
1510
+ " ns"
1511
+ " definterface"
1512
+ " deftype"
1513
+ " defstruct" )
1502
1514
eol)))
1503
1515
1504
1516
(defconst clojure-ts--markdown-inline-sexp-nodes
@@ -1509,7 +1521,7 @@ function literal."
1509
1521
1510
1522
(defun clojure-ts--default-sexp-node-p (node )
1511
1523
" Return TRUE if point is after the # marker of set or function literal NODE."
1512
- (and (eq (char-before ( point ) ) ?\# )
1524
+ (and (eq (char-before ) ?\# )
1513
1525
(string-match-p (rx bol (or " anon_fn_lit" " set_lit" ) eol)
1514
1526
(treesit-node-type (treesit-node-parent node)))))
1515
1527
0 commit comments