@@ -118,9 +118,17 @@ namespace-qualified function of zero arity."
118
118
:group 'cider
119
119
:package-version '(cider . " 0.10.0" ))
120
120
121
+ (defcustom cider-ns-refresh-tool 'tools .namespace
122
+ " Which tool to use for ns refresh.
123
+ Current options: tools.namespace and clj-reload."
124
+ :group 'cider
125
+ :type '(choice (const :tag " tools.namespace https://github.com/clojure/tools.namespace" tools-namespace)
126
+ (const :tag " clj-reload https://github.com/tonsky/clj-reload" clj-reload))
127
+ :package-version '(cider . " 1.13.1" ))
128
+
121
129
(defun cider-ns-refresh--handle-response (response log-buffer )
122
130
" Refresh LOG-BUFFER with RESPONSE."
123
- (nrepl-dbind-response response (out err reloading status error error-ns after before)
131
+ (nrepl-dbind-response response (out err reloading progress status error error-ns after before)
124
132
(cl-flet* ((log (message &optional face)
125
133
(cider-emit-into-popup-buffer log-buffer message face t ))
126
134
@@ -148,6 +156,9 @@ namespace-qualified function of zero arity."
148
156
(reloading
149
157
(log-echo (format " Reloading %s \n " reloading) 'font-lock-string-face ))
150
158
159
+ (progress
160
+ (log-echo progress 'font-lock-string-face ))
161
+
151
162
((member " reloading" (nrepl-dict-keys response))
152
163
(log-echo " Nothing to reload\n " 'font-lock-string-face ))
153
164
@@ -186,6 +197,19 @@ Its behavior is controlled by `cider-ns-save-files-on-refresh' and
186
197
(file-in-directory-p buffer-file-name dir))
187
198
dirs)))))))
188
199
200
+ (defun cider-ns-refresh--refresh-op (op-name )
201
+ " Return the refresh operation to use.
202
+ Based on OP-NAME and the value of cider-ns-refresh-tool defcustom."
203
+ (list " op"
204
+ (cond
205
+ ((eq cider-ns-refresh-tool 'tools .namespace)
206
+ op-name)
207
+
208
+ ((eq cider-ns-refresh-tool 'clj-reload )
209
+ (cond ((string= op-name " refresh" ) " cider.clj-reload/reload" )
210
+ ((string= op-name " refresh-all" ) " cider.clj-reload/reload-all" )
211
+ ((string= op-name " refresh-clear" ) " cider.clj-reload/reload-clear" ))))))
212
+
189
213
;;;### autoload
190
214
(defun cider-ns-reload (&optional prompt )
191
215
" Send a (require 'ns :reload) to the REPL.
@@ -237,6 +261,7 @@ refresh functions (defined in `cider-ns-refresh-before-fn' and
237
261
(interactive " p" )
238
262
(cider-ensure-connected)
239
263
(cider-ensure-op-supported " refresh" )
264
+ (cider-ensure-op-supported " cider.clj-reload/reload" )
240
265
(cider-ns-refresh--save-modified-buffers)
241
266
(let ((clear? (member mode '(clear 16 )))
242
267
(refresh-all? (member mode '(refresh-all 4 )))
@@ -254,11 +279,11 @@ refresh functions (defined in `cider-ns-refresh-before-fn' and
254
279
nil
255
280
t ))
256
281
(when clear?
257
- (cider-nrepl-send-sync-request '( " op " " refresh-clear" ) conn))
282
+ (cider-nrepl-send-sync-request (cider-ns-refresh--refresh-op " refresh-clear" ) conn))
258
283
(cider-nrepl-send-request
259
284
(thread-last
260
285
(map-merge 'list
261
- `(( " op " , (if refresh-all? " refresh-all" " refresh" )))
286
+ `(,(cider-ns-refresh--refresh-op (if refresh-all? " refresh-all" " refresh" )))
262
287
(cider--nrepl-print-request-map fill-column)
263
288
(when (and (not inhibit-refresh-fns) cider-ns-refresh-before-fn)
264
289
`((" before" , cider-ns-refresh-before-fn )))
0 commit comments