Skip to content

Commit 3bda039

Browse files
committed
suggest-libspecs: fuly parse Elisp format
1 parent d916e2e commit 3bda039

File tree

6 files changed

+28
-6
lines changed

6 files changed

+28
-6
lines changed

CHANGELOG.md

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

33
## Unreleased
44

5+
## 3.7.1
6+
7+
* Fix an oversight in `suggest-libspecs`.
8+
59
## 3.7.0
610

711
* Implement new middleware op: `suggest-libspecs`

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ deploy: check-env .inline-deps
3939
jar: .inline-deps
4040
lein with-profile -user,+$(VERSION),+plugin.mranderson/config jar
4141

42-
# Usage: PROJECT_VERSION=3.7.0 make install
42+
# Usage: PROJECT_VERSION=3.7.1 make install
4343
# PROJECT_VERSION is needed because it's not computed dynamically
4444
install: check-install-env .inline-deps
45-
lein with-profile -user,+$(VERSION),+plugin.mranderson/config install
45+
LEIN_JVM_OPTS="-Dmranderson.internal.no-parallelism=true" lein with-profile -user,+$(VERSION),+plugin.mranderson/config install
4646

4747
check-env:
4848
ifndef CLOJARS_USERNAME

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Be aware that this isn't the case if you connect to an already running REPL proc
2626
Add the following, either in your project's `project.clj`, or in the `:user` profile found at `~/.lein/profiles.clj`:
2727

2828
```clojure
29-
:plugins [[refactor-nrepl "3.7.0"]
29+
:plugins [[refactor-nrepl "3.7.1"]
3030
[cider/cider-nrepl "0.31.0"]]
3131
```
3232

@@ -365,7 +365,7 @@ When you want to release locally to the following:
365365
And here's how to deploy to Clojars:
366366

367367
```bash
368-
git tag -a v3.7.0 -m "3.7.0"
368+
git tag -a v3.7.1 -m "3.7.1"
369369
git push --tags
370370
```
371371

src/refactor_nrepl/middleware.clj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,34 @@
3939
:err (with-out-str (print-cause-trace ex))
4040
:status #{status :done}})
4141

42+
;; TODO - simplify this. I don't fully get why there are disparate keys depending on the exception class.
43+
;; Ideally, users would always get a stacktrace (however noisy).
4244
(defmacro ^:private with-errors-being-passed-on [transport msg & body]
4345
`(try
4446
~@body
4547
(catch clojure.lang.ExceptionInfo e#
48+
(when (System/getProperty "refactor-nrepl.internal.pst")
49+
(-> e# .printStackTrace))
4650
(transport/send
4751
~transport (response-for ~msg :error (.toString e#) :status :done)))
4852
(catch IllegalArgumentException e#
53+
(when (System/getProperty "refactor-nrepl.internal.pst")
54+
(-> e# .printStackTrace))
4955
(transport/send
5056
~transport (response-for ~msg :error (.getMessage e#) :status :done)))
5157
(catch IllegalStateException e#
58+
(when (System/getProperty "refactor-nrepl.internal.pst")
59+
(-> e# .printStackTrace))
5260
(transport/send
5361
~transport (response-for ~msg :error (.getMessage e#) :status :done)))
5462
(catch Exception e#
63+
(when (System/getProperty "refactor-nrepl.internal.pst")
64+
(-> e# .printStackTrace))
5565
(transport/send
5666
~transport (response-for ~msg (err-info e# :refactor-nrepl-error))))
5767
(catch Error e#
68+
(when (System/getProperty "refactor-nrepl.internal.pst")
69+
(-> e# .printStackTrace))
5870
(transport/send
5971
~transport (response-for ~msg (err-info e# :refactor-nrepl-error))))))
6072

src/refactor_nrepl/ns/suggest_libspecs.clj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@
1616

1717
(def parse-preferred-aliases
1818
(memoize (fn parse-preferred-aliases* [preferred-aliases]
19-
(let [m (volatile! {})]
19+
(let [preferred-aliases (into []
20+
(map (fn [x]
21+
(into []
22+
(remove #{\. '. "."})
23+
x)))
24+
(read-string preferred-aliases))
25+
m (volatile! {})]
2026
(doseq [[prefix ns-name _only-keyword only] (mapv (partial mapv (comp symbol
2127
name)) ;; `name` for Clojure <= 1.9 compat
2228
preferred-aliases)

test/refactor_nrepl/ns/suggest_libspecs_test.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
(sut/suggest-libspecs-response {:lib-prefix lib-prefix
4040
:buffer-language-context buffer-lc
4141
:input-language-context input-lc
42-
:preferred-aliases preferred-aliases
42+
:preferred-aliases (some-> preferred-aliases pr-str)
4343
:namespace-aliases-fn (when (seq project-libspecs)
4444
;; if provided, replace `refactor-nrepl.ns.libspecs/namespace-aliases`
4545
;; with a mocked value, for test simplicity.

0 commit comments

Comments
 (0)