Fork me on GitHub
#vim
<
2022-08-11
>
sheluchin19:08:46

Is there an easy way to rename a keyword project-wide without messing up indents? Also taking into account namespace aliases and destructuring.

ribelo20:08:48

lsp can do that

sheluchin21:08:44

I'm not sure exactly how to test that from the CLI, but when I try using the rename functionality in my Neovim I get inconsistent results: For example:

(let [{:foo/keys [bar]} {:fo|o/bar 1}]
  bar)
produces:
(let [{:foo/keys [baz]} {:foo/baz 1}]
  bar)

ribelo21:08:42

the plus side is that I also use neovim

ribelo21:08:02

but does not really understand what you would like to change

ribelo21:08:51

if you want change :foo/bar and want to change`[bar]` also, it will not work 😞

ribelo21:08:00

although in theory such a function is supported

sheluchin21:08:45

The bindings in the let form are updated, but the change introduces an undefined var in the let body this way. The end result is broken code. If it produces changes like this I think it's safer to go through and make the substitutions manually.

sheluchin21:08:05

I think I've seen cases where it doesn't keep the right indentation as well. Maybe it's conflicting with my rust-parinfer or something? I wonder if this is one of those operations for which it's better to disable parinfer.

ribelo21:08:40

I don't know if this is not a regression, it seems to me that it used to work

ribelo21:08:39

at least it looks like there is a willingness to handle it

sheluchin21:08:42

Hmm, I think I'm on latest. I'll double check when I get back to my machine. Thanks for taking a look @U0BBFDED7.

ribelo21:08:47

no problem

ribelo21:08:37

you can always ask eric on slack, he is always happy to help