action command

pull/81/head
ray-x 3 years ago
parent c55729e879
commit 00a015e27a

@ -34,7 +34,10 @@ local function on_code_action_results(results, ctx)
title = action.edit.title:gsub("\r\n", "\\r\\n")
elseif action.title then
title = action.title:gsub("\r\n", "\\r\\n")
elseif action.command and action.command.title then
title = action.command.title:gsub("\r\n", "\\r\\n")
end
title = title:gsub("\n", "\\n")
title = string.format("[%d] %s", i, title)
table.insert(data, title)
@ -52,21 +55,6 @@ local function on_code_action_results(results, ctx)
local divider = string.rep('', width + 2)
table.insert(data, 2, divider)
-- local apply = require('navigator.lspwrapper').apply_action
-- local function apply_action(action)
-- local action_chosen = nil
-- for key, value in pairs(actions) do
-- if value.display_title == action then
-- action_chosen = value
-- end
-- end
--
-- if action_chosen == nil then
-- log("no match for ", action, actions)
-- return
-- end
-- apply(action_chosen)
-- end
local listview = gui.new_list_view {
items = data,

@ -23,7 +23,7 @@ local key_maps = {
{key = "gT", func = "require('navigator.treesitter').buf_ts()"},
{key = "<Leader>gT", func = "require('navigator.treesitter').bufs_ts()"},
{key = "K", func = "hover({ popup_opts = { border = single, max_width = 80 }})"},
{key = "<Space>ca", mode = "n", func = "code_action()"},
{key = "<Space>ca", mode = "n", func = "require('navigator.codeAction').code_action()"},
{key = "<Space>cA", mode = "v", func = "range_code_action()"},
{key = "<Leader>re", func = "rename()"},
{key = "<Space>rn", func = "require('navigator.rename').rename()"},

@ -447,7 +447,7 @@ local function apply_action(action, client, ctx)
enriched_ctx.client_id = client.id
fn(command, ctx)
else
M.execute_command(command)
require('vim.lsp.buf').execute_command(command)
end
end
end

Loading…
Cancel
Save