Skip to content

Commit e3ad29d

Browse files
committed
Fix semantic indentation of quoted functions
Fixes an error where quoted functions would not align correctly with semantic indentation. Adds an example test and updates the changelog
1 parent 0e6816e commit e3ad29d

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [#38]: Add support for `in-ns` forms in `clojure-ts-find-ns`.
66
- [#46]: Fix missing `comment-add` variable in `clojure-ts-mode-variables` mentioned in [#26]
77
- Add imenu support for `deftest` definitions.
8+
- Fix semantic indentation of quoted functions
89

910
## 0.2.2 (2024-02-16)
1011

clojure-ts-mode.el

+6-1
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,10 @@ with the markdown_inline grammar."
520520
"Return non-nil if NODE is a Clojure keyword."
521521
(string-equal "kwd_lit" (treesit-node-type node)))
522522

523+
(defun clojure-ts--quoted-var-node-p (node)
524+
"Return non-nil if NODE is a Clojure quoted."
525+
(string-equal "var_quoting_lit" (treesit-node-type node)))
526+
523527
(defun clojure-ts--named-node-text (node)
524528
"Gets the name of a symbol or keyword NODE.
525529
This does not include the NODE's namespace."
@@ -722,7 +726,8 @@ https://github.com/weavejester/cljfmt/blob/fb26b22f569724b05c93eb2502592dfc2de89
722726
(not (treesit-node-eq (treesit-node-child parent 1 t) node))
723727
(let ((first-child (treesit-node-child parent 0 t)))
724728
(or (clojure-ts--symbol-node-p first-child)
725-
(clojure-ts--keyword-node-p first-child)))))
729+
(clojure-ts--keyword-node-p first-child)
730+
(clojure-ts--quoted-var-node-p first-child)))))
726731

727732
(defun clojure-ts--match-expression-in-body (_node parent _bol)
728733
"Match NODE if it is an expression used in a body argument.

test/samples/indentation.clj

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
(clojure.core/filter even?
6161
(range 1 10))
6262

63+
(#'filter even?
64+
(range 10))
6365

6466
(filter
6567
even?

0 commit comments

Comments
 (0)