Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 3.9.1

* `suggest-libspecs` op: support collections for `:only` values.

## 3.9.0

* [#401](https://github.com/clojure-emacs/refactor-nrepl/issues/401) `resolve-missing` no longer returns the wrong type
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ deploy: check-env .inline-deps
jar: .inline-deps
lein with-profile -user,-dev,+$(VERSION),+plugin.mranderson/config jar

# Usage: PROJECT_VERSION=3.9.0 make install
# Usage: PROJECT_VERSION=3.9.1 make install
# PROJECT_VERSION is needed because it's not computed dynamically
install: check-install-env .inline-deps
LEIN_JVM_OPTS="-Dmranderson.internal.no-parallelism=true" lein with-profile -user,-dev,+$(VERSION),+plugin.mranderson/config install
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Be aware that this isn't the case if you connect to an already running REPL proc
Add the following, either in your project's `project.clj`, or in the `:user` profile found at `~/.lein/profiles.clj`:

```clojure
:plugins [[refactor-nrepl "3.9.0"]
:plugins [[refactor-nrepl "3.9.1"]
[cider/cider-nrepl "0.31.0"]]
```

Expand Down Expand Up @@ -371,7 +371,7 @@ When you want to release locally to the following:
And here's how to deploy to Clojars:

```bash
git tag -a v3.9.0 -m "3.9.0"
git tag -a v3.9.1 -m "3.9.1"
git push --tags
```

Expand Down
4 changes: 2 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
^:inline-dep [org.clojure/tools.analyzer.jvm "1.2.3"]
^:inline-dep [org.clojure/tools.namespace "1.4.4" :exclusions [org.clojure/tools.reader]]
^:inline-dep [org.clojure/tools.reader "1.3.6"]
^:inline-dep [cider/orchard "0.12.0"]
^:inline-dep [cider/orchard "0.21.0"]
^:inline-dep [cljfmt "0.9.2" :exclusions [rewrite-clj rewrite-cljs]]
^:inline-dep [clj-commons/fs "1.6.310"]
^:inline-dep [rewrite-clj "1.1.47"]
Expand All @@ -34,7 +34,7 @@
:unresolved-tree false}
:filespecs [{:type :bytes :path "refactor-nrepl/refactor-nrepl/project.clj" :bytes ~(slurp "project.clj")}]
:profiles {;; Clojure versions matrix
:provided {:dependencies [[cider/cider-nrepl "0.31.0"]
:provided {:dependencies [[cider/cider-nrepl "0.44.0"]
[org.clojure/clojure "1.11.1"]
;; For satisfying `:pedantic?`:
[com.google.code.findbugs/jsr305 "3.0.2"]
Expand Down
6 changes: 4 additions & 2 deletions src/refactor_nrepl/find/find_locals.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
[refactor-nrepl.core :as core]
[refactor-nrepl.s-expressions :as sexp]))

(defn find-used-locals [{:keys [file ^long line ^long column]}]
(defn find-used-locals [{:keys [file line column]}]
{:pre [(number? line)
(number? column)
(not-empty file)]}
(core/throw-unless-clj-file file)
(let [content (slurp file)
(let [line (long line)
column (long column)
content (slurp file)
ast (ana/ns-ast content)
sexp (sexp/get-enclosing-sexp content (dec line) (dec column))
selected-sexp-node (->> ast
Expand Down
10 changes: 8 additions & 2 deletions src/refactor_nrepl/ns/suggest_libspecs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
(conj coll x)
[x]))

(def to-sym
(comp symbol
name)) ;; `name` for Clojure <= 1.9 compat

(def parse-preferred-aliases
(memoize (fn parse-preferred-aliases* [preferred-aliases]
(let [preferred-aliases (into []
Expand All @@ -23,8 +27,10 @@
x)))
(read-string preferred-aliases))
m (volatile! {})]
(doseq [[prefix ns-name _only-keyword only] (mapv (partial mapv (comp symbol
name)) ;; `name` for Clojure <= 1.9 compat
(doseq [[prefix ns-name _only-keyword only] (mapv (partial mapv (fn [x]
(cond->> x
(coll? x) (mapv to-sym)
(not (coll? x)) to-sym)))
preferred-aliases)
:let [files (ns-parser/ns-sym->ns-filenames ns-name)
only (or only [:clj :cljs])
Expand Down
4 changes: 3 additions & 1 deletion test/refactor_nrepl/ns/suggest_libspecs_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@
clojure.set]}} ["[something-else :as set]" "[clojure.set :as set]"]

;; Story 4:
"io" "clj" "clj" [["io" "clojure.java.io" :only :clj]] '{:cljs {io [something-else]}} ["[clojure.java.io :as io]"]
"io" "clj" "clj" [["io" "clojure.java.io" :only :clj]] '{:cljs {io [something-else]}} ["[clojure.java.io :as io]"]
;; https://github.com/clojure-emacs/clj-refactor.el/issues/556 :
"io" "clj" "clj" [["io" "clojure.java.io" :only [:clj]]] '{:cljs {io [something-else]}} ["[clojure.java.io :as io]"]
;; Story 5:
"io" "clj" "clj" [["io" "clojure.java.io" :only :clj]] '{:clj {io [something-else]}} ["[something-else :as io]"]
"io" "clj" "clj" [["io" "something-else" :only :cljs]] {} ["[clojure.java.io :as io]"]
Expand Down