Fork me on GitHub
#vim
<
2023-01-20
>
emilaasa07:01:31

Is there a neovim interface to do refactorings like moving a namespace? I quite often start out working with one file, get something working, maybe add a few tests and a few usages to my nice new namespace. Then I realize I should go from my single pizza.clj file to pizza/toppings.clj , pizza/ordering.clj and so on, and I would like a smooth refactoring experience to do this. Any advice?

sheluchin10:01:43

Looks like clojure-lsp has support for this https://github.com/clojure-lsp/clojure-lsp/pull/1123. I think it's done through textDocument/rename.

ericdallo12:01:30

if you just want to rename the namespace updating all usages, then LSP rename is the way and works pretty well, if you wanna manually move a function to another ns, you have move-form command but it's pretty experimental yet

👀 2
mars0i20:01:45

vim-iced can do some sorts of refactoring: https://liquidz.github.io/vim-iced/#refactoring

Carl00:01:08

@UKFSJSM38 Should there be a move-form code action when your cursor is on a function definition? I am using version 2022.12.09-15.51.10 and don't see it under code actions.

ericdallo00:01:01

Not yet, the feature is available only via commands, it doesn't support some cases yet, there is a issue open to support other cases but there are too many corner cases