@@ -737,19 +737,20 @@ https://github.com/weavejester/cljfmt/blob/fb26b22f569724b05c93eb2502592dfc2de89
737
737
(or (clojure-ts--symbol-node-p first-child)
738
738
(clojure-ts--keyword-node-p first-child)))))
739
739
740
- (defun clojure-ts--match-expression-in-body (_node parent _bol )
740
+ (defun clojure-ts--match-expression-in-body (node parent _bol )
741
741
" Match NODE if it is an expression used in a body argument.
742
742
PARENT is expected to be a list literal.
743
743
See `treesit-simple-indent-rules' ."
744
744
(and
745
745
(clojure-ts--list-node-p parent)
746
- (let ((first-child (treesit- node-child parent 0 t )))
746
+ (let ((first-child (clojure-ts-- node-child-skip-metadata parent 0 )))
747
747
(and
748
748
(not
749
749
(clojure-ts--symbol-matches-p
750
750
; ; Symbols starting with this are false positives
751
751
(rx line-start (or " default" " deflate" " defer" ))
752
752
first-child))
753
+ (not (clojure-ts--match-with-metadata node))
753
754
(clojure-ts--symbol-matches-p
754
755
clojure-ts--symbols-with-body-expressions-regexp
755
756
first-child)))))
@@ -821,6 +822,12 @@ forms like deftype, defrecord, reify, proxy, etc."
821
822
(clojure-ts--match-fn-docstring parent)
822
823
(clojure-ts--match-method-docstring parent))))
823
824
825
+ (defun clojure-ts--match-with-metadata (node &optional _parent _bol )
826
+ " Match NODE when it has metadata."
827
+ (let ((prev-sibling (treesit-node-prev-sibling node)))
828
+ (and prev-sibling
829
+ (clojure-ts--metadata-node-p prev-sibling))))
830
+
824
831
(defun clojure-ts--semantic-indent-rules ()
825
832
" Return a list of indentation rules for `treesit-simple-indent-rules' ."
826
833
`((clojure
@@ -833,6 +840,7 @@ forms like deftype, defrecord, reify, proxy, etc."
833
840
(clojure-ts--match-threading-macro-arg prev-sibling 0 )
834
841
; ; https://guide.clojure.style/#vertically-align-fn-args
835
842
(clojure-ts--match-function-call-arg (nth-sibling 2 nil ) 0 )
843
+ (clojure-ts--match-with-metadata parent 0 )
836
844
; ; Literal Sequences
837
845
((parent-is " list_lit" ) parent 1 ) ; ; https://guide.clojure.style/#one-space-indent
838
846
((parent-is " vec_lit" ) parent 1 ) ; ; https://guide.clojure.style/#bindings-alignment
0 commit comments