diff options
| author | Richard Mathieson <35163478+rlch@users.noreply.github.com> | 2022-01-18 18:07:29 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-18 08:07:29 +0100 |
| commit | 2cb7e11cc151c42e2981b2a460bbbe4ded5be5ee (patch) | |
| tree | be55c4544c013c81e7d35ac53e6a60e13985b4f1 /lua/telescope/builtin | |
| parent | 76c23d73751ab24126c7b486c6b1ff8e79540dbf (diff) | |
fix: add offset encoding to `apply_workspace_edit` call (#1697)
Diffstat (limited to 'lua/telescope/builtin')
| -rw-r--r-- | lua/telescope/builtin/lsp.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lua/telescope/builtin/lsp.lua b/lua/telescope/builtin/lsp.lua index c2d1b76..737cad1 100644 --- a/lua/telescope/builtin/lsp.lua +++ b/lua/telescope/builtin/lsp.lua @@ -266,10 +266,10 @@ lsp.code_actions = function(opts) end 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 then - vim.lsp.util.apply_workspace_edit(action.edit) + vim.lsp.util.apply_workspace_edit(action.edit, offset_encoding) end if type(action.command) == "table" then vim.lsp.buf.execute_command(action.command) @@ -297,6 +297,9 @@ lsp.code_actions = function(opts) actions.close(prompt_bufnr) local action = selection.value.command local client = selection.value.client + local eff_execute = function(transformed) + execute_action(transformed, client.offset_encoding) + end if not action.edit and client @@ -309,13 +312,13 @@ lsp.code_actions = function(opts) return end if resolved_action then - execute_action(transform_action(resolved_action)) + eff_execute(transform_action(resolved_action)) else - execute_action(transform_action(action)) + eff_execute(transform_action(action)) end end) else - execute_action(transform_action(action)) + eff_execute(transform_action(action)) end end) |
