diff --git a/CHANGELOG.md b/CHANGELOG.md index e5cc7ed..4b24bb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## main (unreleased) +- Fix indentation of namespaced maps in `fixed` indentation style. - Add project root detection for ClojureCLR project. - Add missing `defstruct` semantic indentation rule. - Fix font-lock issues: duplicate query, missing `definline` metadata docstring. diff --git a/clojure-ts-mode.el b/clojure-ts-mode.el index d07bb19..40429d7 100644 --- a/clojure-ts-mode.el +++ b/clojure-ts-mode.el @@ -1219,10 +1219,11 @@ The possible values for this variable are (let ((first-child (treesit-node-child parent 0 t))) (clojure-ts--symbol-node-p first-child)))) parent 2) - ((parent-is "vec_lit") parent 1) - ((parent-is "map_lit") parent 1) - ((parent-is "list_lit") parent 1) - ((parent-is "set_lit") parent 2)))) + ((parent-is "^vec_lit$") parent 1) + ((parent-is "^map_lit$") parent 1) + ((parent-is "^list_lit$") parent 1) + ((parent-is "^set_lit$") parent 2) + ((parent-is "^ns_map_lit$") (nth-sibling 2) 1)))) (defvar clojure-ts--semantic-indent-rules-defaults '(("alt!" . ((:block 0))) diff --git a/test/clojure-ts-mode-indentation-test.el b/test/clojure-ts-mode-indentation-test.el index 2e27fbb..739dfa1 100644 --- a/test/clojure-ts-mode-indentation-test.el +++ b/test/clojure-ts-mode-indentation-test.el @@ -399,7 +399,12 @@ DESCRIPTION is a string with the description of the spec." [clojure.string :as str]) (:import (java.util Date - UUID)))")) + UUID)))") + + (when-indenting-fixed-it "should indent namespaced maps correctly" + " +#:foo{:bar 1 + :baz 2}")) (describe "clojure-ts-align" (it "should handle improperly indented content"