Skip to content

Commit 0eb5ec6

Browse files
[inspect] Tidy qualified keywords
1 parent ceb934c commit 0eb5ec6

File tree

3 files changed

+44
-4
lines changed

3 files changed

+44
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
* Bump `orchard` to [0.37.0](https://github.com/clojure-emacs/orchard/blob/master/CHANGELOG.md#0370-2025-09-19).
66
* Bump `compliment` to [0.7.1](https://github.com/alexander-yakushev/compliment/blob/master/CHANGELOG.md#071-2025-09-19).
7+
* [#950](https://github.com/clojure-emacs/cider-nrepl/pull/950): Inspect: support tidying qualified keywords.
78

89
## 0.57.0 (2025-06-29)
910

src/cider/nrepl/middleware/inspect.clj

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,15 @@
3939
m keys))
4040

4141
(defn- msg->inspector-config [msg]
42-
(-> (select-keys msg [:page-size :max-atom-length :max-coll-size
43-
:max-value-length :max-nested-depth :display-analytics-hint
44-
:pretty-print :sort-maps :only-diff])
45-
(booleanize [:pretty-print :sort-maps :only-diff])))
42+
(as-> msg config
43+
(select-keys config [:page-size :sort-maps :max-atom-length :max-coll-size
44+
:max-value-length :max-nested-depth :pretty-print
45+
:display-analytics-hint :only-diff])
46+
(booleanize config [:pretty-print :sort-maps :only-diff])
47+
(let [pov-ns (when (= (:tidy-qualified-keywords msg) "true")
48+
(some-> msg :ns symbol))]
49+
(cond-> config
50+
pov-ns (assoc :pov-ns pov-ns)))))
4651

4752
(defn inspect-reply* [{:keys [view-mode] :as msg} value]
4853
(let [config (msg->inspector-config msg)

test/clj/cider/nrepl/middleware/inspect_test.clj

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,40 @@
554554
" ●normal table object pretty sort-maps"]
555555
(value-skip-header (session/message {:op "inspect-toggle-pretty-print"}))))))
556556

557+
(deftest tidy-qualified-keywords-integration-test
558+
(testing "tidy keywords disabled"
559+
(is+ ["--- Contents:" [:newline]
560+
" 0. " [:value ":cider.nrepl.middleware.inspect-test/own-kw" pos?]]
561+
(-> (session/message {:op "eval"
562+
:inspect "true"
563+
:ns "cider.nrepl.middleware.inspect-test"
564+
:code "[::own-kw]"})
565+
value (section "Contents")))
566+
(is+ ["--- Contents:" [:newline]
567+
" 0. " [:value ":clojure.string/alias-kw" pos?]]
568+
(-> (session/message {:op "eval"
569+
:inspect "true"
570+
:ns "cider.nrepl.middleware.inspect-test"
571+
:code "[::str/alias-kw]"})
572+
value (section "Contents"))))
573+
(testing "tidy keywords enabled"
574+
(is+ ["--- Contents:" [:newline]
575+
" 0. " [:value "::own-kw" pos?]]
576+
(-> (session/message {:op "eval"
577+
:inspect "true"
578+
:tidy-qualified-keywords "true"
579+
:ns "cider.nrepl.middleware.inspect-test"
580+
:code "[::own-kw]"})
581+
value (section "Contents")))
582+
(is+ ["--- Contents:" [:newline]
583+
" 0. " [:value "::str/alias-kw" pos?]]
584+
(-> (session/message {:op "eval"
585+
:inspect "true"
586+
:tidy-qualified-keywords "true"
587+
:ns "cider.nrepl.middleware.inspect-test"
588+
:code "[::str/alias-kw]"})
589+
value (section "Contents")))))
590+
557591
(deftest print-length-independence-test
558592
(testing "*print-length* doesn't break rendering of long collections"
559593
(is (re-find #"showing page: \d+ of \d+"

0 commit comments

Comments
 (0)