Shougo / ddu.vim

Dark deno-powered UI framework for Vim/Neovim
MIT License
294 stars 23 forks source link

Freezes when trying to open an item #117

Closed glassesneo closed 4 months ago

glassesneo commented 4 months ago

Warning: I will close the issue without the minimal init.vim and the reproduction instructions.

Problems summary

ddu.vim freezes when narrowing an item and does not react to the key in the config.

Environment Information

Provide a minimal init.vim/vimrc without plugin managers (Required!)

" Your minimal init.vim/vimrc
set rtp+=~/.cache/dpp/repos/github.com/vim-denops/denops.vim
set rtp+=~/.cache/dpp/repos/github.com/Shougo/ddu.vim
set rtp+=~/.cache/dpp/repos/github.com/Shougo/ddu-ui-filer
set rtp+=~/.cache/dpp/repos/github.com/Shougo/ddu-source-file
set rtp+=~/.cache/dpp/repos/github.com/Shougo/ddu-kind-file
set rtp+=~/.cache/dpp/repos/github.com/Shougo/ddu-column-filename
set rtp+=~/.cache/dpp/repos/github.com/Shougo/ddu-filter-sorter_alpha

lua <<EOF
local doAction = vim.fn["ddu#ui#async_action"]

vim.fn["ddu#custom#patch_local"]("filer", {
  ui = "filer",
  uiParams = {
    filer = {
      split = "floating",
      splitDirection = "floating",
      floatingBorder = "rounded",
    },
  },
  sources = { "file" },
  sourceOptions = {
    file = {
      sorters = {
        "sorter_alpha",
      },
      columns = {
        "filename",
      },
    },
  },
})

---@param mode string|string[]
---@param key string
---@param action string
---@param args? table
local function mapAction(mode, key, action, args)
  vim.keymap.set(mode, key, function()
    if args ~= nil and next(args) then
      doAction(action, args)
    else
      doAction(action)
    end
  end, { noremap = true, silent = true, buffer = true })
end

vim.api.nvim_create_autocmd("FileType", {
  pattern = "ddu-filer",
  callback = function()
    mapAction("n", "q", "quit")
    mapAction("n", "<CR>", "itemAction", { name = "narrow" })
    mapAction("n", "l", "expandItem")
    mapAction("n", "h", "collapseItem")
  end,
})
EOF

nnoremap <Space><Space> <Cmd>call ddu#start(#{ name: 'filer' })<CR>
call ddu#start(#{ name: 'filer' })

How to reproduce the problem from neovim/Vim startup (Required!)

  1. start ddu.vim
  2. narrow an item(a file or directory)

Screenshot (if possible)

https://github.com/Shougo/ddu.vim/assets/61031352/32d780ee-6c73-4ee2-915a-864a27d15238

Upload the log messages by :redir and :message (if errored)

Displayed after Control-C

[denops] Failed to handle message 2,invoke,dispatch,ddu,uiAction,filer,itemAction,[object Object] Error: Failed to call 'uiAction' API in 'ddu': Failed to call 'ddu#item_acti
on' in Neovim: function ddu#item_action[1]..ddu#denops#_request[15]..denops#request[1]..denops#_internal#server#chan#request[6]..denops#_internal#rpc#nvim#request, line 1: Vi
m(return):Error invoking 'invoke' on channel 4 (denops):
[denops] Error: Failed to call 'itemAction' API in 'ddu': Failed to call 'denops#api#eval' in Neovim: Keyboard interrupt (code: 0)
[denops]     at Plugin.call (file:///Users/neo/.cache/dpp/repos/github.com/vim-denops/denops.vim/denops/@denops-private/service.ts:175:13)
[denops]     at eventLoopTick (ext:core/01_core.js:168:7)
[denops]     at async Service.#dispatch (file:///Users/neo/.cache/dpp/repos/github.com/vim-denops/denops.vim/denops/@denops-private/service.ts:88:12)
[denops]     at async Service.dispatch (file:///Users/neo/.cache/dpp/repos/github.com/vim-denops/denops.vim/denops/@denops-private/service.ts:93:14)
[denops]     at async dispatch (https://deno.land/x/messagepack_rpc@v2.0.3/dispatcher.ts:36:12)
[denops]     at async Session.#dispatch (https://deno.land/x/messagepack_rpc@v2.0.3/session.ts:244:22)
[denops]     at async Session.#handleRequestMessage (https://deno.land/x/messagepack_rpc@v2.0.3/session.ts:271:33) (code: 0)
[denops]     at Plugin.call (file:///Users/neo/.cache/dpp/repos/github.com/vim-denops/denops.vim/denops/@denops-private/service.ts:175:13)
[denops]     at eventLoopTick (ext:core/01_core.js:168:7)
[denops]     at async Service.#dispatch (file:///Users/neo/.cache/dpp/repos/github.com/vim-denops/denops.vim/denops/@denops-private/service.ts:88:12)
[denops]     at async Service.dispatch (file:///Users/neo/.cache/dpp/repos/github.com/vim-denops/denops.vim/denops/@denops-private/service.ts:93:14)
[denops]     at async dispatch (https://deno.land/x/messagepack_rpc@v2.0.3/dispatcher.ts:36:12)
[denops]     at async Session.#dispatch (https://deno.land/x/messagepack_rpc@v2.0.3/session.ts:244:22)
[denops]     at async Session.#handleNotificationMessage (https://deno.land/x/messagepack_rpc@v2.0.3/session.ts:299:25)
Shougo commented 4 months ago

Fixed.