kevinhwang91 / nvim-ufo

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

UnhandledPromiseRejection in nightly Neovim #162

Closed MariaSolOs closed 9 months ago

MariaSolOs commented 9 months ago

Neovim version (nvim -v | head -n1)

NVIM v0.10.0-dev-1152+g5a363ccac

Operating system/version

Mac Ventura 13.5.2

How to reproduce the issue

  1. Write the following configuration file in repro.lua:
    
    -- Setting
    vim.o.foldcolumn = "1"
    vim.o.foldlevel = 99
    vim.o.foldlevelstart = -1
    vim.o.foldenable = true

local root = vim.fn.fnamemodify("./.repro", ":p") for , name in ipairs { "config", "data", "state", "cache" } do vim.env[("XDG%s_HOME"):format(name:upper())] = root .. "/" .. name end local lazypath = root .. "/plugins/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system { "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, } end vim.opt.runtimepath:prepend(lazypath)

local plugins = { "kevinhwang91/promise-async", "kevinhwang91/nvim-ufo", } require("lazy").setup(plugins, { root = root .. "/plugins", })

local ufo = require "ufo" ufo.setup() vim.keymap.set("n", "zR", ufo.openAllFolds) vim.keymap.set("n", "zM", ufo.closeAllFolds)


2. Open `neovim` with `nvim --clean -u repro.lua repro.lua`.
3. Open `:messages`.

### Expected behavior

For this plugin to work as expected with no errors.

### Actual behavior

The following error appears:

Error executing vim.schedule lua callback: UnhandledPromiseRejection with the reason:
...osolano/.local/share/nvim/lazy/nvim-ufo/lua/ufo/wffi.lua:13: dlsym(RTLD_DEFAULT, find_window_by_handle): symbol not found

MariaSolOs commented 9 months ago

Also interestingly enough, I can only reproduce this when using the Release or RelWithDebInfo Neovim builds, but not with the Debug one.

MariaSolOs commented 9 months ago

cc @bfredl

kevinhwang91 commented 9 months ago

Can't reproduce it under Linux build with Release, looks like your platform issue or cache of build issue. You can disable jit in pre-processing for require'ufo'.setup and enable it in post-processing to force ufo to use normal api to add folds. Like:

local bak = jit
jit = nil
ufo.setup()
jit = bak
MariaSolOs commented 9 months ago

@kevinhwang91 Alright that hack seems to work. Are there any unexpected consequences of using that?

kevinhwang91 commented 9 months ago

It's slow and may block if the provider produces a lot of fold ranges. Using ffi will get better performance.

rockyzhang24 commented 9 months ago

I can't reproduce it.

M1 (ARM) chip macOS Ventura 13.5.2 NVIM v0.10.0-dev-1046+g3afbf4745

MariaSolOs commented 9 months ago

@rockyzhang24 it doesn't seem that you're on the latest nightly.

rockyzhang24 commented 9 months ago

Just now I rebuilt nvim with the latest commit, and still no errors.

I built it using

make CMAKE_BUILD_TYPE=RELEASE
sudo make install

NVIM v0.10.0-dev-1164+g23c21e763

MariaSolOs commented 9 months ago

@rockyzhang24 interesting. The only other thing I can think about is that I install Neovim under $HOME/neovim, not the default location. It would be weird for that to matter though.

ecosse3 commented 9 months ago

I have the same issue on master branch of neovim.

make CMAKE_BUILD_TYPE=RelWithDebInfo
sudo make install

NVIM v0.10.0-dev-1164+g23c21e763

dundargoc commented 9 months ago

I'm pretty sure this should now be fixed on neovim master. Lemme know if it still doesn't work please.

MariaSolOs commented 9 months ago

@dundargoc works for me, thank you!