kevinhwang91 / nvim-ufo

Not UFO in the sky, but an ultra fold in Neovim.
BSD 3-Clause "New" or "Revised" License
2.32k stars 47 forks source link

attemp to call field 'nvim__redraw' #234

Closed lee-shun closed 2 months ago

lee-shun commented 3 months ago

Neovim version (nvim -v | head -n1)

NVIM v0.10.0-dev

Operating system/version

ubuntu20.04

How to reproduce the issue

  1. use the following config with lazy;
    
    return {
    "kevinhwang91/nvim-hlslens",
    event = "VeryLazy",
    enabled = false,
    keys = {
        { "n",  [[<cmd>execute('normal! ' . v:count1 . 'n')<cr><cmd>lua require('hlslens').start()<cr>]] },
        { "N",  [[<cmd>execute('normal! ' . v:count1 . 'N')<cr><cmd>lua require('hlslens').start()<cr>]] },
        { "*",  [[*<cmd>lua require('hlslens').start()<cr>]] },
        { "#",  [[#<cmd>lua require('hlslens').start()<cr>]] },
        { "g*", [[g*<cmd>lua require('hlslens').start()<cr>]] },
        { "g#", [[g#<cmd>lua require('hlslens').start()<cr>]] },
    },
    config = true,
    }

2. open the nvim with a file
the error is:
![image](https://github.com/user-attachments/assets/664e265c-c772-4d1a-a0ed-c6b9072b0207)

### Expected behavior

no errors

### Actual behavior

the above-mentioned error occurs when opening the file.
lee-shun commented 3 months ago

@kevinhwang91

kevinhwang91 commented 3 months ago

Only this error appeared for the first open?

renauga commented 3 months ago

I am experiencing this issue too. As of now, I've seen it appear when entering buffers.

kevinhwang91 commented 3 months ago

What's the :lua =vim.api.nvim__redraw output? Is the result <function 1> ? Look like the lazy issue.

simonlearnscoding commented 3 months ago

experiencing the same issue since an update

TioeAre commented 2 months ago

I encountered a similar problem. But with the same config, the problem only occurred on the remote server when i open a file, and no error was reported in nvim on my local machine.

outputs are as follows

Error in decoration provider ufo.end:
Error executing lua: ...24/.local/share/nvim/lazy/nvim-ufo/lua/ufo/decorator.lua:132: attempt to call field 'nvim__redraw' (a nil value)
stack traceback:
    [C]: in function 'error'
    ...24/.local/share/nvim/lazy/nvim-ufo/lua/ufo/decorator.lua:143: in function <...24/.local/share/nvim/lazy/nvim-ufo/lua/ufo/decorator.lua:140>
    [C]: in function 'nvim_command'
    ....local/share/nvim/lazy/nui.nvim/lua/nui/popup/border.lua:624: in function '_relayout'
    ...4/.local/share/nvim/lazy/nui.nvim/lua/nui/popup/init.lua:390: in function 'update_layout'
    ...4/.local/share/nvim/lazy/nui.nvim/lua/nui/popup/init.lua:158: in function 'init'
    .../.local/share/nvim/lazy/nui.nvim/lua/nui/object/init.lua:132: in function <.../.local/share/nvim/lazy/nui.nvim/lua/nui/object/init.lua:130>
    ....local/share/nvim/lazy/noice.nvim/lua/noice/view/nui.lua:92: in function 'create'
    ....local/share/nvim/lazy/noice.nvim/lua/noice/view/nui.lua:271: in function 'show'
    ...local/share/nvim/lazy/noice.nvim/lua/noic
Error in decoration provider ufo.end:
Error executing lua: ...24/.local/share/nvim/lazy/nvim-ufo/lua/ufo/decorator.lua:132: attempt to call field 'nvim__redraw' (a nil value)
stack traceback:
    [C]: in function 'error'
    ...24/.local/share/nvim/lazy/nvim-ufo/lua/ufo/decorator.lua:143: in function <...24/.local/share/nvim/lazy/nvim-ufo/lua/ufo/decorator.lua:140>
kevinhwang91 commented 2 months ago

Only this error appeared for the first open?

TioeAre commented 2 months ago

Only this error appeared for the first open?

It seems to happen when read a new buffer or toggle a fold. And :lua =vim.api.nvim__redraw outputs nil

kevinhwang91 commented 2 months ago

Only this error appeared for the first open?

It seems to happen when read a new buffer or toggle a fold. And :lua =vim.api.nvim__redraw outputs nil

I guess it is lazy issue. nlua_init -> nlua_state_init -> nlua_add_api_functions. vim.api.nvim__redraw never become nil after nvim initialized except other plugins make it to be nil.

Uninstall lazy and try again.

TioeAre commented 2 months ago

I tried the latest nvim v0.10.1 just now, and the error seems disappeared.

Before that, my nvim version is NVIM v0.10.0-dev-2999+g38b9c322c.

Thank you very much for your reply!