clojure-lsp / clojure-lsp

Clojure & ClojureScript Language Server (LSP) implementation

Home Page:https://clojure-lsp.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lsp-rename incorrectly changing require ns when changed to longer text and changing current namespace

Kaspazza opened this issue · comments

Describe the bug
When lsp-rename is run on required namespace in a way that the new name is longer it results in some weird combination of letters at the end of the replaced ns.

To Reproduce
Steps to reproduce the behavior:

  1. Go to this line
  2. Run lsp-rename on automaton-core.configuration.files to automaton-core.configuration.new-files
  3. On that line the text will be messed up, the namespace in which we are automaton-core.configuration will be renamed also to automaton-core.configuration.new-files and the file will be moved accordingly.

Expected behavior
Only that required ns is renamed on that line and the namespace that it's pointing to, not the current ns

** Testing env **
I'm using mac aarch
I've tested this on the newest version of lsp-clojure to 2022.06.22 (first one with aarch).
And on all of them it is not working, it was definitely at one point before that date, but can't tell which one.

It seems it is more messed up, because also when I tried renaming defrecord (in ns automaton-core.configuration.files), it renamed the ns reference instead of the defrecord name.

So SimpleFiles

when running lsp-rename,SimpleConf renamed to FilesConf

It renamed it in automaton-core.configuration
From core-conf-files/->SimpleConf to ->FilesConf/->SimpleConf

And this was working at 2022.06.22 (I mean there is a bug that in place where it's edited it's messed up, but the references are well replaced)

Found the bug, it seems it exists since 2022/05, introduced here, I'll fix it, but meanwhile, just renaming the file instead of the ns, should rename the ns and its references and not cause this bug

Should be fixed on nightly/next release