@@ -214,7 +214,7 @@ if the candidate is not namespace-qualified."
214
214
(defvar cider-required-nrepl-ops
215
215
'(" apropos" " classpath" " complete" " eldoc" " format-code" " format-edn" " info"
216
216
" inspect-pop" " inspect-push" " inspect-refresh"
217
- " macroexpand" " ns-list" " ns-vars"
217
+ " macroexpand" " ns-list" " ns-vars" " refresh "
218
218
" resource" " stacktrace" " toggle-trace-var" " toggle-trace-ns" " undef" )
219
219
" A list of nREPL ops required by CIDER to function properly.
220
220
@@ -1947,12 +1947,27 @@ opposite of what that option dictates."
1947
1947
" symbol" sym)
1948
1948
(cider-interactive-eval-handler (current-buffer ))))))
1949
1949
1950
- (defun cider-refresh ()
1951
- " Refresh loaded code."
1952
- (interactive )
1953
- (cider-tooling-eval
1954
- " (clojure.core/require 'clojure.tools.namespace.repl) (clojure.tools.namespace.repl/refresh)"
1955
- (cider-interactive-eval-handler (current-buffer ))))
1950
+ (defun cider-refresh--handle-response (response )
1951
+ (nrepl-dbind-response response (reloading status error error-ns)
1952
+ (cond (reloading
1953
+ (message " Reloading: %s " reloading))
1954
+ ((member " ok" status)
1955
+ (message " Reloading successful " ))
1956
+ ((member " error" status)
1957
+ (progn (message " Error reloading %s " error-ns)
1958
+ (cider--render-stacktrace-causes error ))))))
1959
+
1960
+ (defun cider-refresh (&optional arg )
1961
+ " Reload modified and unloaded namespaces on the classpath.
1962
+
1963
+ With a non-nil prefix ARG, reload all namespaces on the classpath
1964
+ unconditionally."
1965
+ (interactive " P" )
1966
+ (cider-ensure-op-supported " refresh" )
1967
+ (nrepl-send-request (list " op" (if arg " refresh-all" " refresh" )
1968
+ " print-length" cider-stacktrace-print-length
1969
+ " print-level" cider-stacktrace-print-level)
1970
+ #'cider-refresh--handle-response ))
1956
1971
1957
1972
(defun cider-file-string (file )
1958
1973
" Read the contents of a FILE and return as a string."
0 commit comments