Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace conflict with notomo/promise.nvim #8

Open
romgrk opened this issue Jun 19, 2022 · 5 comments
Open

Namespace conflict with notomo/promise.nvim #8

romgrk opened this issue Jun 19, 2022 · 5 comments
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed

Comments

@romgrk
Copy link

romgrk commented Jun 19, 2022

Neovim version (nvim -v | head -n1)

0.8.0-dev

Operating system/version

archlinux

How to reproduce the issue

  1. Install the plugin, including the minimal configuration, with coc-nvim
  2. Start neovim

Expected behavior

Plugin works

Actual behavior

There are a few issues, first one is:

Error executing vim.schedule lua callback: unhandled promise rejection: { "/home/romgrk/.config/nvim/bundle/nvim-ufo/lua/ufo/utils.lua:110: attempt to call a table value" }
stack traceback:
        [C]: in function 'error'
        ...rk/.config/nvim/bundle/promise.nvim/lua/promise/init.lua:65: in function <...rk/.config/nvim/bundle/promise.nvim/lua/promise/init.lua:63>

It is solved by add require('promise').new(...) here:

return require('promise')(function(resolve)

The second issue (after fixing the one above) is:

Error detected while processing BufWritePost Autocommands for "*":
E5108: Error executing lua /home/romgrk/.config/nvim/bundle/nvim-ufo/lua/ufo/fold.lua:201: attempt to call method 'thenCall' (a nil value)
stack traceback:
        /home/romgrk/.config/nvim/bundle/nvim-ufo/lua/ufo/fold.lua:201: in function 'listener'
        /home/romgrk/.config/nvim/bundle/nvim-ufo/lua/ufo/event.lua:52: in function 'emit'
@romgrk romgrk added the bug Something isn't working label Jun 19, 2022
@romgrk romgrk changed the title Error at plugin startup Namespace conflict with notomo/promise.nvim Jun 19, 2022
@romgrk
Copy link
Author

romgrk commented Jun 19, 2022

Forget all of the above. The root cause is a namespace conflict with https://github.com/notomo/promise.nvim.
Both that plugin and your promise-async try to use the require('promise') namespace in lua.

@kevinhwang91 kevinhwang91 added the help wanted Extra attention is needed label Jun 19, 2022
@kevinhwang91
Copy link
Owner

Even though I have no idea to fix it, please show path about promise-async and promise.nvim.

@romgrk
Copy link
Author

romgrk commented Jun 19, 2022

Both installed with vim-plug. If you see on that repo, they use ./lua/promise.lua as well. You'll need to decide by a duel who keeps the name. Ping @notomo.

The best solution is probably to upstream either one of these into neovim.

@kevinhwang91
Copy link
Owner

I think ufo can add post-installation to install promise-async inside the plugin, depending on the user who has a promise and async module outside ufo.

@kevinhwang91 kevinhwang91 added the enhancement New feature or request label Jun 19, 2022
@notomo
Copy link

notomo commented Jun 19, 2022

@romgrk
Hi. I don't expect notomo/promise.nvim to be installed directly.
You can use my promise.nvim by embedding in your plugins namespace.

ref: https://github.com/notomo/promise.nvim/blob/10b86664130f9668f0fa6549bda660794417aaf7/README.md#L4-L4

Mainly used by embedding lua/promise/init.lua in plugins.

example: https://github.com/notomo/optpack.nvim/blob/119239f099f72c4dd6949862738991593554fee5/lua/optpack/lib/git.lua#L1-L1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants