Skip to content

[mini.pick] source.show swallows an error #2333

@drowning-cat

Description

@drowning-cat

Contributing guidelines

Module(s)

mini.pick

Neovim version

0.12 (!at least latest Nightly build!)

Description

An error inside the show function silently closes the picker without any visible message. This can be a little bit disorienting, especially in cases where the show function is overridden, since it's not clear what went wrong.

This behavior seems unintended to me, so I'm opening this issue.

Expectation

I would expect the error to be visible in such cases, for example by re-throwing it or using vim.notify.

Reproduction

nvim --noplugin -u repro.lua repro.lua
<Space>f
<Esc>
:messages -- No error
-- repro.lua

vim.pack.add({
  { src = "https://github.com/nvim-mini/mini.nvim" },
})

require("mini.pick").setup()

MiniPick.registry.files = function(local_opts, opts)
  opts = vim.tbl_deep_extend("keep", opts or {}, {
    source = {
      show = function()
        error("No error?")
      end,
    },
  })
  return MiniPick.builtin.files(local_opts, opts)
end

vim.keymap.set("n", "<Space>f", "<Cmd>Pick files<CR>", { desc = "Pick files" })

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions