@@ -608,6 +608,12 @@ with the markdown_inline grammar."
608608This does not include the NODE's namespace."
609609 (treesit-node-text (treesit-node-child-by-field-name node " name" )))
610610
611+ (defun clojure-ts--node-namespace-text (node )
612+ " Gets the namespace of a symbol or keyword NODE.
613+
614+ If there is no namespace, returns nil."
615+ (treesit-node-text (treesit-node-child-by-field-name node " namespace" )))
616+
611617(defun clojure-ts--symbol-named-p (expected-symbol-name node )
612618 " Return non-nil if NODE is a symbol with text matching EXPECTED-SYMBOL-NAME."
613619 (and (clojure-ts--symbol-node-p node)
@@ -909,8 +915,8 @@ and (:defn) is converted to (:inner 1)."
909915 ((equal spec :defn ) (list :inner current-depth))
910916 (t nil ))))
911917
912- (defun clojure-ts--dynamic-indent-for-symbol (symbol-name )
913- " Returns the dynamic indentation specification for SYMBOL-NAME , if found.
918+ (defun clojure-ts--dynamic-indent-for-symbol (sym &optional ns )
919+ " Returns the dynamic indentation specification for SYM , if found.
914920
915921If the function `clojure-ts-get-indent-function' is defined, call it and
916922produce a valid indentation specification from its return value.
@@ -919,9 +925,15 @@ The `clojure-ts-get-indent-function' should return an indentation
919925specification compatible with `clojure-mode' , which will then be
920926converted to a suitable `clojure-ts-mode' specification.
921927
922- For example, (1 ((:defn)) nil) is converted to ((:block 1) (:inner 2))."
928+ For example, (1 ((:defn)) nil) is converted to ((:block 1) (:inner 2)).
929+
930+ If NS is defined, then the fully qualified symbol is passed to
931+ `clojure-ts-get-indent-function' ."
923932 (when (functionp clojure-ts-get-indent-function)
924- (let ((spec (funcall clojure-ts-get-indent-function symbol-name)))
933+ (let* ((full-symbol (if ns
934+ (concat ns " /" sym)
935+ sym))
936+ (spec (funcall clojure-ts-get-indent-function full-symbol)))
925937 (if (integerp spec)
926938 (list (list :block spec))
927939 (when (sequencep spec)
@@ -948,8 +960,9 @@ root of the syntax tree, it returns nil. A rule is considered a match
948960only if the CURRENT-DEPTH matches the rule's required depth."
949961 (let* ((first-child (clojure-ts--node-child-skip-metadata parent 0 ))
950962 (symbol-name (clojure-ts--named-node-text first-child))
963+ (symbol-namespace (clojure-ts--node-namespace-text first-child))
951964 (idx (- (treesit-node-index node) 2 )))
952- (if-let* ((rule-set (or (clojure-ts--dynamic-indent-for-symbol symbol-name)
965+ (if-let* ((rule-set (or (clojure-ts--dynamic-indent-for-symbol symbol-name symbol-namespace )
953966 (alist-get symbol-name
954967 (seq-union clojure-ts-semantic-indent-rules
955968 clojure-ts--semantic-indent-rules-defaults
0 commit comments