nvim-treesitter / nvim-tree-docs

Code documentation built with treesitter
223 stars 10 forks source link

Error when opening Neovim #3

Closed kristijanhusak closed 2 years ago

kristijanhusak commented 3 years ago

Hi,

I just tried installing this and when I restarted neovim I got this error:

Error detected while processing FileType Autocommands for "*":                                                                                                                                                                                  
E5108: Error executing lua ...ger/start/nvim-tree-docs/lua/nvim-tree-docs/internal.lua:31: attempt to index local '_1_' (a nil value)

Do you know what can be the issue?

vigoux commented 3 years ago

I don't really know, this seems to be related to the compiled fennel code, maybe @steelsojka has more insights on that though.

steelsojka commented 3 years ago

@kristijanhusak Can you give us some more info? What neovim version are you running? I am using this daily and don't seem to be getting this error.

kristijanhusak commented 3 years ago

@steelsojka Sure. Here are some details:



This happens once I add `tree_docs = { enable = true }` to the config. 

I tried removing all my configuration and it still happens to me. Having just `nvim-treesitter` and this one in `pack/start` directories.

How can I debug this? This compiled lua is a bit harder to debug.
steelsojka commented 3 years ago

@kristijanhusak Do you have a minimal reproducable scenario? How are you managing your plugins?

kristijanhusak commented 3 years ago

@steelsojka Here's the min vimrc I just tested

" minvimrc
set rtp+=/home/kristijan/.config/nvima/pack/packager/start/nvim-treesitter
set rtp+=/home/kristijan/.config/nvima/pack/packager/start/nvim-tree-docs

lua require'nvim-treesitter.configs'.setup { tree_docs = { enable = true, } }
nvim -u minvimrc README.md

Screenshot: screenshot

I'm using built in packages. In the minvimrc above i moved my ~/.config/nvim to ~/.config/nvima just to be sure it doesn't load anything.

kristijanhusak commented 3 years ago

@steelsojka I figured it out. aniseed.core is not properly required everywhere.

Here's the lua diff that made this work for me:

diff --git a/lua/nvim-tree-docs/collector.lua b/lua/nvim-tree-docs/collector.lua
index cdd15c3..a0c8523 100644
--- a/lua/nvim-tree-docs/collector.lua
+++ b/lua/nvim-tree-docs/collector.lua
@@ -17,11 +17,11 @@ end
 local function _2_(...)
   local ok_3f_0_, val_0_ = nil, nil
   local function _2_()
-    return {require("aniseed.core")}
+    return {require("nvim-tree-docs.aniseed.core")}
   end
   ok_3f_0_, val_0_ = pcall(_2_)
   if ok_3f_0_ then
-    _0_0["aniseed/local-fns"] = {require = {core = "aniseed.core"}}
+    _0_0["aniseed/local-fns"] = {require = {core = "nvim-tree-docs.aniseed.core"}}
     return val_0_
   else
     return print(val_0_)
@@ -225,4 +225,4 @@ do
   _0_0["aniseed/locals"]["add-match"] = v_0_
   add_match = v_0_
 end
-return nil
\ No newline at end of file
+return nil
diff --git a/lua/nvim-tree-docs/internal.lua b/lua/nvim-tree-docs/internal.lua
index 3be5ba3..a879ccc 100644
--- a/lua/nvim-tree-docs/internal.lua
+++ b/lua/nvim-tree-docs/internal.lua
@@ -17,11 +17,11 @@ end
 local function _2_(...)
   local ok_3f_0_, val_0_ = nil, nil
   local function _2_()
-    return {require("nvim-tree-docs.collector"), require("aniseed.core"), require("nvim-tree-docs.editing"), require("nvim-tree-docs.template"), require("nvim-tree-docs.utils")}
+    return {require("nvim-tree-docs.collector"), require("nvim-tree-docs.aniseed.core"), require("nvim-tree-docs.editing"), require("nvim-tree-docs.template"), require("nvim-tree-docs.utils")}
   end
   ok_3f_0_, val_0_ = pcall(_2_)
   if ok_3f_0_ then
-    _0_0["aniseed/local-fns"] = {require = {collectors = "nvim-tree-docs.collector", core = "aniseed.core", editing = "nvim-tree-docs.editing", templates = "nvim-tree-docs.template", utils = "nvim-tree-docs.utils"}}
+    _0_0["aniseed/local-fns"] = {require = {collectors = "nvim-tree-docs.collector", core = "nvim-tree-docs.aniseed.core", editing = "nvim-tree-docs.editing", templates = "nvim-tree-docs.template", utils = "nvim-tree-docs.utils"}}
     return val_0_
   else
     return print(val_0_)
@@ -488,4 +488,4 @@ do
   _0_0["aniseed/locals"]["edit_doc_at_cursor"] = v_0_
   edit_doc_at_cursor0 = v_0_
 end
-return nil
\ No newline at end of file
+return nil
diff --git a/lua/nvim-tree-docs/template.lua b/lua/nvim-tree-docs/template.lua
index 0682fc5..1d2a516 100644
--- a/lua/nvim-tree-docs/template.lua
+++ b/lua/nvim-tree-docs/template.lua
@@ -17,11 +17,11 @@ end
 local function _3_(...)
   local ok_3f_0_, val_0_ = nil, nil
   local function _3_()
-    return {require("nvim-tree-docs.collector"), require("aniseed.core"), require("nvim-tree-docs.utils")}
+    return {require("nvim-tree-docs.collector"), require("nvim-tree-docs.aniseed.core"), require("nvim-tree-docs.utils")}
   end
   ok_3f_0_, val_0_ = pcall(_3_)
   if ok_3f_0_ then
-    _0_0["aniseed/local-fns"] = {require = {collectors = "nvim-tree-docs.collector", core = "aniseed.core", utils = "nvim-tree-docs.utils"}}
+    _0_0["aniseed/local-fns"] = {require = {collectors = "nvim-tree-docs.collector", core = "nvim-tree-docs.aniseed.core", utils = "nvim-tree-docs.utils"}}
     return val_0_
   else
     return print(val_0_)
@@ -546,4 +546,4 @@ do
   _0_0["aniseed/locals"]["extend-spec"] = v_0_
   extend_spec = v_0_
 end
-return nil
\ No newline at end of file
+return nil
diff --git a/lua/nvim-tree-docs/utils.lua b/lua/nvim-tree-docs/utils.lua
index 6e04f20..ad3401f 100644
--- a/lua/nvim-tree-docs/utils.lua
+++ b/lua/nvim-tree-docs/utils.lua
@@ -17,11 +17,11 @@ end
 local function _3_(...)
   local ok_3f_0_, val_0_ = nil, nil
   local function _3_()
-    return {require("aniseed.core")}
+    return {require("nvim-tree-docs.aniseed.core")}
   end
   ok_3f_0_, val_0_ = pcall(_3_)
   if ok_3f_0_ then
-    _0_0["aniseed/local-fns"] = {require = {core = "aniseed.core"}}
+    _0_0["aniseed/local-fns"] = {require = {core = "nvim-tree-docs.aniseed.core"}}
     return val_0_
   else
     return print(val_0_)
@@ -375,4 +375,4 @@ do
   _0_0["aniseed/locals"]["highlight-marks"] = v_0_
   highlight_marks = v_0_
 end
-return nil
\ No newline at end of file
+return nil
steelsojka commented 3 years ago

Let me try updating the embedded aniseed version. That should fix it.

On Thu, Jan 21, 2021, 4:33 AM Kristijan Husak notifications@github.com wrote:

@steelsojka https://github.com/steelsojka I figured it out. aniseed.core is not properly required everywhere.

Here's the lua diff that made this work for me:

diff --git a/lua/nvim-tree-docs/collector.lua b/lua/nvim-tree-docs/collector.lua index cdd15c3..a0c8523 100644--- a/lua/nvim-tree-docs/collector.lua+++ b/lua/nvim-tree-docs/collector.lua@@ -17,11 +17,11 @@ end local function 2(...) local ok_3f0, val0 = nil, nil local function 2()- return {require("aniseed.core")}+ return {require("nvim-tree-docs.aniseed.core")} end ok_3f0, val0 = pcall(2) if ok_3f0 then- _0_0["aniseed/local-fns"] = {require = {core = "aniseed.core"}}+ _0_0["aniseed/local-fns"] = {require = {core = "nvim-tree-docs.aniseed.core"}} return val0 else return print(val0)@@ -225,4 +225,4 @@ do _0_0["aniseed/locals"]["add-match"] = v0 add_match = v0 end-return nil \ No newline at end of file+return nildiff --git a/lua/nvim-tree-docs/internal.lua b/lua/nvim-tree-docs/internal.lua index 3be5ba3..a879ccc 100644--- a/lua/nvim-tree-docs/internal.lua+++ b/lua/nvim-tree-docs/internal.lua@@ -17,11 +17,11 @@ end local function 2(...) local ok_3f0, val0 = nil, nil local function 2()- return {require("nvim-tree-docs.collector"), require("aniseed.core"), require("nvim-tree-docs.editing"), require("nvim-tree-docs.template"), require("nvim-tree-docs.utils")}+ return {require("nvim-tree-docs.collector"), require("nvim-tree-docs.aniseed.core"), require("nvim-tree-docs.editing"), require("nvim-tree-docs.template"), require("nvim-tree-docs.utils")} end ok_3f0, val0 = pcall(2) if ok_3f0 then- _0_0["aniseed/local-fns"] = {require = {collectors = "nvim-tree-docs.collector", core = "aniseed.core", editing = "nvim-tree-docs.editing", templates = "nvim-tree-docs.template", utils = "nvim-tree-docs.utils"}}+ _0_0["aniseed/local-fns"] = {require = {collectors = "nvim-tree-docs.collector", core = "nvim-tree-docs.aniseed.core", editing = "nvim-tree-docs.editing", templates = "nvim-tree-docs.template", utils = "nvim-tree-docs.utils"}} return val0 else return print(val0)@@ -488,4 +488,4 @@ do _0_0["aniseed/locals"]["edit_doc_at_cursor"] = v0 edit_doc_at_cursor0 = v0 end-return nil \ No newline at end of file+return nildiff --git a/lua/nvim-tree-docs/template.lua b/lua/nvim-tree-docs/template.lua index 0682fc5..1d2a516 100644--- a/lua/nvim-tree-docs/template.lua+++ b/lua/nvim-tree-docs/template.lua@@ -17,11 +17,11 @@ end local function 3(...) local ok_3f0, val0 = nil, nil local function 3()- return {require("nvim-tree-docs.collector"), require("aniseed.core"), require("nvim-tree-docs.utils")}+ return {require("nvim-tree-docs.collector"), require("nvim-tree-docs.aniseed.core"), require("nvim-tree-docs.utils")} end ok_3f0, val0 = pcall(3) if ok_3f0 then- _0_0["aniseed/local-fns"] = {require = {collectors = "nvim-tree-docs.collector", core = "aniseed.core", utils = "nvim-tree-docs.utils"}}+ _0_0["aniseed/local-fns"] = {require = {collectors = "nvim-tree-docs.collector", core = "nvim-tree-docs.aniseed.core", utils = "nvim-tree-docs.utils"}} return val0 else return print(val0)@@ -546,4 +546,4 @@ do _0_0["aniseed/locals"]["extend-spec"] = v0 extend_spec = v0 end-return nil \ No newline at end of file+return nildiff --git a/lua/nvim-tree-docs/utils.lua b/lua/nvim-tree-docs/utils.lua index 6e04f20..ad3401f 100644--- a/lua/nvim-tree-docs/utils.lua+++ b/lua/nvim-tree-docs/utils.lua@@ -17,11 +17,11 @@ end local function 3(...) local ok_3f0, val0 = nil, nil local function 3()- return {require("aniseed.core")}+ return {require("nvim-tree-docs.aniseed.core")} end ok_3f0, val0 = pcall(3) if ok_3f0 then- _0_0["aniseed/local-fns"] = {require = {core = "aniseed.core"}}+ _0_0["aniseed/local-fns"] = {require = {core = "nvim-tree-docs.aniseed.core"}} return val0 else return print(val0)@@ -375,4 +375,4 @@ do _0_0["aniseed/locals"]["highlight-marks"] = v0 highlight_marks = v0 end-return nil \ No newline at end of file+return nil

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nvim-treesitter/nvim-tree-docs/issues/3#issuecomment-764540037, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPXOSUCW7KJ3BPQXGRX6ZDS277F5ANCNFSM4VPMFK4Q .

kristijanhusak commented 3 years ago

I see that you updated it, but the issue still persist. I'm curious how you don't have this issue? Is there some configuration to make this work?

steelsojka commented 3 years ago

I investigated this a little bit this morning and see the issue, but I think it's an issue with the embed script in aniseed. It works for me because I have aniseed as a plugin since my configuration is using it. I will try and find a fix in the build process, but in the mean time try adding aniseed as a plugin and see if that resolves the issue. I will try and get the compiled files pointing to the embedded instance in the mean time.

kristijanhusak commented 3 years ago

Adding aniseed makes it work, thanks. Let me know if you manage to make it work without it as a dependency.

Olical commented 3 years ago

If there's any way I can help out here, let me know, AMA :slightly_smiling_face: you should be able to rely on the embedded Aniseed copy, it can be tricky to realise that you're depending on the global Aniseed instance sometimes. I'd grep for \saniseed to find unprefixed references.

Cool to see it being used here and I'd like to help you work through issues to help them be avoided in the future.

Shatur commented 3 years ago

Same thing, adding anyseed plugin helped. Probably worth adding to the readme. What is the purpose of aniseed dependency? The plugin can't be written in pure lua?

Olical commented 3 years ago

You can try this fork where I've updated Aniseed and corrected the references to the embedded library so you don't need to have it installed globally.

I'll create a PR too.

steelsojka commented 2 years ago

@kristijanhusak Can you verify if this is fixed for you? Should be fixed by #12

kristijanhusak commented 2 years ago

@steelsojka yeah, works great. Thanks!