summaryrefslogtreecommitdiff
path: root/vendor/queries/clojure
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 03:35:02 -0300
committerGabriel Schneider <[email protected]>2026-11-10 04:08:16 -0300
commite398c24ba19948727affdc6a29254ac69a6b7699 (patch)
tree0770792049a135447b54be2a52367233e786c654 /vendor/queries/clojure
parent22b981446238977d9c3f85eb4856324a9daa9753 (diff)
downloadpardes-e398c24ba19948727affdc6a29254ac69a6b7699.tar.gz
pardes-e398c24ba19948727affdc6a29254ac69a6b7699.zip
syntax: helix's indents.scm vendored beside each grammar's textobjects.scm and embedded the same way (zig's adapted to this grammar's node names, rust's \A regexes written with ^, erlang's left out as it does not compile here), compiled when first asked for as a Lazy beside the textobjects, so a new line can take its indent from the tree
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'vendor/queries/clojure')
-rw-r--r--vendor/queries/clojure/indents.scm65
1 files changed, 65 insertions, 0 deletions
diff --git a/vendor/queries/clojure/indents.scm b/vendor/queries/clojure/indents.scm
new file mode 100644
index 00000000..5c232fc9
--- /dev/null
+++ b/vendor/queries/clojure/indents.scm
@@ -0,0 +1,65 @@
+; Vendored from helix (https://github.com/helix-editor/helix) at 278b24389:
+; runtime/queries/clojure/indents.scm.
+; Licensed under the Mozilla Public License 2.0 (vendor/queries/helix.LICENSE,
+; https://mozilla.org/MPL/2.0/).
+
+; If a list has 2 elements on the first line, align to the second element.
+; Exclude literals and special keywords that have different indentation rules.
+(list_lit . (_) @first . (_) @anchor
+ (#same-line? @first @anchor)
+
+ (#not-kind-eq? @first "bool_lit")
+ (#not-kind-eq? @first "nil_lit")
+ (#not-kind-eq? @first "str_lit")
+ (#not-kind-eq? @first "num_lit")
+ (#not-kind-eq? @first "kwd_lit")
+ (#not-match? @first "^(def|defn|defn-|defmacro|defmethod|defmulti|defonce|defprotocol|deftype|defrecord|defstruct|definline|definterface|deftest|ns|let|letfn|binding|loop|for|doseq|dotimes|when-let|if-let|when-some|if-some|with-.*|fn)$")) @align
+
+; If the first element in a list is also a list and on a line by itself,
+; the outer list is aligned to it
+(list_lit . (list_lit) @anchor .
+ ) @align
+
+(list_lit . (list_lit) @anchor . (_) @second
+ (#not-same-line? @anchor @second)
+ ) @align
+
+; If the first element in a list is not a list and on a line by itself,
+; indent the list body by one level
+(list_lit . (_) @first .
+ (#not-kind-eq? @first "bool_lit")
+ (#not-kind-eq? @first "nil_lit")
+ (#not-kind-eq? @first "str_lit")
+ (#not-kind-eq? @first "num_lit")
+ (#not-kind-eq? @first "kwd_lit")
+ (#not-match? @first "^(def|defn|defn-|defmacro|defmethod|defmulti|defonce|defprotocol|deftype|defrecord|defstruct|definline|definterface|deftest|ns|let|letfn|binding|loop|for|doseq|dotimes|when-let|if-let|when-some|if-some|with-.*|fn)$")) @indent
+
+(list_lit . (_) @first . (_) @second
+ (#not-same-line? @first @second)
+ (#not-kind-eq? @first "bool_lit")
+ (#not-kind-eq? @first "nil_lit")
+ (#not-kind-eq? @first "str_lit")
+ (#not-kind-eq? @first "num_lit")
+ (#not-kind-eq? @first "kwd_lit")
+ (#not-match? @first "^(def|defn|defn-|defmacro|defmethod|defmulti|defonce|defprotocol|deftype|defrecord|defstruct|definline|definterface|deftest|ns|let|letfn|binding|loop|for|doseq|dotimes|when-let|if-let|when-some|if-some|with-.*|fn)$")) @indent
+
+; If the first element is a literal, align the list to it
+(list_lit . [(bool_lit) (nil_lit) (str_lit) (num_lit) (kwd_lit)] @anchor
+ ) @align
+
+; Special indentation for def-like forms, let bindings, and other special forms
+; These forms typically have the body indented by one level after the name/bindings
+(list_lit . (sym_lit) @first
+ (#match? @first "^(def|defn|defn-|defmacro|defmethod|defmulti|defonce|defprotocol|deftype|defrecord|defstruct|definline|definterface|deftest|ns|let|letfn|binding|loop|for|doseq|dotimes|when-let|if-let|when-some|if-some|with-.*|fn)$")) @indent
+
+; Align vector/map elements when first two are on same line (e.g., let bindings)
+(vec_lit . (_) @anchor . (_) @second
+ (#same-line? @anchor @second)
+ ) @align
+
+(map_lit . (_) @anchor . (_) @second
+ (#same-line? @anchor @second)
+ ) @align
+
+; Indent vectors, maps, and sets
+[(vec_lit) (map_lit) (set_lit)] @indent