Fork me on GitHub
#editors
<
2022-11-16
>
martinklepsch15:11:07

Anyone know tools to rename namespaces in a codebase? (should include moving of file + updating all references)

pez16:11:16

I think I've seen it done using Cursive. Iirc it was an action on the renamed namespace symbol. So first edit that and then invoke this action. I could be remembering it wrong. Saw it in a pair programming session.

pez16:11:09

In theory you should be able to do it with clojure-lsp, refactor -> rename. But I seem to recall some issue with that...

vemv17:11:19

https://github.com/clojure-emacs/refactor-nrepl#rename-file-or-dir works fairly decently. you can invoke it from a repl like any other lib

snoe16:11:15

It should work with clojure-lsp. If there is a problem hopefully we can get it captured as an issue.

martinklepsch17:11:38

@U0BUV7XSA I’m super new to clojure-lsp, could you point me towards how I could do this?

pez17:11:06

Calva is an easy way to do it with clojure-lsp.

pez17:11:03

Have the cursor in the namespace symbol and press F2, write the new name, submit with enter. (EDITED, because I mis-remembered).

👆 1
snoe17:11:31

Editor's are responsible for how rename is called so that it can fit into their own ways of doing things. coc.nvim suggests nmap <leader>rn <Plug>(coc-rename) for instance, but if you are picking an editor calva is certainly the least amount of setup.