lsp_code_actions: 'deepcopy' fallback, 'ui_select' control opt (#353)

main
bhagwan 2 years ago
parent 1d19980551
commit 59de53fbbe

@ -636,6 +636,7 @@ require'fzf-lua'.setup {
git_icons = false,
lsp_icons = true,
severity = "hint",
ui_select = true, -- use 'vim.ui.select' for code actions
icons = {
["Error"] = { icon = "", color = "red" }, -- error
["Warning"] = { icon = "", color = "yellow" }, -- warning

@ -678,6 +678,7 @@ Consult the list below for available settings:
git_icons = false,
lsp_icons = true,
severity = "hint",
ui_select = true, -- use 'vim.ui.select' for code actions
icons = {
["Error"] = { icon = "", color = "red" }, -- error
["Warning"] = { icon = "", color = "yellow" }, -- warning

@ -433,6 +433,7 @@ M.globals.lsp = {
git_icons = false,
lsp_icons = true,
cwd_only = false,
ui_select = true,
async_or_timeout = 5000,
_actions = function() return M.globals.actions.files end,
icons = {

@ -56,8 +56,8 @@ M.fzf = function(opts, contents)
-- support global resume?
if opts.global_resume then
config.__resume_data = config.__resume_data or {}
config.__resume_data.opts = vim.deepcopy(opts)
config.__resume_data.contents = contents and vim.deepcopy(contents) or nil
config.__resume_data.opts = utils.deepcopy(opts)
config.__resume_data.contents = contents and utils.deepcopy(contents) or nil
if not opts.__resume then
-- since the shell callback isn't called
-- until the user first types something

@ -370,7 +370,7 @@ M.code_actions = function(opts)
-- use `vim.ui.select` for neovim > 0.6
-- the original method is now deprecated
if vim.fn.has('nvim-0.6') == 1 then
if opts.ui_select and vim.fn.has('nvim-0.6') == 1 then
local ui_select = require'fzf-lua.providers.ui_select'
opts.previewer = false
opts.actions = opts.actions or {}

@ -210,6 +210,15 @@ M.read_file_async = function(filepath, callback)
end
function M.deepcopy(t)
local ok, res = pcall(vim.deepcopy, t)
if ok then
return res
else
return M.tbl_deep_clone(t)
end
end
function M.tbl_deep_clone(t)
if not t then return end
local clone = {}

Loading…
Cancel
Save