-
-
Notifications
You must be signed in to change notification settings - Fork 156
Closed
Description
Currently when I try to rename some class form LSP client I have to rename its file manually. For a simple class with no references the server sends to the client WorkspaceEdit with a single TextDocumentEdit (as I guess from its format) inside documentChanges. It's enough to change the file content by some client's response handler. The original name remains untouched.
After dumping such example edit in Lua format
{ -- WorkspaceEdit
documentChanges = {
{ -- TextDocumentEdit
edits = {
{
newText = "Arctgx\\PhpactorTestEnv",
range = {
['end'] = {
character = 32,
line = 2
},
start = {
character = 10,
line = 2
}
}
},
{
newText = "V",
range = {
['end'] = {
character = 7,
line = 4
},
start = {
character = 6,
line = 4
}
}
}
},
textDocument = {
uri = "file:///home/arctgx/dev/arctgx/phpactor-test-env/src/Z.php",
version = 7
}
},
},
}and adding RenameFile and applying such simulated response on the client side
local out = { -- WorkspaceEdit
documentChanges = {
{ -- RenameFile
kind = 'rename',
oldUri = "file:///home/arctgx/dev/arctgx/phpactor-test-env/src/Z.php",
newUri = "file:///home/arctgx/dev/arctgx/phpactor-test-env/src/V.php",
},
{ -- TextDocumentEdit
edits = {
{
newText = "Arctgx\\PhpactorTestEnv",
range = {
['end'] = {
character = 32,
line = 2
},
start = {
character = 10,
line = 2
}
}
},
{
newText = "V",
range = {
['end'] = {
character = 7,
line = 4
},
start = {
character = 6,
line = 4
}
}
}
},
textDocument = {
uri = "file:///home/arctgx/dev/arctgx/phpactor-test-env/src/V.php",
version = 7
}
},
},
}
vim.lsp.util.apply_workspace_edit(out, vim.lsp.get_client_by_id(1).offset_encoding)I get the expected change. It suggests that RenameFile should be added to documentChanges.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels