pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.24k stars 124 forks source link

Error when selecting item, picker fzf-lua (index upvalue `formatted_items`, a nil value) #503

Closed MadKuntilanak closed 3 months ago

MadKuntilanak commented 4 months ago

Issue Description

Type: bug report

Describe what happened

picker= fzf-lua, run command Octo issue search and selecting item got warning and error

[Fzf-lua] `fzf_opts` are automatically shellescaped. Please remove surrounding quotes from --delimiter=' '
[Fzf-lua] fn_selected threw an error: ...to.nvim/lua/octo/pickers/fzf-lua/pickers/fzf_actions.lua:9: attempt to index upvalue 'formatted_items' (a nil value)
stack traceback:
^I...nvim/lazy/lazy.nvim/plugins/fzf-lua/lua/fzf-lua/core.lua:211: in function '__index'
^I...to.nvim/lua/octo/pickers/fzf-lua/pickers/fzf_actions.lua:9: in function 'action'
^I...m/lazy/lazy.nvim/plugins/fzf-lua/lua/fzf-lua/actions.lua:72: in function 'act'
^I...nvim/lazy/lazy.nvim/plugins/fzf-lua/lua/fzf-lua/core.lua:126: in function 'fn_selected'
^I...nvim/lazy/lazy.nvim/plugins/fzf-lua/lua/fzf-lua/core.lua:204: in function <...nvim/lazy/lazy.nvim/plugins/fzf-lua/lua/fzf-lua/core.lua:203>
^I[C]: in function 'xpcall'
^I...nvim/lazy/lazy.nvim/plugins/fzf-lua/lua/fzf-lua/core.lua:203: in function <...nvim/lazy/lazy.nvim/plugins/fzf-lua/lua/fzf-lua/core.lua:197>

How to reproduce it (as minimally and precisely as possible)

  1. open Octo issue search.
  2. select item, press enter, got error: attempt to index upvalue 'formatted_items' (a nil value)

Tell us your environment

nvim nightly latest

local data = vim.fn.stdpath("data")
local lazypath = data .. "/lazy/lazy.nvim"

-- bootstrap lazy
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end

vim.opt.runtimepath:prepend(lazypath)
vim.opt.clipboard = "unnamed"

vim.g.mapleader = " "
vim.g.maplocalleader = ","

-- install plugins
local plugins = {
    "folke/tokyonight.nvim",
    {
        "pwntester/octo.nvim",
        cmd = "Octo",
        dependencies = {
            "nvim-telescope/telescope.nvim",
            "ibhagwan/fzf-lua",
        },
        opts = {
            picker = "fzf-lua", -- telescope
        },
    },
    {
        "nvim-telescope/telescope.nvim",
        version = false,
        cmd = "Telescope",
        dependencies = {
            "nvim-lua/plenary.nvim",
            { "nvim-telescope/telescope-fzf-native.nvim", build = "make", enabled = vim.fn.executable("make") == 1 },
        },
        keys = {},
        config = function()
            require("telescope").setup()
        end,
    },
    {
        "ibhagwan/fzf-lua",
        version = false,
        cmd = "FzfLua",
        event = "VeryLazy",
        keys = {
            { "<Leader>ff", "<CMD>FzfLua files<CR>", desc = "Fzflua: find files", mode = { "n", "v" } },
            { "<Leader>fC", "<CMD>FzfLua commands<CR>", desc = "Fzflua: commands", mode = "n" },
            { "<Leader>fh", "<CMD>FzfLua help_tags<CR>", desc = "Fzflua: help tags" },
            { "<Leader>fg", "<CMD>FzfLua live_grep<CR>", desc = "Fzflua: help tags" },
        },
        dependencies = {
            "sindrets/diffview.nvim",
            "nvim-tree/nvim-web-devicons",
            "onsails/lspkind.nvim",
        },
        opts = {},
        config = function()
            require("fzf-lua").setup()
        end,
    },
    -- add any other plugins here
}
require("lazy").setup(plugins, {
    root = lazypath .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
milogert commented 3 months ago

@MadKuntilanak thanks for the bug report! Could you test out https://github.com/pwntester/octo.nvim/pull/515 to see if that helps?

MadKuntilanak commented 3 months ago

yup this will fix the major issue

but I still get the same warn about fzf-opts: --delimeter:"' '", I checked https://github.com/ibhagwan/fzf-lua/blob/ff21680ddfd2ba434ea7061b9042f7e18966597d/lua/fzf-lua/core.lua#L573 and I think is okay to get rid this opts, what do you think?

milogert commented 3 months ago

Ah, I didn't see that until updating! I'll take a look at it, thanks

milogert commented 3 months ago

OK, new change is up in #515 if you want to test it out @MadKuntilanak

MadKuntilanak commented 3 months ago

OK, new change is up in #515 if you want to test it out @MadKuntilanak

Nice, it works without warning and errors. Thank you!