From 7e7f6d8cc375dbaca1f59734eca62d0aeb01f41d Mon Sep 17 00:00:00 2001 From: bhagwan Date: Mon, 17 Jan 2022 09:25:19 -0800 Subject: [PATCH] add offset_encoding to code_action apply_workspace_edit (#314) --- lua/fzf-lua/providers/lsp.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lua/fzf-lua/providers/lsp.lua b/lua/fzf-lua/providers/lsp.lua index 1dde3d0..6c35ebd 100644 --- a/lua/fzf-lua/providers/lsp.lua +++ b/lua/fzf-lua/providers/lsp.lua @@ -386,10 +386,10 @@ M.code_actions = function(opts) end local execute_action = opts.execute_action - or function(action) + or function(action, enc) 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, enc) end if type(action.command) == "table" then vim.lsp.buf.execute_command(action.command) @@ -406,6 +406,7 @@ M.code_actions = function(opts) local entry = opts.code_actions[idx] local action = entry.command local client = entry.client or vim.lsp.get_client_by_id(entry.client_id) + local offset_encoding = client and client.offset_encoding if not action.edit and client @@ -420,13 +421,13 @@ M.code_actions = function(opts) return end if resolved_action then - execute_action(transform_action(resolved_action)) + execute_action(transform_action(resolved_action), offset_encoding) else - execute_action(transform_action(action)) + execute_action(transform_action(action), offset_encoding) end end) else - execute_action(transform_action(action)) + execute_action(transform_action(action), offset_encoding) end end)