luckasRanarison / nvim-devdocs

Neovim DevDocs integration
MIT License
270 stars 20 forks source link

.setup function not available to Packer #9

Closed mike-deakin closed 1 year ago

mike-deakin commented 1 year ago

When using the example Packer.nvim configuration, an error is raised which fails the configuration/setup:

packer.nvim: Error running config for nvim-devdocs: [string "..."]:0: attempt to call field 'setup' (a nil value)

Inspecting the object returned by requre("nvim-devdocs") shows that the setup function isn't available:

-- Packer config
use {
    "luckasRanarison/nvim-devdocs",
    requires = {
        "nvim-lua/plenary.nvim",
        "nvim-telescope/telescope.nvim",
        "nvim-treesitter/nvim-treesitter",⊣
    },
    config = function()
        print(vim.inspect(require("nvim-devdocs")))
        require"nvim-devdocs".setup()
    end
}

Message result:

{
  fetch_registery = <function 1>,
  install_doc = <function 2>,
  open_doc = <function 3>,
  open_doc_float = <function 4>,
  uninstall_doc = <function 5>,
  update = <function 6>,
  update_all = <function 7>
}

Manually calling .setup() as a :lua command works however.

luckasRanarison commented 1 year ago

It looks like Lazy and packer load modules differently. I was able to call setup() when using Lazy so I just assumed it'd also work with Packer. I'll move the setup function inside the init.lua to fix this. Thanks for the report!

luckasRanarison commented 1 year ago

I moved .setup() inside init.lua in e1f423c