Skip to content

Commit 335af4e

Browse files
committed
Merge branch dev into published
2 parents cfac062 + 28351dd commit 335af4e

File tree

8 files changed

+48
-18
lines changed

8 files changed

+48
-18
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Changes to Calva.
44

55
## [Unreleased]
66

7+
## [2.0.476] - 2024-09-28
8+
9+
- Fix: [Formatting and some pretty printing croaks on new Clojure 1.12.0 syntax](https://github.com/BetterThanTomorrow/calva/issues/2637)
10+
711
## [2.0.475] - 2024-09-24
812

913
- Fix: [Can't start REPL in lein projects with backtick on project.clj](https://github.com/BetterThanTomorrow/calva/issues/2633)

deps.edn

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
{:deps {zprint/zprint {:mvn/version "1.2.9"}
2-
dev.weavejester/cljfmt {:mvn/version "0.12.0"}
3-
thheller/shadow-cljs {:mvn/version "2.25.2"}
4-
org.clojars.liverm0r/dartclojure {:mvn/version "0.2.22-SNAPSHOT"}
1+
{:deps {org.clojure/clojure {:mvn/version "1.12.0"}
2+
rewrite-clj/rewrite-clj {:mvn/version "1.1.48"} ;; Temporary, while waiting for cljfmt and zprint to bump their deps
3+
zprint/zprint {:mvn/version "1.2.9"
4+
:exclusions [rewrite-clj/rewrite-clj]}
5+
dev.weavejester/cljfmt {:mvn/version "0.12.0"
6+
:exclusions [rewrite-clj/rewrite-clj]}
7+
thheller/shadow-cljs {:mvn/version "2.28.15"}
8+
org.clojars.liverm0r/dartclojure {:mvn/version "0.2.23-SNAPSHOT"}
59
vvvvalvalval/supdate {:mvn/version "0.2.3"}
610
camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.3"}
711
#_#_org.clojars.liverm0r/dartclojure {:local/root "../DartClojure"}}

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Calva: Clojure & ClojureScript Interactive Programming",
44
"description": "Integrated REPL, formatter, Paredit, and more. Powered by cider-nrepl and clojure-lsp.",
55
"icon": "assets/calva.png",
6-
"version": "2.0.475",
6+
"version": "2.0.476",
77
"publisher": "betterthantomorrow",
88
"author": {
99
"name": "Better Than Tomorrow",
@@ -3391,7 +3391,7 @@
33913391
"prettier": "2.5.1",
33923392
"rimraf": "^2.7.1",
33933393
"screenshot-desktop": "^1.15.0",
3394-
"shadow-cljs": "^2.25.2",
3394+
"shadow-cljs": "^2.28.15",
33953395
"source-map-support": "^0.5.16",
33963396
"ts-loader": "^8.0.18",
33973397
"ts-node": "^10.3.0",

src/cljs-lib/src/calva/fmt/formatter.cljs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@
8383
:indents {"foo" [["inner" 0]]}
8484
:remove-trailing-whitespace? false
8585
:remove-consecutive-blank-lines? false
86-
:align-associative? true}}}))
86+
:align-associative? true}}})
87+
88+
(format-text
89+
{:range-text "^[Long] foo"})
90+
91+
(format-text
92+
{:range-text "^Long/1 foo"}))
8793

8894
(defn extract-range-text
8995
[{:keys [all-text range]}]

src/cljs-lib/src/calva/pprint/printer.cljs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,10 @@
108108

109109
(:value (pretty-print struct {:max-length 3}))
110110
;; => "(let [r :r\n this-page :this-page]\n [:div.grid-x.grid-margin-x.grid-margin-y\n [:div.cell.align-center.margin-top.show-for-medium\n [:a#foo.button {:href \"#how-it-works\"} [\"Works\"]]\n [:a#bar.button {:on-click (fn* [] (citrus/broadcast! r :submit ...))}\n \"Send\"]]])"
111+
112+
(pretty-print "^[Long] foo" {})
113+
;;=> {:value "^[Long] foo"}
114+
115+
(pretty-print "^Long/1 foo" {})
116+
;;=> {:value "^Long/1 foo", :error "Pretty print failed. (Invalid symbol: Long/1.)"}
111117
)

src/cljs-lib/test/calva/fmt/formatter_test.cljs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
(ns calva.fmt.formatter-test
22
(:require [calva.fmt.formatter :as sut]
3-
[cljfmt.core :as cljfmt :refer [includes?]]
43
[cljs.test :include-macros true :refer [deftest is testing]]))
54

65
(deftest format-text-at-range
76
(is (= "(foo)\n(defn bar\n [x]\n baz)"
87
(:range-text (sut/format-text-at-range {:eol "\n" :all-text " (foo)\n(defn bar\n[x]\nbaz)" :range [2 26]}))))
98
(is (not (contains? (sut/format-text-at-range {:eol "\n" :all-text " (foo)\n(defn bar\n[x]\nbaz)" :range [2 26]}) :new-index))))
109

10+
(deftest clojure-1-12-syntax
11+
(is (= {:all-text "^Long/1 a", :range [1 10], :range-tail "Long/1 a", :range-text "Long/1 a"}
12+
(sut/format-text-at-range {:all-text "^Long/1 a" :range [1 10]})))
13+
(is (nil? (:error (sut/format-text-at-range {:all-text "^Long/1 a" :range [1 10]})))))
14+
1115
(def all-text " (foo)
1216
(defn bar
1317
[x]

src/cljs-lib/test/calva/pprint/printer_test.cljs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,10 @@
3838
(pretty-print "{:a 1, :b 1 :c 1}" nil))))
3939
(testing "Can opt out of added commas in maps"
4040
(is (= {:value "{:a 1 :b 1 :c 1}"}
41-
(pretty-print "{:a 1, :b 1 :c 1}" {:map {:comma? false}})))))))
41+
(pretty-print "{:a 1, :b 1 :c 1}" {:map {:comma? false}})))))))
42+
43+
(deftest clojure-1-12-syntax
44+
(testing "Valid EDN"
45+
(is (= {:value "^Long/1 a"}
46+
(pretty-print "^Long/1 a" nil)))
47+
(is (nil? (:error (pretty-print "^Long/1 a" nil))))))

0 commit comments

Comments
 (0)