Skip to content

Misc fixes #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 25, 2021
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

## Unreleased

* [clojure-emacs/clj-refactor.el#459](https://github.com/clojure-emacs/clj-refactor.el/issues/459): `clean-ns` should conform to the style guide: `(:require` in the ns form should be followed by a newline.
* [#294](https://github.com/clojure-emacs/refactor-nrepl/pull/294): Properly skip uneval nodes when looking for the first/last sexp
* From now on, if you set the `clojure.tools.namespace.repl/refresh-dirs`, files outside said `refresh-dirs` won't be analyzed, resulting in safer, more efficient analysis.


## 2.5.1 (2021-02-16)

### Bugs fixed
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject refactor-nrepl "2.5.1"
(defproject refactor-nrepl "3.0.0-SNAPSHOT"
:description "nREPL middleware to support editor-agnostic refactoring"
:url "http://github.com/clojure-emacs/refactor-nrepl"
:license {:name "Eclipse Public License"
Expand Down
4 changes: 2 additions & 2 deletions src/refactor_nrepl/artifacts.clj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

;; structure here is {"prismatic/schem" ["0.1.1" "0.2.0" ...]}
(defonce artifacts (atom (if (.exists (io/as-file artifacts-file))
(->> artifacts-file slurp edn/read-string (into (sorted-map)))
(->> artifacts-file slurp edn/read-string (into {}))
{})
:meta {:last-modified
(get-last-modified-from-file artifacts-file)}))
Expand Down Expand Up @@ -107,7 +107,7 @@
(defn- get-artifacts-from-clojars!
[]
(reduce #(update %1 (str (first %2)) conj (second %2))
(sorted-map)
{}
(get-clojars-artifacts!)))

(defn- update-artifact-cache!
Expand Down
2 changes: 1 addition & 1 deletion src/refactor_nrepl/ns/pprint.clj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

(defn pprint-require-form
[[_ & libspecs]]
(print "(:require ")
(print "(:require\n")
(dorun
(map-indexed
(fn [idx libspec]
Expand Down
23 changes: 12 additions & 11 deletions test/resources/artifacts_pprinted
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
(ns refactor-nrepl.artifacts
(:require [clojure
[edn :as edn]
[string :as str]]
[clojure.data.json :as json]
[clojure.java.io :as io]
[nrepl
[middleware :refer [set-descriptor!]]
[misc :refer [response-for]]
[transport :as transport]]
[org.httpkit.client :as http]
[refactor-nrepl.externs :refer [add-dependencies]])
(:require
[clojure
[edn :as edn]
[string :as str]]
[clojure.data.json :as json]
[clojure.java.io :as io]
[nrepl
[middleware :refer [set-descriptor!]]
[misc :refer [response-for]]
[transport :as transport]]
[org.httpkit.client :as http]
[refactor-nrepl.externs :refer [add-dependencies]])
(:import java.util.Date))
12 changes: 5 additions & 7 deletions test/resources/ns1_cleaned_and_pprinted
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
:name com.domain.tiny
:extends java.lang.Exception
:methods [[binomial [int int] double]])
(:require [clojure data edn xml
[instant :as inst :reload true]
[pprint :refer [cl-format formatter get-pretty-writer]]
[string :refer :all :reload-all true]
[test :refer :all]
[walk :refer [postwalk prewalk]]]
clojure.test.junit)
(:require
[clojure data edn xml
[pprint :refer [cl-format formatter get-pretty-writer]]
[walk :refer [postwalk prewalk]]]
clojure.test.junit)
(:import [java.io Closeable FilenameFilter PushbackReader]
[java.util Calendar Date Random]
[refactor.nrepl SomeClass$InnerClass$InnerInnerClassOne SomeClass$InnerClass$InnerInnerClassTwo]))
3 changes: 2 additions & 1 deletion test/resources/ns_with_gen_class_methods_meta_clean.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
^:test [bar [String] String]
^{:other "text"} [baz [String] String]]
:name Name)
(:require [clojure.pprint :refer [fresh-line]]))
(:require
[clojure.pprint :refer [fresh-line]]))
3 changes: 2 additions & 1 deletion test/resources/ns_with_lots_of_meta_clean.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
^:test [bar [String] String]
^{:other "text"} [baz [String] String]]
:name Name)
(:require [clojure.pprint :refer [fresh-line]]))
(:require
[clojure.pprint :refer [fresh-line]]))