oberblastmeister / neuron.nvim

Make neovim the best note taking application
MIT License
398 stars 34 forks source link

Neovim 0.5.1 possible breaking changes #42

Closed protex closed 2 years ago

protex commented 2 years ago

I just installed this plugin and basically nothing works. I believe this is because of some breaking changes in telescope which now has a minimum requirement of 0.5.1. I can't prove this, I'm just guessing based on the output of an example of the error below and the fact that this project doesn't say it has a minimum requirement of 0.5.1 when it relies on telescope, which does have this requirement.


Error executing vim.schedule lua callback: ...g/nvim/autoload/plugged/neuron.nvim/lua/neuron/utils.lua:27: Vim(echoerr):An error occured from running neuron query:    Plugins enabled: links, tags, neuronignore, uptree, feed
Error executing vim.schedule lua callback: ...g/nvim/autoload/plugged/neuron.nvim/lua/neuron/utils.lua:27: Vim(echoerr):An error occured from running neuron query:    Loading directory tree (2 .md files) ...
Error executing vim.schedule lua callback: ...g/nvim/autoload/plugged/neuron.nvim/lua/neuron/utils.lua:27: Vim(echoerr):An error occured from running neuron query:    Building graph (2 notes) ...
Error executing vim.schedule lua callback: Vim:E474: Unexpected end of input: [
Error executing vim.schedule lua callback: Vim:E474: Unexpected end of input:     {
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : "2021-11-05T11:39",
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : "4d7334a4",
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : {
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : "2021-11-05T11:39",
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : [
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: ,
Error executing vim.schedule lua callback: ...scope.nvim/lua/telescope/finders/async_static_finder.lua:16: bad argument #1 to 'ipairs' (table expected, got nil)
Error executing vim.schedule lua callback: Vim:E474: No container to close: ]
Error executing vim.schedule lua callback: Vim:E474: No container to close: },
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : "./4d7334a4.md",
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : "4d7334a4",
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : "<file description>"
Error executing vim.schedule lua callback: Vim:E474: No container to close: },
Error executing vim.schedule lua callback: Vim:E474: Unexpected end of input:     {
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : "2021-11-05T15:27",
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : "8e756e4f",
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : {
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : "2021-11-05T15:27",
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : [
Error executing vim.schedule lua callback: ...scope.nvim/lua/telescope/finders/async_static_finder.lua:16: bad argument #1 to 'ipairs' (table expected, got nil)
Error executing vim.schedule lua callback: Vim:E474: No container to close: ]
Error executing vim.schedule lua callback: Vim:E474: No container to close: },
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : "./8e756e4f.md",
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : "8e756e4f",
Error executing vim.schedule lua callback: Vim:E474: Trailing characters: : "<file description>"
Error executing vim.schedule lua callback: Vim:E474: No container to close: }
Error executing vim.schedule lua callback: Vim:E474: No container to close: ]
E5108: Error executing lua ....config/nvim/autoload/plugged/neuron.nvim/lua/neuron.lua:67: There is no link under the cursor```
protex commented 2 years ago

I dug into this more, and it looks like the culprit of this problem may actually be a combination of a few changes from neuron.

  1. It appears as though it now prints some diagnostic information before it prints out the json query.

The output of neuron query is:

   Plugins enabled: links, tags, neuronignore, uptree, feed
   Loading directory tree (2 .md files) ...
   Building graph (2 notes) ...
[
....
]

And those first 3 lines are not on stdout, they are on stderr:

$ neuron query 2>/dev/null
[
...
]

Note the lack of diagnostic info after re-directing stderr to /dev/null.

This makes these the on_stderr callback get thrown every time cmd.query is called: https://github.com/oberblastmeister/neuron.nvim/blob/10b189437c3e080502ca14ed0e7bc041274e0610/lua/neuron/cmd.lua#L12

  1. Neuron pretty prints the json output:

The the cmd.neuron is set up, it's attempting to parse the json on every stdout event. Since things are printed line by line, it's looks like it's calling the callback on every line.

I think utilizing the on_exit instead of the on_stdout and on_stderr handles may be a better way to handle the output.

lokesh-krishna commented 2 years ago

I have a feeling that the error I'm facing is related. I get it whenever I try to pick a note using Telescope or insert a link.

E5108: Error executing lua ...cker/start/telescope.nvim/lua/telescope/actions/init.lua:29: Key does not exist for 'telescope.actions': get_selected_entry

If someone more experienced can take a look and confirm whether or not it is, I'll open a new issue for it.

protex commented 2 years ago

Just noticed the note at the top of the repo about the neuron version and the unstable branch. I had combed over everything and somehow missed it. Closing this.

lokesh-krishna commented 2 years ago

I am using the unstable branch and the latest version of Neuron and I do get those errors printed out every time I create a new file. @protex, did you have to do anything to not have that in the output every time? I only get those three lines and not the rest of the errors mentioned earlier in the issue.