clojure-emacs / clj-refactor.el

A CIDER extension that provides powerful commands for refactoring Clojure code.
GNU General Public License v3.0
771 stars 111 forks source link

cljr-add-project-dependency document support for deps.edn #547

Open bo-tato opened 1 year ago

bo-tato commented 1 year ago

The docstring says Add a dependency to the project.clj file. so I thought it will only support lein, but I tried it on my deps.edn project and was pleasantly surprised it worked great :smile: Maybe change the docstring to Add a dependency to project.clj or deps.edn?

Also could maybe improve the error message a little in the case where it doesn't find the project file, maybe in cljr--add-project-dependency change it to something like:

(if-let ((project-file (cljr--project-file))
         (deps (cljr--project-with-deps-p project-file)))
    (cljr--update-file project-file
     ...)
  (error "no project file found"))

so it gives a clear error message with the reason rather than just nil isn't stringp in cljr--project-with-deps-p

velios commented 7 months ago

Also found this description confusing. I published the PR with a correction, I hope it will be accepted into the master.