kevinhwang91 / nvim-ufo

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

UnhandledPromiseRejection for neogit commits #29

Closed zbindenren closed 2 years ago

zbindenren commented 2 years ago

Neovim version (nvim -v | head -n1)

NVIM v0.7.2

Operating system/version

arch linux

How to reproduce the issue

  1. commiting a message with neogit

Expected behavior

No error.

Actual behavior

I still get the error:

error executing vim.schedule lua callback: UnhandledPromiseRejection with the reason:                                                                           
{ ["code"] = 0, ["message"] = stat /home/rz/repos/gitlab.pnet.ch/linux/ces/agent/.git/NEOGIT_COMMIT_EDITMSG: no such file or ```

Even with the following configuration:

local ftMap = {
    vim = "indent",
    git = "",
    NEOGIT_COMMIT_EDITMSG = "",
}

``` lua
-- global handler
ufo.setup({
    fold_virt_text_handler = handler,
    provider_selector = function(bufnr, filetype)
        -- return a string type use internal providers
        -- return a string in a table like a string type
        -- return empty string '' will disable any providers
        -- return `nil` will use default value {'lsp', 'indent'}
        return ftMap[filetype]
    end,
})

Not sure what I am doing wrong.

kevinhwang91 commented 2 years ago

tail -f ~/.cache/nvim/ufo.log

zbindenren commented 2 years ago

ufo.log.gz

kevinhwang91 commented 2 years ago

mul clients issue. Thanks, I should add a simple selector.

kevinhwang91 commented 2 years ago

No idea why your .../NEOGIT_COMMIT_EDITMSG file will ask gopls, this buffer shouldn't be attached, may something is wrong with your neogit config.

NeogitCommitMessage as ft instead

stevanmilic commented 2 years ago

@kevinhwang91 I'm getting a similar error message:

Error executing vim.schedule lua callback: UnhandledPromiseRejection with the reason:
.../site/pack/packer/start/nvim-ufo/lua/ufo/fold/buffer.lua:192: Invalid buffer id: 1

by disabling all the providers:

require("ufo").setup({
    open_fold_hl_timeout = 0,
    provider_selector = function(bufnr, filetype)
        -- return empty string '' will disable any providers
        return ''
    end
})
kevinhwang91 commented 2 years ago

@stevanmilic fixed now. but not relate to this issue. UnhandledPromiseRejection means throwing errors in promise body.

kevinhwang91 commented 2 years ago

ping me if has new info