Skip to content

Bug: Loading condition of "snacks-picker" provider seems to be broken #199

@ravsii

Description

@ravsii

The code that loads snacks at the moment looks like this (assuming I found the correct place):

["snacks-picker"] = {
name = "snacks",
is_available = function()
return pcall(function() ---@diagnostic disable-next-line: undefined-field
assert(Snacks.config["picker"].enabled)
end)
end,
},

but that doesn't seem to work anymore:

  1. Snacks config doesn't have an enabled option
  2. Picker seems to be always active and available via Snacks.picker.pickerFunc(), like Snacks.picker.files()

So in order to make it work, I had to manually set a non-existent setting, so it looks like this:

return {
  {
    "kawre/leetcode.nvim",
    dependencies = {
      "folke/snacks.nvim",
      -- other deps
    },
    opts = function()
      ---@diagnostic disable-next-line: inject-field
      Snacks.config.picker.enabled = true

      --- @module 'leetcode'
      return {
        ---@type lc.picker
        picker = { provider = "snacks-picker" },
 
        -- other options
      }
    end,
  },
}

Without Snacks.config.picker.enabled = true it doesn't work, but :lua Snacks.picker.files()

Image

And if we check manually:

Image

And with the mention above fix it's working as expected:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions