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

Renaming deftype scrambles signature

TimoKramer opened this issue · comments

Describe the bug
When renaming a deftype the outcome cuts characters before and after the renamed deftype name.

I am using Neovim 0.9.4 with nvim-lspconfig

To Reproduce
Steps to reproduce the behavior:

  1. Open new buffer
  2. Write (deftype FooBar [foo bar])
  3. Place cursor on FooBar
  4. LSP-rename with FooBarBaz
  5. Renamed to (deftypFooBarBazBaz [foo bar])

Expected behavior
The deftype and all occurrences should be renamed with FooBarBaz.

Screenshots
If applicable, add screenshots to help explain your problem.

Log - client <-> server
[DEBUG][2023-11-09 16:31:00] .../vim/lsp/rpc.lua:284    "rpc.send"      {  jsonrpc = "2.0",  method = "textDocument/didSave",  params = {    text = "(deftype FooBar [foo bar baz])\n",    textDocument = {      uri = "file:///home/timo/projects/temp/deftype-rename/core.clj"    }  }}
[DEBUG][2023-11-09 16:31:54] .../lua/vim/lsp.lua:1391   "LSP[clojure_lsp]"      "client.request"        1       "textDocument/prepareRename"    {  position = {    character = 13,    line = 0  },  textDocument = {    uri = "file:///home/timo/projects/temp/deftype-rename/core.clj"  }}     1
[DEBUG][2023-11-09 16:31:54] .../vim/lsp/rpc.lua:284    "rpc.send"      {  id = 53,  jsonrpc = "2.0",  method = "textDocument/prepareRename",  params = {    position = {      character = 13,      line = 0    },    textDocument = {      uri = "file:///home/timo/projects/temp/deftype-re name/core.clj"    }  }}
[DEBUG][2023-11-09 16:31:54] .../vim/lsp/rpc.lua:387    "rpc.receive"   {  id = 53,  jsonrpc = "2.0",  result = {    ["end"] = {      character = 15,      line = 0    },    start = {      character = 9,      line = 0    }  }}
[DEBUG][2023-11-09 16:31:57] .../lua/vim/lsp.lua:1391   "LSP[clojure_lsp]"      "client.request"        1       "textDocument/rename"   {  newName = "FooBarBaz",  position = {    character = 13,    line = 0  },  textDocument = {    uri = "file:///home/timo/projects/temp/deftype-rename /core.clj"  }}         1
[DEBUG][2023-11-09 16:31:57] .../vim/lsp/rpc.lua:284    "rpc.send"      {  id = 54,  jsonrpc = "2.0",  method = "textDocument/rename",  params = {    newName = "FooBarBaz",    position = {      character = 13,      line = 0    },    textDocument = {      uri = "file:///home/timo/proje cts/temp/deftype-rename/core.clj"    }  }}
[DEBUG][2023-11-09 16:31:57] .../vim/lsp/rpc.lua:387    "rpc.receive"   {  id = 54,  jsonrpc = "2.0",  result = {    changes = {      ["file:///home/timo/projects/temp/deftype-rename/core.clj"] = { {          newText = "FooBarBaz",          range = {            ["end"] = { character = 15,              line = 0            },            start = {              character = 9,              line = 0            }          }        }, {          newText = "FooBarBaz",          range = {            ["end"] = {              character = 15,              line = 0 },            start = {              character = 7,              line = 0            }          }        } }    }  }}
[DEBUG][2023-11-09 16:31:57] .../vim/lsp/rpc.lua:284    "rpc.send"      {  jsonrpc = "2.0",  method = "textDocument/didChange",  params = {    contentChanges = { {        text = "(deftype FooBarBaz [foo bar baz])\n"      } },    textDocument = {      uri = "file:///home/timo/projects/ temp/deftype-rename/core.clj",      version = 83    }  }}
[DEBUG][2023-11-09 16:31:57] .../vim/lsp/rpc.lua:387    "rpc.receive"   {  jsonrpc = "2.0",  method = "textDocument/publishDiagnostics",  params = {    diagnostics = {},    uri = "file:///home/timo/projects/temp/deftype-rename/core.clj"  }}
[DEBUG][2023-11-09 16:31:57] .../vim/lsp/rpc.lua:284    "rpc.send"      {  jsonrpc = "2.0",  method = "textDocument/didChange",  params = {    contentChanges = { {        text = "(deftypFooBarBazBaz [foo bar baz])\n"      } },    textDocument = {      uri = "file:///home/timo/projects /temp/deftype-rename/core.clj",      version = 84    }  }}

User details (please complete the following information):

  • OS: ArchLinux on WSL2 on Windows11
  • Editor: Neovim 0.9.4
  • Version: clojure-lsp 2023.10.30-16.25.41
    clj-kondo 2023.10.21-SNAPSHOT