Shougo / ddu-ui-ff

Fuzzy finder UI for ddu.vim
MIT License
55 stars 26 forks source link

Error opening ddu window with AutoResize option #26

Closed matsui54 closed 2 years ago

matsui54 commented 2 years ago

Problem

Error like this is thrown when opening floating ddu window with the following step.

[denops] error: Uncaught (in worker "ddu") (in promise) Error: Failed to call 'call' with ["ddu#ui#ff#filter#_floating",3,1003,{"autoResize":true,"cursorPos":-1,"displaySourceName":"no","floatingBorder":"none","filterFloatingPosition":"top","filterSplitDirection":"floating","filterUpdateTime":0,"highlights":{},"ignoreEmpty":true,"previewFloating":false,"previewHeight":10,"previewVertical":false,"previewWidth":40,"prompt":"","reversed":false,"split":"floating","splitDirection":"botright","startFilter":false,"winCol":47,"winHeight":20,"winRow":15,"winWidth":95}]: Error: Failed to call 'nvim_call_function' with ["ddu#ui#ff#filter#_floating",[3,1003,{"autoResize":true,"cursorPos":-1,"displaySourceName":"no","floatingBorder":"none","filterFloatingPosition":"top","filterSplitDirection":"floating","filterUpdateTime":0,"highlights":{},"ignoreEmpty":true,"previewFloating":false,"previewHeight":10,"previewVertical":false,"previewWidth":40,"prompt":"","reversed":false,"split":"floating","splitDirection":"botright","startFilter":false,"winCol":47,"winHeight":20,"winRow":15,"winWidth":95}]]: [0,"Vim(call):E5555: API call: Wrong type for argument 1 when calling nvim_win_set_config, expecting Window"]
[denops]     at Session.call (https://deno.land/x/msgpack_rpc@v3.1.4/session.ts:207:13)
[denops]     at async Service.call (file:///home/denjo/.cache/dein/.cache/init.vim/.dein/denops/@denops-private/service.ts:86:12)
[denops]     at async Session.call (file:///home/denjo/.cache/dein/.cache/init.vim/.dein/denops/@denops-private/service.ts:135:14)
[denops]     at async Session.dispatch (https://deno.land/x/msgpack_rpc@v3.1.4/session.ts:99:12)
[denops]     at async https://deno.land/x/msgpack_rpc@v3.1.4/session.ts:108:18
[denops]     at async Session.handleRequest (https://deno.land/x/msgpack_rpc@v3.1.4/session.ts:104:29)
[denops]       throw new Error(
[denops]             ^
[denops]     at Session.call (https://deno.land/x/msgpack_rpc@v3.1.4/session.ts:207:13)
[denops]     at async DenopsImpl.call (file:///home/denjo/.cache/dein/.cache/init.vim/.dein/denops/@denops/impl.ts:28:12)
[denops]     at async Ui.redraw (file:///home/denjo/.cache/dein/.cache/init.vim/.dein/denops/@ddu-uis/ff.ts:174:9)
[denops]     at async file:///home/denjo/.cache/dein/.cache/init.vim/.dein/denops/ddu/ddu.ts:269:7
[denops]     at async Lock.with (https://deno.land/x/async@v1.1.5/lock.ts:23:7)
[denops]     at async Ddu.redraw (file:///home/denjo/.cache/dein/.cache/init.vim/.dein/denops/ddu/ddu.ts:268:5)
[denops]     at async readChunk (file:///home/denjo/.cache/dein/.cache/init.vim/.dein/denops/ddu/ddu.ts:193:11)
[denops] error: Uncaught (in promise) Error: Unhandled error event in child worker.
[denops]     at Worker.#pollControl (deno:runtime/js/11_workers.js:168:21)
[denops] Server stopped (1). Restarting...
[denops] Server is restarted.

environment

Neovim v0.7.0

Minimal vimrc

set runtimepath+=~/.cache/dein/repos/github.com/vim-denops/denops.vim
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/ddu.vim
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/ddu-ui-ff
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/ddu-kind-file
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/ddu-source-file

nnoremap <Space>f
      \ <Cmd>call ddu#start({'sources': [{'name': 'file'}]})<CR>

call ddu#custom#patch_global({
      \ 'ui': 'ff',
      \ 'uiParams': {'ff': {
      \   'split': 'floating',
      \   'autoResize': v:true,
      \ }},
      \ })

autocmd FileType ddu-ff call s:ddu_ff_my_settings()
function! s:ddu_ff_my_settings() abort
  nnoremap <buffer> i
        \ <Cmd>call ddu#ui#ff#do_action('openFilterWindow')<CR>
  nnoremap <buffer> q
        \ <Cmd>call ddu#ui#ff#do_action('quit')<CR>
endfunction

autocmd FileType ddu-ff-filter call s:ddu_filter_my_settings()
function! s:ddu_filter_my_settings() abort
  inoremap <buffer> <CR> <Esc><Cmd>close<CR>
endfunction

Reproduce steps

  1. start nvim and execute <Space>f (start ddu)
  2. type i (open filter window) and <CR> (close filter)
  3. type q (quit ddu)
  4. type <Space>f (reopen ddu window) and you will see error
matsui54 commented 2 years ago

Thanks for fixing. But I found the problem related to this issue. Please see https://github.com/Shougo/ddu-ui-ff/issues/27.