@@ -2592,6 +2592,30 @@ before DELIM-OPEN."
25922592 :anchor ((sym_lit) @defun-candidate)))))
25932593 " Query that matches top-level definitions." )
25942594
2595+ (defconst clojure-ts--completion-query-ns
2596+ (treesit-query-compile
2597+ 'clojure
2598+ '(((source (list_lit
2599+ :anchor [(comment) (meta_lit) (old_meta_lit)] :*
2600+ :anchor (sym_lit name: (sym_name) @sym)
2601+ ; ; require
2602+ (list_lit
2603+ :anchor ((kwd_lit) @kwd (:equal " :require" @kwd))
2604+ (vec_lit
2605+ :anchor (sym_lit)
2606+ [(sym_lit) @ns-alias-candidate
2607+ (vec_lit (sym_lit) @defun-candidate)]))))
2608+ (:equal " ns" @sym))
2609+ ((source (list_lit
2610+ :anchor [(comment) (meta_lit) (old_meta_lit)] :*
2611+ :anchor (sym_lit name: (sym_name) @sym)
2612+ ; ; import
2613+ (((list_lit
2614+ :anchor ((kwd_lit) @kwd (:equal " :import" @kwd))
2615+ (list_lit :anchor (sym_lit) (sym_lit) @import-candidate))))))
2616+ (:equal " ns" @sym))))
2617+ " Query that matches all imported symbols in a Clojure ns form." )
2618+
25952619(defconst clojure-ts--completion-query-keywords
25962620 (treesit-query-compile 'clojure '((kwd_lit) @keyword-candidate))
25972621 " Query that matches any Clojure keyword." )
@@ -2634,7 +2658,9 @@ bindings vector as well as destructuring syntax.")
26342658(defconst clojure-ts--completion-annotations
26352659 (list 'defun-candidate " Definition"
26362660 'local-candidate " Local variable"
2637- 'keyword-candidate " Keyword" )
2661+ 'keyword-candidate " Keyword"
2662+ 'ns-alias-candidate " Namespace alias"
2663+ 'import-candidate " Class" )
26382664 " Property list of completion candidate type and annotation string." )
26392665
26402666(defun clojure-ts--completion-annotation-function (candidate )
@@ -2691,6 +2717,7 @@ all let bindings found along the way."
26912717 (source (treesit-buffer-root-node 'clojure ))
26922718 (nodes (append (treesit-query-capture source clojure-ts--completion-query-defuns)
26932719 (treesit-query-capture source clojure-ts--completion-query-keywords)
2720+ (treesit-query-capture source clojure-ts--completion-query-ns)
26942721 (clojure-ts--completion-fn-args-nodes)
26952722 (clojure-ts--completion-let-locals-nodes))))
26962723 (list (car bounds)
0 commit comments