luckasRanarison / nvim-devdocs

Neovim DevDocs integration
MIT License
270 stars 20 forks source link

scope.nvim/lua/telescope/finders/async_static_finder.lua:16: in function 'new_table' #15

Closed teto closed 1 year ago

teto commented 1 year ago

I've just tried to use nvim-devdocs with lazy

{ 'luckasRanarison/nvim-devdocs',
 -- needs a html treesitter
  config = function()
    require("nvim-devdocs").setup()
  end
 }

(I've got telescope & plenary installed already)

Then I run another command and got

Error executing Lua callback: ...scope.nvim/lua/telescope/finders/async_static_finder.lua:16: bad argument #1 to 'ipairs' (table expected, got nil)                                             
stack traceback:                                                                                                                                                                                
        [C]: in function 'ipairs'                                                                                                                                                               
        ...scope.nvim/lua/telescope/finders/async_static_finder.lua:16: in function 'new_table'                                                                                                 
        ...hare/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/pickers.lua:153: in function 'global_search_picker'                                                                                     
        ...l/share/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/init.lua:39: in function <...l/share/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/init.lua:37>
|| Error executing Lua callback: ...ack/home-manager/start/plenary.nvim/lua/plenary/path.lua:735: ENOENT: no such file or directory: /home/teto/.local/share/nvim/devdocs/index.json
|| stack traceback:
||  [C]: in function 'assert'
||  ...ack/home-manager/start/plenary.nvim/lua/plenary/path.lua:735: in function 'read'
||  ...l/share/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/list.lua:53: in function 'get_updatable'
||  ...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/operations.lua:95: in function 'install_args'
||  ...l/share/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/init.lua:16: in function <...l/share/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/init.lua:12>

How can I create /home/teto/.local/share/nvim/devdocs/index.json ? I only have a ~/.local/share/nvim/devdocs/registery.json available

btw if you wanna list the "competition", you could mention in README https://gitlab.com/ivan-cukic/nvim-telescope-zeal-cli based on zeal https://zealdocs.org/

jokajak commented 1 year ago

When using lazy, make sure to follow the instructions in the README.md. Just because you have the other plugins already doesn't mean lazy.nvim knows to load them first. The dependencies key ensures the other plugins get loaded before this one.

luckasRanarison commented 1 year ago

I've just tried to use nvim-devdocs with lazy

{ 'luckasRanarison/nvim-devdocs',
 -- needs a html treesitter
  config = function()
    require("nvim-devdocs").setup()
  end
 }

(I've got telescope & plenary installed already)

Then I run another command and got

Error executing Lua callback: ...scope.nvim/lua/telescope/finders/async_static_finder.lua:16: bad argument #1 to 'ipairs' (table expected, got nil)                                             
stack traceback:                                                                                                                                                                                
        [C]: in function 'ipairs'                                                                                                                                                               
        ...scope.nvim/lua/telescope/finders/async_static_finder.lua:16: in function 'new_table'                                                                                                 
        ...hare/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/pickers.lua:153: in function 'global_search_picker'                                                                                     
        ...l/share/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/init.lua:39: in function <...l/share/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/init.lua:37>

|| Error executing Lua callback: ...ack/home-manager/start/plenary.nvim/lua/plenary/path.lua:735: ENOENT: no such file or directory: /home/teto/.local/share/nvim/devdocs/index.json || stack traceback: || [C]: in function 'assert' || ...ack/home-manager/start/plenary.nvim/lua/plenary/path.lua:735: in function 'read' || ...l/share/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/list.lua:53: in function 'get_updatable' || ...e/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/operations.lua:95: in function 'install_args' || ...l/share/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/init.lua:16: in function <...l/share/nvim/lazy/nvim-devdocs/lua/nvim-devdocs/init.lua:12>

How can I create /home/teto/.local/share/nvim/devdocs/index.json ? I only have a ~/.local/share/nvim/devdocs/registery.json available

btw if you wanna list the "competition", you could mention in README https://gitlab.com/ivan-cukic/nvim-telescope-zeal-cli based on zeal https://zealdocs.org/

That's my mistake sorry I should have returned an empty table instead of nil if index.json doesn't exist. index.json is created when installing docs. This zeal plugin looks interesting, it fetches its output from a browser. I think I forget to mention that you have to install the docs with nvim-devdocs.

luckasRanarison commented 1 year ago

It should be fixed now. I've also precised the usage and mentioned nvim-telescope-zeal in the README :)

teto commented 1 year ago

thanks for the fix. It's working now but I hit this https://github.com/luckasRanarison/nvim-devdocs/issues/8 . I saw it's being worked on so closing.

PS: I dont have any telescope preview of the current selection maybe because glow is not available ? would the plugin autodetect it or do I need to set previewer_cmd in setup ?

luckasRanarison commented 1 year ago

thanks for the fix. It's working now but I hit this #8 . I saw it's being worked on so closing.

PS: I dont have any telescope preview of the current selection maybe because glow is not available ? would the plugin autodetect it or do I need to set previewer_cmd in setup ?

Currently when you search globally there is no preview, see #5. But if #17 will be complete it will simplify things and closes most of the main issues