Fork me on GitHub
#cider
<
2020-04-15
>
David Pham05:04:14

Is there an easy way to rename a namespace in a whole codebase? Say I had namespace foo.baz required everywhere and I want to rename it foo.baz2

yuhan05:04:32

clj-refactor has a command for that but it requires your entire project to be analyzed and loadable, usually I just go with something like ivy-occur and do a text-based search and replace

bozhidar06:04:28

I just use projectile’s replace in project functionality.

Mitch15:04:50

slightly related: I think it would be nice to have a refactor to toggle between usage of a namespace alias and a refer

bozhidar15:04:02

I’m not sure exactly what you mean, but you can file a ticket on clojure-mode issue tracker.

Mitch16:04:38

Say I have

(ns foo.core (:require [clojure.string :as str]))

(str/join ", " [1 2 3])
Calling "`cljr-toggle-refer`" or whatever its name would be with the mark on str/join would change our buffer to
(ns foo.core (:require [clojure.string :refer [join]]))

(join ", " [1 2 3])

bozhidar18:04:18

Got it. Well, file a ticket please, and we’ll see if we’ll get to implementing this.