Coder Social home page Coder Social logo

Error in event handler for event neo_tree_buffer_enter[diagnostics.neo_tree_buffer_enter]: .../lua/nui/tree/init.lua:254: Expected Lua number about neo-tree-diagnostics.nvim HOT 8 CLOSED

mrbjarksen avatar mrbjarksen commented on June 11, 2024
Error in event handler for event neo_tree_buffer_enter[diagnostics.neo_tree_buffer_enter]: .../lua/nui/tree/init.lua:254: Expected Lua number

from neo-tree-diagnostics.nvim.

Comments (8)

cseickel avatar cseickel commented on June 11, 2024 1

@nyngwang The event handler I gave you assumes that you are only using the filesystem source and will not have any other sources open. It needs to be re-written to be aware of which source triggered the event.

Maybe auto-preview does need to be handled in core, even if it is enabled and/or configured per source.

from neo-tree-diagnostics.nvim.

mrbjarksen avatar mrbjarksen commented on June 11, 2024

My apologies, I don't know how I didn't notice this. I'm working on fixing it but I'm having trouble seeing what's happening.

Are you sure that autopreview = false also gives an error? I'm not seeing the same thing.

from neo-tree-diagnostics.nvim.

nyngwang avatar nyngwang commented on June 11, 2024

@mrbjarksen I also made this issue in a hurry. Here is the missing context that I consider the culprit to this issue:

event_handlers = {
  {
    event = 'after_render',
    handler = function ()
      local state = require('neo-tree.sources.manager').get_state('filesystem')
      if not require('neo-tree.sources.common.preview').is_active() then
        state.config = { use_float = false }
        state.commands.toggle_preview(state)
      end
    end
  },
  -- some other events.
},

and regarding my aforementioned testing on neo-tree-diagnostics.nvim side, I have tried with or without the commented-out config:

diagnostics = {
  autopreview = false,
  -- autopreview_config = { use_float = false },
  -- autopreview_event = 'neo_tree_buffer_enter', -- also tried changing it to 'after_render'. Also got an error.
  window = {
    mappings = {
      ['<cr>'] = function (...)
        local cur_win = vim.api.nvim_get_current_win()
        require('neo-tree.sources.diagnostics.commands').open(...)
        vim.api.nvim_set_current_win(cur_win)
      end
    },
  },
},

(if a better title can be used, please let me know. I'm not sure whether or not you can change it.)

from neo-tree-diagnostics.nvim.

mrbjarksen avatar mrbjarksen commented on June 11, 2024

I just pushed a commit which fixes things on my end (9a78e75). If it doesn't work for you, try disabling your event handler, the interplay between them might be causing issues.

from neo-tree-diagnostics.nvim.

nyngwang avatar nyngwang commented on June 11, 2024

I still got the error if I keep the event as above.

Error in event handler for event after_render[table: 0x01034d1148]: ...im/site/pack/packer/start/nui.nvim/lua/nui/tree/init.lua:254: Expected Lua number

[...] If it doesn't work for you, try disabling your event handler, [...]

But then I will assume that the ability to preview on filesystem source will be disabled. Do you have any alternative regarding that?

from neo-tree-diagnostics.nvim.

nyngwang avatar nyngwang commented on June 11, 2024

After some testing I think this will be helpful: If I call the toggle to open diagnostics.nvim when my cursor is at neo-tree, then no error will be shown.

from neo-tree-diagnostics.nvim.

mrbjarksen avatar mrbjarksen commented on June 11, 2024

Maybe auto-preview does need to be handled in core, even if it is enabled and/or configured per source.

Yes, I think that would probably be a good idea. My solution was more involved than I originally thought it would be.

from neo-tree-diagnostics.nvim.

nyngwang avatar nyngwang commented on June 11, 2024

@cseickel Then maybe this could be put into a new issue on neo-tree side and feel free to postpone it if there are issues of higher priority. I'm happy to know that this bug is indeed triggering the improvement of neo-tree to be a more powerful daily tool :)

[...] If I call the toggle to open diagnostics.nvim when my cursor is at neo-tree, then no error will be shown link

I will use this as a workaround and wait for the update.

from neo-tree-diagnostics.nvim.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.