fix: add offset encoding to apply_workspace_edit call (#1697)
This commit is contained in:
committed by
GitHub
parent
76c23d7375
commit
2cb7e11cc1
@@ -266,10 +266,10 @@ lsp.code_actions = function(opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local execute_action = opts.execute_action
|
local execute_action = opts.execute_action
|
||||||
or function(action)
|
or function(action, offset_encoding)
|
||||||
if action.edit or type(action.command) == "table" then
|
if action.edit or type(action.command) == "table" then
|
||||||
if action.edit then
|
if action.edit then
|
||||||
vim.lsp.util.apply_workspace_edit(action.edit)
|
vim.lsp.util.apply_workspace_edit(action.edit, offset_encoding)
|
||||||
end
|
end
|
||||||
if type(action.command) == "table" then
|
if type(action.command) == "table" then
|
||||||
vim.lsp.buf.execute_command(action.command)
|
vim.lsp.buf.execute_command(action.command)
|
||||||
@@ -297,6 +297,9 @@ lsp.code_actions = function(opts)
|
|||||||
actions.close(prompt_bufnr)
|
actions.close(prompt_bufnr)
|
||||||
local action = selection.value.command
|
local action = selection.value.command
|
||||||
local client = selection.value.client
|
local client = selection.value.client
|
||||||
|
local eff_execute = function(transformed)
|
||||||
|
execute_action(transformed, client.offset_encoding)
|
||||||
|
end
|
||||||
if
|
if
|
||||||
not action.edit
|
not action.edit
|
||||||
and client
|
and client
|
||||||
@@ -309,13 +312,13 @@ lsp.code_actions = function(opts)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
if resolved_action then
|
if resolved_action then
|
||||||
execute_action(transform_action(resolved_action))
|
eff_execute(transform_action(resolved_action))
|
||||||
else
|
else
|
||||||
execute_action(transform_action(action))
|
eff_execute(transform_action(action))
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
execute_action(transform_action(action))
|
eff_execute(transform_action(action))
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user