Code Monkey home page Code Monkey logo

ddu.vim's Introduction

ddu.vim

Dark deno-powered UI framework for neovim/Vim

If you don't want to configure plugins, you don't have to use the plugin. It does not work with zero configuration. You can use other plugins.

Doc

Please read help for details.

NOTE: I have created Japanese article for ddu.vim.

Ddu is the abbreviation of "dark deno-powered UI". It provides an extensible and asynchronous UI framework for neovim/Vim.

The development is supported by github sponsors. Thank you!

Introduction

I have chosen denops.vim framework to create new plugin. Because denops.vim is better than neovim Python interface.

  • Easy to setup
  • Minimal dependency
  • Stability
  • neovim/Vim compatibility
  • Speed
  • Library
  • Easy to hack

Screenshots

Please see: #10

ddu.vim

Install

NOTE: Ddu.vim requires Neovim (0.8.0+ and of course, latest is recommended) or Vim 9.0.1276+. See requirements if you aren't sure whether you have this.

Requirements

Ddu.vim requires both Deno 1.42+ and denops.vim.

NOTE: Ddu.vim does not include any extra plugins. You must install them you want manually. You can search ddu plugins from here.

ddu.vim's People

Contributors

4513echo avatar chiastolite avatar gamoutatsumi avatar hasundue avatar hokorobi avatar hori-ryota avatar kamecha avatar kuuote avatar kyoh86 avatar lambdalisue avatar matsui54 avatar milly avatar n-ombro avatar ryota2357 avatar shougo avatar shun avatar uga-rosa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ddu.vim's Issues

Tree expanded does not be kept by `resume` with `toggle`

Problems summary

If I set resume and toggle to true, resume does not work.

This behavior occurs from f69b3e3

Expected

Keep the previous state.

Environment Information

  • ddu.vim version (SHA1): latest

  • denops.vim version (SHA1): latest

  • deno version(deno -V output): deno 1.36.0

  • OS: MacOS

  • neovim/Vim :version output:

NVIM v0.10.0-dev-780+g8afdc1f38-Homebrew
Build type: Release
LuaJIT 2.1.0-beta3
Run ":verbose version" for more info

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

if !has("nvim")
  set nocompatible
  filetype plugin indent on
  syntax enable
endif

let s:plugins = [
      \ 'vim-denops/denops.vim',
      \ 'Shougo/ddu.vim',
      \ 'Shougo/ddu-ui-filer',
      \ 'ryota2357/ddu-column-icon_filename',
      \ 'Shougo/ddu-source-file',
      \ 'Shougo/ddu-kind-file',
      \ ]
for item in s:plugins
  execute 'set runtimepath+=~/.cache/dein/repos/github.com/' .. item
endfor

call ddu#custom#patch_global(#{
    \   ui: 'filer',
    \   sources: [{'name': 'file'}],
    \   resume: v:true,
    \   sourceOptions: #{
    \     _: { 'columns': ['icon_filename'] }
    \   },
    \   uiOptions: #{
    \     _: #{ toggle: v:true }
    \   },
    \   kindOptions: #{
    \     file: #{
    \       defaultAction: 'open',
    \     },
    \   }
    \ })

autocmd FileType ddu-filer call s:ddu_my_settings()
function! s:ddu_my_settings() abort
  nnoremap <buffer><expr> <CR> ddu#ui#get_item()->get('isTree', v:false)
    \ ? "<Cmd>call ddu#ui#sync_action('expandItem', {'mode': 'toggle'})<CR>"
    \ : "<Cmd>call ddu#ui#sync_action('itemAction')<CR>"
  nnoremap <buffer> q <Cmd>call ddu#ui#sync_action('quit')<CR>
endfunction

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

  1. start neovim
  2. call ddu#start().
  3. <CR> on the directory to expand the tree.
  4. call ddu#start() to quit.
  5. call ddu#start() to restart.

ddu screenshots

I want to add the screenshots link in README.
If you have good screenshots for ddu.vim, can you add it in this issue?

Fails the first time it is run.

Problems summary

Fails the first time it is run.
However, after the second time, it succeeds.

Expected

Succeeds the first time it is run.

Environment Information

  • ddu.vim version (SHA1): ca165d2

  • denops.vim version (SHA1): 788c6702aec71544c575766d79c399dec6e7a26c

  • deno version(deno -V output): deno 1.19.0

  • OS: Mac

  • neovim/Vim :version output:

NVIM v0.7.0-dev+1115-g5cb45dffb
Build type: Release
LuaJIT 2.1.0-beta3
  • :checkhealth or :CheckHealth result(neovim only): OK

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

if &compatible
    set nocompatible
endif
let $CACHE = expand('~/.cache')
if !isdirectory(expand($CACHE))
    call mkdir(expand($CACHE), 'p')
endif
let s:dein_dir = expand('$CACHE/dein')
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'
if &runtimepath !~# '/dein.vim'
    if !isdirectory(s:dein_repo_dir)
        execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
    endif
    execute 'set runtimepath^=' . s:dein_repo_dir
endif

call dein#begin(s:dein_dir, expand('<sfile>'))

call dein#load_toml('~/.config/nvim/dein/deinlazy.toml', {'lazy': 1})

call dein#end()

filetype plugin indent on
syntax enable

deinlazy.toml

# Using Deno on plugin
[[plugins]]
repo = 'vim-denops/denops.vim'
[[plugins]]
repo = 'Shougo/ddu.vim'
depends = 'denops.vim'
hook_source = '''
call ddu#custom#patch_global({
    \ 'ui': 'ff',
    \ })
'''
[[plugins]]
repo = 'Shougo/ddu-ui-ff'
on_source = 'ddu.vim'
[[plugins]]
repo = 'Shougo/ddu-source-file_rec'
on_source = 'ddu.vim'

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

  1. Start Neovim.
  2. Run call dein#update() command.
  3. Restart Neovim.
  4. Run call ddu#start({'sources': [{'name': 'file_rec'}]}) command.

Screenshot (if possible)

スクリーンショット 2022-02-20 0 34 00

This error will occur even if you do not lazy load denops.vim.
スクリーンショット 2022-02-20 1 03 12

Existing windows is clearerd When select an action on chooseAction

Problems summary

Expected

Environment Information

  • ddu.vim version (SHA1):

  • denops.vim version (SHA1):

  • deno version(deno -V output):

  • OS:

  • neovim/Vim :version output:

  • :checkhealth or :CheckHealth result(neovim only):

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

" Your minimal init.vim/vimrc
set runtimepath+=~/path/to/ddu.vim/

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

  1. foo
  2. bar
  3. baz

Screenshot (if possible)

Redraw via `ddu#custom#action` seems not work

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

Problems summary

SSIA

Expected

redraw via ddu#custom#action will work.

Environment Information

  • ddu.vim version (SHA1):
    955949d
  • denops.vim version (SHA1):
    ebda886
  • deno version(deno -V output):
    deno 1.38.5
  • OS:
    WSL Ubuntu 22.04.3
  • neovim/Vim :version output:
    NVIM v0.10.0-dev-1846+gf31f260f0
    Build type: RelWithDebInfo
    LuaJIT 2.1.1702233742

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

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

function s:custom_test(args) abort
	call ddu#ui#do_action('updateOptions', {
				\ 'uiParams': {
				\   'ff': {
				\     'filterFloatingTitle': 'update Title !!!',
				\   }
				\ }
				\})
        " ↓Even if I comment out this redraw action, there is no change
	call ddu#ui#do_action('redraw', { 'method': 'uiRedraw' })
	return 2 " Redraw
endfunction

call ddu#custom#action('ui', 'ff', 'updateTitle', function('s:custom_test'))

nnoremap [ddu] <Nop>
nmap <Space>u [ddu]
nmap <silent> [ddu]f <Cmd>call ddu#start({
			\ 'ui': 'ff',
			\ 'uiParams': {
			\   'ff': {
			\     'split': 'floating',
			\     'floatingBorder': 'rounded',
			\   }
			\ },
			\ 'sources': [{'name': 'file_rec', 'params': {}}],
			\ })<CR>

autocmd FileType ddu-ff call s:ddu_my_settings()

function! s:ddu_my_settings() abort
	nnoremap <buffer> u
				\ <Cmd>call ddu#ui#do_action('updateTitle')<CR>
	nnoremap <buffer><silent> q
				\ <Cmd>call ddu#ui#do_action('quit')<CR>
endfunction

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

  1. type <Space> u f to start ddu
  2. type u on ddu window to fire updateTitle custom action
  3. title does not appear...

Screenshot (if possible)

hoge

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

A source plugin that uses a delayed callback deadlocks when called from ui#do_action()

Problems summary

Implement a source plugin that waits for the result of a deferred callback via denops#notify() from Vim.
Calling this source from ddu#start() works fine, but calling it from ui#do_action() deadlocks and freezes the Vim UI.
Internally, it is fine when called with denops#notify(), and deadlocks when called with denops#request().

Expected

Do not deadlock.
We can create a source plugin that waits for a delayed callback via denops#notify().

Environment Information

deno 1.32.3
  • OS: Windows 10

  • neovim/Vim :version output:

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Mar 23 2023 23:48:58)
MS-Windows 64-bit console version
Included patches: 1-1425

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

The files below are also in the gist.

vimrc and test function

let $LANG = 'C'
set nocompatible

set rtp^=C:/work/vim/denops.vim
set rtp^=C:/work/vim/ddu.vim
set rtp^=C:/work/vim/ddu-ui-ff
set rtp^=C:/work/vim/ddu-kind-word
set rtp^=C:/work/vim/ddu-source-action
set rtp^=C:/work/vim/ddu-source-callbackfreeze

call ddu#custom#patch_global(#{ ui: 'ff' })

augroup my-ddu-ff
  autocmd!
  autocmd FileType ddu-ff call SetupDduFF()
augroup END

function! SetupDduFF() abort
  nnoremap <buffer><nowait> a  <Cmd>call ddu#ui#do_action('chooseAction')<CR>
  nnoremap <buffer><nowait> q  <Cmd>call ddu#ui#do_action('quit')<CR>
endfunction

function! Test() abort
  " Start source-callbackfreeze and ui-ff is shown.
  call ddu#start(#{ sources: [#{ name: 'callbackfreeze' }] })

  " Press 'a' in ui-ff and source-acition is shown.
  call timer_start(2000, {_ -> feedkeys('a')})

  " Press 'q' in ui-ff and source-acition is quit.
  " Then source-callbackfreeze shows again and refresh data.
  " But refresh process deadlocks and Vim freezes.
  call timer_start(4000, {_ -> feedkeys('q')})

  " The error is caused by source-callbackfreeze timeout.
endfunction

sample ddu-source

// denops/@ddu-sources/callbackfreeze.ts

import {
  BaseSource,
  type GatherArguments,
  type OnInitArguments,
} from "https://deno.land/x/[email protected]/base/source.ts";
import { type Denops } from "https://deno.land/x/[email protected]/deps.ts";
import type { Item } from "https://deno.land/x/[email protected]/types.ts";
import * as lambda from "https://deno.land/x/[email protected]/lambda/mod.ts";

const TIMEOUT = 10_000; // [msec]

type Params = Record<string, never>;

export class Source extends BaseSource<Params> {
  override kind = "word";

  override params(): Params {
    return {};
  }

  override async onInit(_: OnInitArguments<Params>): Promise<void> {}

  override gather(args: GatherArguments<Params>): ReadableStream<Item[]> {
    const { denops } = args;
    return new ReadableStream({
      start: async (controller) => {
        const data = await this.#getDataFromVim(denops);
        controller.enqueue([{
          word: `Vim's data: ${data}`,
        }]);
        controller.close();
      },
    });
  }

  async #getDataFromVim(denops: Denops): Promise<unknown> {
    const data = await new Promise(
      (resolve, reject) => {
        const id = lambda.register(
          denops,
          (...args: unknown[]) => resolve(args),
          { once: true },
        );
        setTimeout(() => reject(new Error("timeout")), TIMEOUT);

        // This call is blocked if this source called from denops#request()
        denops.eval(
          "timer_start(100, {_ -> denops#notify(name, id, ['foobar'])})",
          { id, name: denops.name },
        );

      },
    );
    return data;
  }
}

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

  1. Start with vim -Nu vimrc.
  2. Do :call Test().

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

(Edited line breaks easier to see.)

Error detected while processing function ddu#ui#do_action[5]
  ..ddu#ui_action[1]
  ..ddu#_request[22]
  ..denops#request[1]
  ..denops#server#request[4]
  ..denops#_internal#server#chan#request[4]
  ..denops#_internal#rpc#vim#request[3]
  ..function ddu#ui#do_action[5]
  ..ddu#ui_action[1]
  ..ddu#_request[22]
  ..denops#request[1]
  ..denops#server#request[4]
  ..denops#_internal#server#chan#request[4]
  ..denops#_internal#rpc#vim#request:
line    3:
E605: Exception not caught:
Error: Failed to call 'uiAction' with ["default","quit",{}]:
Error: Failed to call 'call' with ["ddu#pop","default"]:
Error: Failed to call 'ddu#pop(default)':
Error: Failed to call 'pop' with ["default",{}]:
Error: timeout
    at file:///C:/work/vim/ddu-source-callbackfreeze/denops/@ddu-sources/callbackfreeze.ts:46:33
    at Object.action (ext:deno_web/02_timers.js:146:11)
    at handleTimerMacrotask (ext:deno_web/02_timers.js:63:10)
    at Session.call (https://deno.land/x/[email protected]/session.ts:207:13)
    at async Service.dispatch (file:///C:/work/vim/denops.vim/denops/@denops-private/service.ts:117:14)
    at async dispatch (file:///C:/work/vim/denops.vim/denops/@denops-private/host/vim.ts:85:12)
    at async Session.<anonymous> (file:///C:/work/vim/denops.vim/denops/@denops-private/host/vim.ts:57:14)
function ddu#ui#do_action[5]
  ..ddu#ui_action[1]
  ..ddu#_request[22]
  ..denops#request[1]
  ..denops#server#request[4]
  ..denops#_internal#server#chan#request[4]
  ..denops#_internal#rpc#vim#re

`ddu-source-option-volatile` not worked when exists sources that have not been completed.

Problems summary

ddu-source-option-volatile not worked immediately when exists sources that have not been completed.
It causes is block redraw by lock.

await lock.lock(async () => {

Expected

Immediately refresh starting.

Environment Information

  • ddu.vim version (SHA1): 0fffa32

  • denops.vim version (SHA1): ea7370bf5d323e83ee13ccba35f56e06db5753e1

  • deno version(deno -V output): deno 1.37.2

  • OS: Arch Linux

  • neovim/Vim :version output: NVIM v0.10.0-dev-1301+g30d311ebc-dirty

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

init.vim

set rtp+=/path/to/vim-denops/denops.vim
set rtp+=/path/to/Shougo/ddu.vim
set rtp+=/path/to/Shougo/ddu-ui-ff

autocmd FileType ddu-ff nnoremap i <Cmd>call ddu#ui#do_action('openFilterWindow')<CR>
autocmd FileType ddu-ff-filter nnoremap <CR> <Esc><Cmd>call ddu#ui#do_action('closeFilterWindow')<CR>
autocmd FileType ddu-ff-filter inoremap <CR> <Esc><Cmd>call ddu#ui#do_action('closeFilterWindow')<CR>
call ddu#register('source', expand('<sfile>:p:h') .. '/while.ts')
call ddu#start({
\   'sources': [{
\     'name': 'while',
\     'options': {
\       'volatile': v:true,
\     }
\   }],
\   'ui': 'ff',
\ })

while.ts

import { abortable } from "https://deno.land/[email protected]/async/mod.ts";
import { BaseSource, Item } from "https://deno.land/x/[email protected]/types.ts";

type Never = Record<PropertyKey, never>;

export class Source extends BaseSource<Never> {
  gather(): ReadableStream<Item<unknown>[]> {
    console.log(`gather start ${Math.random()}`);
    const abortController = new AbortController();
    return new ReadableStream({
      start: async (controller) => {
        try {
          while (true) {
            await abortable(
              new Promise((resolve) => setTimeout(resolve, 1000)),
              abortController.signal,
            );
            controller.enqueue([{
              word: String(Math.random()),
            }]);
          }
        } finally {
          controller.close();
        }
      },
      cancel(reason): void {
        abortController.abort();
        console.log(`gather cancel ${Math.random()}`);
        console.log(reason);
      },
    });
  }
  params(): Never {
    return {};
  }
}

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

  1. nvim -u init.vim
  2. type i and typing some characters.

`abbr` は `display` の方が妥当ではないか?

こういうのどこに意見したら良いかわからないのでここに書きます。
abbr はabbreviation《略語》のことだと思うのですが、denite.nvimと同じように候補リスト上での表示テキストとして扱われる物なら、 display (または displayText )などの方が適切だと思うのですが、どうでしょうか?
denite.nvimをカスタマイズしようとしたときに、 abbr の方が word よりも長かったりして(e.g. grep source)、 wordabbr のどちらが何なのか混乱したことがあるためです。
まだアルファの段階ということで、変えるなら今のうちかなと思い意見しました。

ddu is reopened soon after closed when some autocmd BufEnter is defined.

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

Problems summary

When I configured autocmd BufEnter to open ddu when path is directory, ddu reopened soon after closed.

Expected

ddu is not reopened.

Environment Information

  • ddu.vim version (SHA1): 1bf2e4b

  • denops.vim version (SHA1): 6b29032365f82fc1ef78d206e4019fd510ea51fb

  • deno version(deno -V output): deno 1.36.0

  • OS: macOS 13.5.1

  • neovim/Vim :version output:

NVIM v0.10.0-dev-82150ca
Build type: Release
LuaJIT 2.1.0-beta3

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

let g:loaded_netrw = 1
let g:loaded_netrwPlugin = 1
let g:loaded_netrwSettings = 1
let g:loaded_netrwFileHandlers = 1

let s:cache_dir = expand("~/.cache/nvim/dein")
let s:denops = s:cache_dir . "/repos/github.com/vim-denops/denops.vim"
let s:ddu = s:cache_dir . "/repos/github.com/Shougo/ddu.vim"
let s:ddu_ui_filer = s:cache_dir . "/repos/github.com/Shougo/ddu-ui-filer"
let s:ddu_source_file = s:cache_dir . "/repos/github.com/Shougo/ddu-source-file"
let s:ddu_kind_file = s:cache_dir . "/repos/github.com/Shougo/ddu-kind-file"
let s:ddu_column_filename = s:cache_dir . "/repos/github.com/Shougo/ddu-column-filename"

execute 'set runtimepath+=' . s:denops
execute 'set runtimepath+=' . s:ddu
execute 'set runtimepath+=' . s:ddu_ui_filer
execute 'set runtimepath+=' . s:ddu_source_file
execute 'set runtimepath+=' . s:ddu_kind_file
execute 'set runtimepath+=' . s:ddu_column_filename

call ddu#custom#patch_global({
    \   'ui': 'filer',
    \   'sources': [{'name': 'file', 'params': {}}],
    \   'sourceOptions': {
    \     '_': {
    \       'columns': ['filename'],
    \     },
    \   },
    \   'kindOptions': {
    \     'file': {
    \       'defaultAction': 'open',
    \     },
    \   }
    \ })
autocmd FileType ddu-filer call s:ddu_my_settings()
function! s:ddu_my_settings() abort
  nnoremap <buffer><silent> <CR>
        \ <Cmd>call ddu#ui#filer#do_action('itemAction')<CR>
  nnoremap <buffer><silent> q
        \ <Cmd>call ddu#ui#filer#do_action('quit')<CR>
endfunction

function! s:ddu_hijack() abort
  let l:path = expand('%:p')
  if isdirectory(l:path)
    call ddu#start()
  endif
endfunction

augroup ddu_hijack
  autocmd!
  autocmd BufEnter * call s:ddu_hijack()
augroup END

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

  1. cd to directory which has some text files.
  2. execute nvim .
  3. select a file and Enter <CR>

Screenshot (if possible)

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

ddu.vim cannot show multiple columns

Problems summary

Using multiple columns, but I can see only one last column.

Expected

Multiple columns are shown.

After the minimal init.vim and setup script below run, I expect TestStart() shows slug (filename without ext) and title (from frontmatter) like:

foo bar

Environment Information

  • ddu.vim version (SHA1): 11c81d8a4f3f05f88f1254b3086557a3a1041fab

  • denops.vim version (SHA1): 62b1d22b3e60fcc9e570a531a5af1e4b2393c15a

  • deno version(deno -V output): deno 1.34.3

  • OS: Arch Linux in WSL2

  • neovim/Vim :version output:

NVIM v0.10.0-dev-2afb047
Build type: Release
LuaJIT 2.1.0-beta3
Run ":verbose version" for more info

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

set rtp+=~/test_ddu_vim_64/plug/denops.vim
set rtp+=~/test_ddu_vim_64/plug/ddu.vim
set rtp+=~/test_ddu_vim_64/plug/ddu-ui-ff
set rtp+=~/test_ddu_vim_64/plug/ddu-kind-file
set rtp+=~/test_ddu_vim_64/plug/ddu-source-zenn_dev

function! TestStart()
  call ddu#start(#{
    \   name: "ddu-zenn_dev",
    \   sources: [ #{ name: "zenn_dev_article" } ],
    \   sourceOptions: #{ _: #{ path: expand("~/test_ddu_vim_64"), columns: [ "zenn_dev_slug", "zenn_dev_title" ] } },
    \   ui: "ff",
    \ })
endfunction

And it depends on some files & plugins

mkdir -p ~/test_ddu_vim_64/articles

echo '---'           > ~/test_ddu_vim_64/articles/foo.md
echo 'title: "bar"' >> ~/test_ddu_vim_64/articles/foo.md
echo 'emoji: "🐼"'  >> ~/test_ddu_vim_64/articles/foo.md
echo '---'          >> ~/test_ddu_vim_64/articles/foo.md

git clone https://github.com/vim-denops/denops.vim      ~/test_ddu_vim_64/plug/denops.vim
git clone https://github.com/Shougo/ddu.vim             ~/test_ddu_vim_64/plug/ddu.vim
git clone https://github.com/Shougo/ddu-ui-ff           ~/test_ddu_vim_64/plug/ddu-ui-ff
git clone https://github.com/Shougo/ddu-kind-file       ~/test_ddu_vim_64/plug/ddu-kind-file
git clone https://github.com/kyoh86/ddu-source-zenn_dev ~/test_ddu_vim_64/plug/ddu-source-zenn_dev

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

  1. :call TestStart()

Screenshot (if possible)

image

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

The filter doesn't work.

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

Problems summary

When set in Lua, the filter does not work.

Expected

The filter works even when set in Lua.

Environment Information

  • ddu.vim version (SHA1):fc509869b5d41deee4a70383001c7d793a78a372

  • denops.vim version (SHA1):333aa1783352c346cc4fbaa43217bbc1c07ddbaa

  • deno version(deno -V output):1.18.1

  • OS:Mac

  • neovim/Vim :version output:v0.7.0-dev+956-g6cb670cb2

  • :checkhealth or :CheckHealth result(neovim only):OK

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

if &compatible
    set nocompatible
endif
let $CACHE = expand('~/.cache')
if !isdirectory(expand($CACHE))
    call mkdir(expand($CACHE), 'p')
endif
let s:dein_dir = expand('$CACHE/dein')
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'
if &runtimepath !~# '/dein.vim'
    if !isdirectory(s:dein_repo_dir)
        execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
    endif
    execute 'set runtimepath^=' . s:dein_repo_dir
endif

call dein#begin(s:dein_dir, expand('<sfile>'))

call dein#add('vim-denops/denops.vim')
call dein#add('Shougo/ddu.vim')
call dein#add('Shougo/ddu-commands.vim')
call dein#add('Shougo/ddu-ui-std')
call dein#add('Shougo/ddu-filter-matcher_substring')
call dein#add('Shougo/ddu-source-file_rec')

call dein#end()
call dein#save_state()

lua << EOF
vim.call('ddu#custom#patch_global', 'ui', 'std')
vim.call('ddu#custom#patch_global', 'sourceOptions', '_', matchers, 'matcher_substring')
EOF

autocmd FileType ddu-std call s:ddu_my_settings()
function! s:ddu_my_settings() abort
        nnoremap <buffer><silent> <CR>
        \ <Cmd>call ddu#ui#std#do_map('doAction', {'name' : 'default'})<CR>
        nnoremap <buffer><silent> i
        \ <Cmd>call ddu#ui#std#do_map('openFilterWindow')<CR>
        nnoremap <buffer><silent> q
        \ <Cmd>call ddu#ui#std#do_map('quit')<CR>
endfunction

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

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

  1. Run call dein#update() commnad.
  2. Run Ddu -name=search file_rec -ui-param-startFilter=v:true command.

Screenshot (if possible)

highlight on column is shifted? when fire `expandItem` or `collapseItem`

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

Problems summary

SSIA

Expected

each highlight is correctly setted.

Environment Information

  • ddu.vim version (SHA1):
    71c0fdf

  • denops.vim version (SHA1):
    16d4bbc

  • deno version(deno -V output):
    deno 1.40.1

  • OS:
    macOS 13.6.3 22G436 x86_64

  • neovim/Vim :version output:
    NVIM v0.10.0-dev-1492+g3ca967387-Homebrew
    Build type: Release
    LuaJIT 2.1.1699180677

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

set rtp+=~/.cache/dein/nvim/repos/github.com/vim-denops/denops.vim

" ddu
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu.vim
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-ui-ff
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-source-file
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-column-filename

" you must install https://github.com/kamecha/ddu-column-test
set rtp+=~/workspace/Plugin/ddu-column-test
filetype plugin indent on

" setting for ddu
let s:ddu_setting_json =<< trim END
{
	"ui": "ff",
	"sources": [
		"file"
	],
	"sourceOptions": {
		"_": {
			"columns": [
				"filename",
				{
					"name": "param",
					"params": {
						"text": "unko",
						"highlights": [
							{
								"name": "ddu-column-param",
								"hl_group": "ErrorMsg",
								"width": 1
							}
						]
					}
				}
			]
		}
	}
}
END

call ddu#custom#patch_global(s:ddu_setting_json->join('')->json_decode())

nnoremap <silent> <Leader>d <Cmd>call ddu#start()<CR>

" filetype(ddu-ff) setting

autocmd FileType ddu-ff call s:ddu_ff_setting()

function s:ddu_ff_setting()
	nnoremap <buffer><silent> q
				\	<Cmd>call ddu#ui#do_action('quit')<CR>
	nnoremap <buffer><silent> e
				\	<Cmd>call ddu#ui#do_action('expandItem', #{ mode: "toggle" })<CR>
endfunction

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

you must install ddu-column-test for ddu-column-param.

  1. type <Leader> d to start ddu
  2. type e on directory item
  3. type e on the item which are same before item

Screenshot (if possible)

スクリーンショット 2024-01-27 16 03 01

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

Notes

ddu-column-param 's highlight's col is always startCol.

Filter ordering changed?

Problems summary

I upgraded recently and noticed a behavior change with grep. I had configured converter_display_word and ddu-filter-fzf in order to filter on both the filename and the matched line. Now only the matched line is filtered.

I found a commit newly specifying that filters are applied matcher -> sorter -> converter, and adding logs in converter_display_word and ddu-filter-fzf confirmed this. filter-fzf logged first, then converter_display_word. So both the matcherKey and word for fzf only contain the matched line instead of "$filename: $matchedLine". How can I filter on both?

Environment Information

  • ddu.vim version (SHA1): 67736dd
  • denops.vim version (SHA1): 8b53173370d3c2285abb34569b8d00b73d06eaa3
  • deno version(deno -V output): deno 1.37.2
  • OS: Arch Linux, also happened on macOS
  • neovim/Vim :version output:
NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1697887905

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

if has('vim_starting')
  let s:config_path = stdpath('cache')
  for s:repo in [
    \ 'vim-denops/denops.vim',
    \ 'Shougo/ddu.vim',
    \ 'Shougo/ddu-ui-ff',
    \ 'Shougo/ddu-kind-file',
    \ 'shun/ddu-source-rg',
    \ 'Shougo/ddu-filter-converter_display_word',
    \ 'yuki-yano/ddu-filter-fzf'
  \ ]
    let s:path = s:config_path . '/../dein/repos/github.com/' . s:repo
    let &g:rtp .= ',' . s:path
  endfor
endif

call ddu#custom#patch_global(#{
  \   ui: 'ff',
  \   uiParams: #{
  \     ff: #{
  \       startFilter: v:true,
  \       ignoreEmpty: v:false,
  \       autoResize: v:false,
  \       filterSplitDirection: 'botright',
  \       cursorPos: 0,
  \     }
  \   },
  \   kindOptions: #{
  \     file: #{
  \       defaultAction: 'open',
  \     },
  \   },
  \   filterParams: #{
  \     matcher_fzf: #{
  \       highlightMatched: 'Search',
  \     },
  \   },
  \   sources: [
  \     #{ name: 'rg', },
  \   ],
  \   sourceOptions: #{
  \     _: #{
  \       converters: [
  \         'converter_display_word',
  \       ],
  \       sorters: ['sorter_fzf'],
  \       matchers: ['matcher_fzf'],
  \     },
  \   },
  \   sourceParams: #{
  \     rg: #{
  \       args: ['--column', '--no-heading', '--smart-case', '--color', 'never'],
  \       highlights: #{path: 'Url'},
  \     },
  \   },
  \ })

autocmd FileType ddu-ff-filter call s:ddu_filter_my_settings()
function! s:ddu_filter_my_settings() abort
  inoremap <buffer> <CR>
    \ <Esc><Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  inoremap <buffer> <Esc>
    \ <Esc><Cmd>call ddu#ui#ff#do_action('quit')<CR>
  inoremap <buffer> <C-j>
    \ <Cmd>call ddu#ui#ff#execute(
    \ "call cursor(line('.')+1,0)<Bar>redraw")<CR>
  inoremap <buffer> <C-k>
    \ <Cmd>call ddu#ui#ff#execute(
    \ "call cursor(line('.')-1,0)<Bar>redraw")<CR>
endfunction

nnoremap <space>/
  \ :call ddu#start(#{
  \   sources: [#{name: 'rg', params: #{input: input('pattern-')}}],
  \ })<CR>

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

  1. <space>/ to open grep prompt
  2. type search string and press enter
  3. try to filter results by filename; you will only match characters in the grep output

Screenshot (if possible)

1700668636

Before I upgraded, this fzf filter string types would have matched all results in types.ts first since that's the earliest matching text in $filename $matchedLine.

columns set via source-options have uncorrect params.

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

Problems summary

columns set like bellow does not work well.

#{
  columns: [
    #{ name: "test", params: #{ hoge: "piyo" } }
    #{ name: "test", params: #{ hoge: "poyo" } }
  ]
}

Expected

each columns which has same name but has different params or options, work correctly.

Environment Information

  • ddu.vim version (SHA1):
    5de9271
  • denops.vim version (SHA1):
    886bfa0
  • deno version(deno -V output):
    deno 1.38.0
  • OS:
    WSL2 ubuntu22.04
  • neovim/Vim :version output:
    NVIM v0.10.0-dev-1846+gf31f260f0
    Build type: RelWithDebInfo
    LuaJIT 2.1.1702233742
    Run ":verbose version" for more info

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

firstly you should install repository bellow
https://github.com/kamecha/ddu-column-test

" Your minimal init.vim/vimrc
set rtp+=~/.cache/dein/nvim/repos/github.com/vim-denops/denops.vim

" ddu
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu.vim
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-ui-ff

set rtp+=~/workspace/Plugin/ddu-column-test

filetype plugin indent on

" setting for ddu
let s:ddu_setting_json =<< trim END
{
	"ui": "ff",
	"sources": ["otameshi"],
	"sourceOptions": {
		"_": {
			"columns": [
				{ "name": "param", "params": { "text": " unko" } },
				{ "name": "param", "params": { "text": " test" } }
			]
		}
	}
}
END

call ddu#custom#patch_global(s:ddu_setting_json->join('')->json_decode())

nnoremap <silent> <Leader>d <Cmd>call ddu#start()<CR>

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

  1. type \ d to start ddu
  2. in ui window, the unko does not displayed

Screenshot (if possible)

image

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

Note

If I use ddu#custom#alias like bellow, it can be displayed correctly.

" Your minimal init.vim/vimrc
set rtp+=~/.cache/dein/nvim/repos/github.com/vim-denops/denops.vim

" ddu
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu.vim
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-ui-ff

set rtp+=~/workspace/Plugin/ddu-column-test

filetype plugin indent on

call ddu#custom#alias('column', 'param1', 'param')

" setting for ddu
let s:ddu_setting_json =<< trim END
{
	"ui": "ff",
	"sources": ["otameshi"],
	"sourceOptions": {
		"_": {
			"columns": [
				{ "name": "param", "params": { "text": " unko" } },
				{ "name": "param1", "params": { "text": " test" } }
			]
		}
	}
}
END

call ddu#custom#patch_global(s:ddu_setting_json->join('')->json_decode())

nnoremap <silent> <Leader>d <Cmd>call ddu#start()<CR>

The middle of columns is displayed as the default selected item when a directory is expanded

Problems summary

autochdirを有効にした状態で特定の手順を踏むと、ddu#start()で最初に表示される画面がカラムの途中になる

Environment Information

  • ddu.vim version (SHA1):
    a77be8b

  • denops.vim version (SHA1):
    9dd9ae9da9b8d65916dd44e0e4d881665397de63

  • deno version(deno -V output):
    deno 1.43.5

  • OS:
    MacOS Sonoma 14.5 (M1, 2020)

  • neovim/Vim :version output:
    NVIM v0.10.0
    Build type: Release
    LuaJIT 2.1.1713484068

config

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

vim.fn["ddu#custom#patch_local"]("filer", {
  ui = "filer",
  uiParams = {
    filer = {
      splitDirection = "floating",
      floatingBorder = "rounded",
      previewFloating = true,
      previewFloatingBorder = "rounded",
      previewFloatingTitle = "Preview",
      previewSplit = "horizontal",
    },
  },
  sources = { "file" },
  sourceOptions = {
    file = {
      converters = {
        "converter_devicon",
      },
      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 = "open" })
    mapAction("n", "l", "expandItem")
  end,
})

utils.map("n", "<Space><Space>", function()
  vim.fn["ddu#start"]({
    name = "filer",
    sourceOptions = {
      -- file = {
      --   path = vim.fn.expand("%:p:h"),
      -- },
    },
    uiParams = {
      filer = {
        split = "floating",
      },
    },
  })
end)

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

  1. autochdirが有効な状態で、ddu#start()を上記の設定で実行
  2. 表示されているディレクトリを選択しexpandした後、そのディレクトリ内かどうかに関わらずどこでもいいのでファイルを選択しopenする
  3. openしていったんdduのuiが閉じたところで、もう一度ddu#start()を実行すると
    ※ 2でopenしたファイルが最初のdduの画面で下のほうにあるほど、3で最初に表示される画面が下にズレる

Screenshot (if possible)

動画内ではexpandしたディレクトリの中のファイルをopenしているが他のファイルをopenした場合でも同様に発生を確認

2024-06-03.22.34.24.mov

Broken resume due to an inappropriate equal checking

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

Problems summary

8d1af8a introduced a Strict Equality Comparison for sources, which always becomes false unless an array is reused to point the same instance in the memory.

Expected

Either one of the following.

  • When name is specified, the difference of sources should be ignored.
  • When comparing sources, use a deep equal algorithm.

Environment Information

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

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

  1. :call ddu#start({'name': 'file', 'sources':[{'name':'file'}], 'resume': v:true})<CR>
  2. :close<CR>
  3. :call ddu#start({'name': 'file', 'sources':[{'name':'file'}], 'resume': v:true})<CR> -- doesn't reuse the 1. buffer

Screenshot (if possible)

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

Error occurs when changing selected item while preview is running.

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

Problems summary

Changing the selected item in the preview window when the command specified by TerminalPreviewer has not finished raises E948.

function <lambda>11[1]..<SNR>33_do_auto_action[13]..ddu#ui#ff#do_action[17]..ddu#ui_action[1]..ddu#_request[22]..denops#request[1].
.denops#server#request[4]..denops#_internal#server#chan#request[4]..denops#_internal#rpc#vim#request[3]..function <lambda>11[1]..<S
NR>33_do_auto_action[13]..ddu#ui#ff#do_action[17]..ddu#ui_action[1]..ddu#_request[22]..denops#request[1]..denops#server#request[4].
.denops#_internal#server#chan#request[4]..denops#_internal#rpc#vim#request の処理中にエラーが検出されました:
行    3:
E605: 例外が捕捉されませんでした: Error: Failed to call 'uiAction' with ["default","preview",{}]: BatchError: Vim(enew):E948: ジョ>
ブはまだ実行中です (! を追加でジョブを終了)^@function <lambda>11[1]..<SNR>33_do_auto_action[13]..ddu#ui#ff#do_action[17]..ddu#ui_ac
tion[1]..ddu#_request[22]..denops#request[1]..denops#server#request[4]..denops#_internal#server#chan#request[4]..denops#_internal#r
pc#vim#request[1]..denops#api#vim#batch[4]..denops#api#cmd, 行 2^@    at DenopsImpl.batch (file:///home/tennashi/src/github.com/vim
-denops/denops.vim/denops/@denops-private/impl.ts:55:13)^@    at async batch (https://deno.land/x/[email protected]/batch/batch.ts:
199:3)^@    at async PreviewUi.previewContentsTerminal (file:///home/tennashi/.vim/pack/volt/opt/github.com_Shougo_ddu-ui-ff/denops
/@ddu-ui-ff/preview.ts:167:7)^@    at async PreviewUi.previewContents (file:///home/tennashi/.vim/pack/volt/opt/github.com_Shougo_d
du-ui-ff/denops/@ddu-ui-ff/preview.ts:107:14)^@    at async Ddu.uiAction (file:

Expected

Interrupts the execution of a command and executes the next command.

Environment Information

  • ddu.vim version (SHA1): 07e9a28

  • denops.vim version (SHA1): 8f3899de3d3add07105221262dca90a31c4c2d4c

  • deno version(deno -V output): deno 1.31.1

  • OS: Linux (6.1.0-4-amd64)

  • neovim/Vim :version output:

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Mar  4 2023 19:53:01)
適用済パッチ: 1-1376

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

" Your minimal init.vim/vimrc
set runtimepath+=~/path/to/ddu.vim/
set runtimepath+=~/path/to/ddu-ui-ff/
set runtimepath+=~/path/to/test_kind/

call ddu#custom#patch_global({
\ 'uiParams': {
\   'ff': {
\     'autoAction': {'name': 'preview'},
\   },
\ },
\})
  • ~/path/to/test_kind/denops/@ddu-sources/test.ts
import { BaseSource, Item } from "https://deno.land/x/[email protected]/types.ts";
import { GatherArguments } from "https://deno.land/x/[email protected]/base/source.ts";
import { ActionData } from "../@ddu-kinds/test.ts";

type Params = Record<never, never>;

export class Source extends BaseSource<Params> {
  kind = "test";

  gather(_args: GatherArguments<Params>): ReadableStream<Item<ActionData>[]> {
    return new ReadableStream({
      start(controler) {
        controler.enqueue([
          { word: "test-1", action: { time: 10 } },
          { word: "test-2", action: { time: 20 } },
          { word: "test-3", action: { time: 30 } },
        ]);
        controler.close();
      },
    });
  }

  params(): Params {
    return {};
  }
}
  • ~/path/to/test_kind/denops/@ddu-kinds/test.ts
import {
  ActionArguments,
  ActionFlags,
  BaseKind,
  Previewer,
} from "https://deno.land/x/[email protected]/types.ts";
import { GetPreviewerArguments } from "https://deno.land/x/[email protected]/base/kind.ts";
import { term_start } from "https://deno.land/x/[email protected]/function/vim/mod.ts";

type Params = Record<never, never>;

export type ActionData = {
  time: number;
}

export class Kind extends BaseKind<Params> {
  actions: Record<
    string,
    (args: ActionArguments<Params>) => Promise<ActionFlags>
  > = {};

  getPreviewer(args: GetPreviewerArguments): Promise<Previewer | undefined> {
    const action = args.item.action as ActionData
    return Promise.resolve({
      kind: "terminal",
      cmds: ["sleep", action.time],
    });
  }

  params(): Params {
    return {};
  }
}

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

  1. :call ddu#start({'ui': 'ff', 'sources': [{'name': 'test'}]})
  2. jj (invoke 2 preview commands)

Screenshot (if possible)

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

Feature request: Pass `cwd` to terminal previewers

The "termopen()" function can receive "cwd" as an opts, so I would like to be able to pass this to the terminal previewers.

This is useful when I want to run "git log" using the current buffer path, which has nothing to do with Vim's cwd.

Currently this can be done with "sh -c", but it doesn't work on Windows, which is a problem.

NOTE: git can exec with any cwd by "-C" flag.

Can't use aliased things

Problems summary

sourceなどのaliasを作成して使おうとするとエラーが発生して起動しません。

Expected

以前と同じように使用できるようになってほしいです。

Environment Information

  • ddu.vim version (SHA1): b7684ed

  • denops.vim version (SHA1): 62b1d22b3e60fcc9e570a531a5af1e4b2393c15a

  • deno version(deno -V output): deno 1.35.0

  • OS: Arch Linux

  • neovim/Vim :version output: NVIM v0.10.0-dev-641+g811140e27-dirty

Provide a minimal init.vim/vimrc without plugin managers

set rtp+=/path/to/Shougo/ddu-filter-matcher_substring
set rtp+=/path/to/Shougo/ddu-source-file
set rtp+=/path/to/Shougo/ddu-ui-ff
set rtp+=/path/to/Shougo/ddu.vim
set rtp+=/path/to/vim-denops/denops.vim

call ddu#custom#alias('source', 'f', 'file')
call ddu#custom#alias('filter', 'm', 'matcher_substring')
call ddu#custom#alias('ui', 'f', 'ff')
call ddu#custom#patch_global('sourceOptions', #{file: #{matchers: ['matcher_substring']}})
call ddu#custom#patch_global('sources', [#{name: 'file'}])
call ddu#custom#patch_global('ui', 'ff')
nnoremap a <Cmd>call ddu#start()<CR>
" filter alias
nnoremap b <Cmd>call ddu#start(#{sourceOptions: #{file: #{matchers: ['m']}}})<CR>
" source alias
nnoremap c <Cmd>call ddu#start(#{sources: [#{name: 'f'}]})<CR>
" ui alias
nnoremap d <Cmd>call ddu#start(#{ui: 'f'})<CR>

How to reproduce the problem from neovim/Vim startup

上記のvimrcを使用してVim/Neovimを起動します。
aを押したら正しく起動しますが、b, c, dだとエラーが起きます。

Note

a088887
こちらのコミット以降再現します。

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

[denops] Failed to handle message 2,invoke,dispatch,ddu,start,[object Object] TypeError: Cannot read properties of undefined (reading 'Source')
[denops]     at Extension.getSource (file:///tmp/dein/cache/nvim/.cache/init.vim/.dein/denops/ddu/loader.ts:176:31)
[denops]     at Loader.getSource (file:///tmp/dein/cache/nvim/.cache/init.vim/.dein/denops/ddu/loader.ts:90:37)
[denops]     at Ddu.getSource (file:///tmp/dein/cache/nvim/.cache/init.vim/.dein/denops/ddu/ddu.ts:1452:32)
[denops]     at async Ddu.start (file:///tmp/dein/cache/nvim/.cache/init.vim/.dein/denops/ddu/ddu.ts:221:53)
[denops]     at async file:///tmp/dein/cache/nvim/.cache/init.vim/.dein/denops/ddu/app.ts#379.791514:202:9
[denops]     at async Lock.lock (https://deno.land/x/[email protected]/lock.ts:51:14)
[denops]     at async Object.start (file:///tmp/dein/cache/nvim/.cache/init.vim/.dein/denops/ddu/app.ts#379.791514:180:7)
[denops]     at async dispatch (https://deno.land/x/[email protected]/dispatcher.ts:36:12)
[denops]     at async Session.#dispatch (https://deno.land/x/[email protected]/session.ts:244:22)
[denops]     at async Session.#handleRequestMessage (https://deno.land/x/[email protected]/session.ts:271:33)

Fail to call patch_global when `-V1` given in CLI arguments

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

Problems summary

When I use Neovim with -V[N] options over N >= 1, ddu#custom#global_patch definitely fails with following error.

Error detected while processing function ddu#custom#patch_global[2]..<SNR>69_notify[7]..ddu#denops#_notify[1]..<SNR>70_init:
line   23:
E497: No autocommand match name to substitute for "<amatch>"

Expected

Success to patch global config.

Environment Information

  • ddu.vim version (SHA1): 0ef167492f10642c0aa512f37febb1241517ade1

  • denops.vim version (SHA1): 9dd9ae9da9b8d65916dd44e0e4d881665397de63

  • deno version(deno -V output): deno 1.44.1

  • OS: Arch Linux

  • neovim/Vim :version output:

NVIM v0.11.0-dev-78d3f47
Build type: Release
LuaJIT 2.1.1716656478
Run ":verbose version" for more info

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

set rtp+=/path/to/denops.vim
set rtp+=/path/to/ddu.vim

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

  1. Start Neovim with nvim -V1
  2. :call ddu#custom#patch_global({})

Screenshot (if possible)

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

Error detected while processing function ddu#custom#patch_global[2]..<SNR>69_notify[7]..ddu#denops#_notify[1]..<SNR>70_init:
line   23:
E497: No autocommand match name to substitute for "<amatch>"

a directory in a expanded parent directory is displayed duplicately

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

Problems summary

ディレクトリをexpand→その子ディレクトリに移動した後、narrow({path = ".."})すると同一の子ディレクトリが複数表示される

Environment Information

  • ddu.vim version (SHA1):
    6143d17

  • denops.vim version (SHA1):
    9dd9ae9da9b8d65916dd44e0e4d881665397de63

  • deno version(deno -V output):
    deno 1.43.5

  • OS:
    MacOS Sonoma 14.5 (M1, 2020)

  • neovim/Vim :version output:
    NVIM v0.10.0
    Build type: Release
    LuaJIT 2.1.1713484068

config

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

vim.fn["ddu#custom#patch_local"]("filer", {
  ui = "filer",
  uiParams = {
    filer = {
      splitDirection = "floating",
      floatingBorder = "rounded",
      previewFloating = true,
      previewFloatingBorder = "rounded",
      previewFloatingTitle = "Preview",
      previewSplit = "horizontal",
      split = "floating",
    },
  },
  sources = { "file" },
  sourceOptions = {
    file = {
      converters = {
        "converter_devicon",
      },
      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", "<BS>", "itemAction", { name = "narrow", params = { path = ".." } })
    mapAction("n", "o", "expandItem", { mode = "toggle" })
  end,

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

  1. :call ddu#start(#{name:"filer"}):Ddu -name=filerなどでdduをスタート
  2. 任意のディレクトリをexpandし、その中のディレクトリを選択してnarrow
  3. narrow(path = "..")で最初にexpandしたディレクトリに戻る

Screenshot

2024-06-02.16.08.03.mov

動画内のディレクトリ構造

.
├── elm
│   ├── Main.elm
│   └── elmDir
│       └── sub.elm
├── lua
│   ├── luaDir
│   │   └── sub.lua
│   └── main.lua
└── nim
    ├── main.nim
    └── nimDir
        └── sub.nim

restore option stopped working

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

Problems summary

Expected

An input query and the cursor position should be restored properly.

Environment Information

  • ddu.vim version (SHA1): 7e7a6ae

  • denops.vim version (SHA1): ca660c25fe947e43de60dcc14e5e0ceaa339313d

  • deno version(deno -V output): 1.19.2

  • OS: macOS

  • neovim/Vim :version output:

    NVIM v0.7.0
    Build type: Release
    LuaJIT 2.1.0-beta3
    Compiled by brew@Monterey
    
  • :checkhealth or :CheckHealth result(neovim only):

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

All dependent plugins are up-to-date as of May 27, 2022.

if has('vim_starting')
  let s:config_path = stdpath('config')
  for s:repo in [
    \ 'vim-denops/denops.vim',
    \ 'Shougo/ddu.vim',
    \ 'Shougo/ddu-ui-ff',
    \ 'Shougo/ddu-kind-file',
    \ 'matsui54/ddu-filter-fzy',
  \ ]
    let s:path = s:config_path . '/dein/repos/github.com/' . s:repo
    let &g:rtp .= ',' . s:path
  endfor
endif

call ddu#custom#patch_global({
  \ 'ui': 'ff',
  \ 'sourceOptions': {
    \ 'ghq': {
      \ 'matchers': ['matcher_fzy'],
    \ },
  \ },
\ })

command! Open call s:open()
function! s:open() abort
  call ddu#start({
    \ 'name': 'ghq',
    \ 'sources': [{ 'name': 'ghq' }],
    \ 'uiParams': { 'ff': { 'startFilter': v:true } },
    \ 'resume': v:true,
  \ })
endfunction

augroup _init_ddu
  autocmd!
  autocmd FileType ddu-ff call <SID>init_ddu()
  autocmd FileType ddu-ff-filter call <SID>init_ddu()
augroup END

function! s:init_ddu() abort
  nnoremap <buffer> <Esc> <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  nnoremap <buffer> q <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  nnoremap <buffer> <C-q> <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  inoremap <buffer> <C-q> <Cmd>call ddu#ui#ff#do_action('quit')<CR>

  nnoremap <buffer> <CR> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  inoremap <buffer> <CR> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  nnoremap <buffer> <C-j> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  inoremap <buffer> <C-j> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>

  if &filetype ==# 'ddu-ff-filter'
    inoremap <buffer> <C-p> <Cmd>call ddu#ui#ff#execute("call cursor(line('.')-1,0)")<CR>
    inoremap <buffer> <C-n> <Cmd>call ddu#ui#ff#execute("call cursor(line('.')+1,0)")<CR>
  endif
endfunction

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

  1. Open ddu-ui by :Open
  2. Enter query & move cursor
  3. Quit with <C-q>
  4. Reopen ddu-ui

Screenshot (if possible)

Screen.Recording.2022-05-27.at.17.34.39.mov

It is little inconvenient for not clearing input when action narrow

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

Problems summary

when the refreshItem action is fired, the input in filter window is not cleard.

Expected

When it is, the input is cleared.

Or the behavior can be setting.

Environment Information

  • ddu.vim version (SHA1):
    1f56014

  • denops.vim version (SHA1):
    62b1d22

  • deno version(deno -V output):
    deno 1.30.3

  • OS:
    WSL2 Ubuntu22.04

  • neovim/Vim :version output:
    NVIM v0.9.0-dev-1088+gd66832c76
    Build type: RelWithDebInfo
    LuaJIT 2.1.0-beta3

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

" Your minimal init.vim/vimrc
set rtp+=~/.cache/dein/nvim/repos/github.com/vim-denops/denops.vim
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu.vim
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-ui-ff
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-source-file
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-kind-file

nnoremap [ddu] <Nop>
nmap <Space>u [ddu]
nmap <silent> [ddu]f <Cmd>call ddu#start({
			\ 'ui': 'ff',
			\ 'uiParams': {
			\	'ff': {
			\		'startFilter': v:true,
			\	}
			\ },
			\ 'sources': [
			\	{'name': 'file', 'params': {}},
			\ ],
			\ })<CR>

autocmd FileType ddu-ff call s:ddu_my_settings()

function! s:ddu_my_settings() abort
	setlocal cursorline
endfunction

autocmd FileType ddu-ff-filter call s:ddu_filter_my_settings()

function! s:ddu_filter_my_settings() abort
	inoremap <buffer> <CR>
				\ <ESC><Cmd>call ddu#ui#do_action('itemAction', {'name': 'narrow'})<CR>
	inoremap <buffer> <C-n>
				\ <Cmd>call ddu#ui#do_action("cursorNext")<CR>
	inoremap <buffer> <C-p>
				\ <Cmd>call ddu#ui#do_action("cursorPrevious")<CR>
endfunction

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

neovim/Vim should be started with a path that has a directory under it.

  1. type <Space> u f for start ddu
  2. input any char ( this input by itself doesn't make much sense for not setting any matcher )
  3. select directory and type ''
  4. the items in UI is refreshed, but the input in filter window is remained...

Screenshot (if possible)

ddu-refresh

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

Highlights by filters disappears with columns

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

Problems summary

Highlights added by filters (e.g. matched text highlights by matcher_substring) are disappeared when use with columns. There're only highlights by columns are left.

Expected

Highlights by filters are also shown properly.

Environment Information

  • ddu.vim version (SHA1): ee729b0e125b629309ac033119f468f5cd79b086

  • denops.vim version (SHA1): 4f0bbc933fd700e0d9a0055c569fa45e193fca27

  • deno version(deno -V output): deno 1.39.1

  • OS: macOS Ventura

  • neovim/Vim :version output:

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan  4 2024 22:44:40)
macOS version - arm64
Included patches: 1-4
Compiled by mityu
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term -gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     -perl              +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3/dyn       +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
-cscope            +localmap          -ruby              +wildignore
+cursorbind        -lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con        +mksession         +smartindent       +writebackup
+diff              +modify_fname      +sodium            -X11
+digraphs          +mouse             +sound             -xattr
-dnd               -mouseshape        +spell             -xfontset
-ebcdic            +mouse_dec         +startuptime       -xim
+emacs_tags        -mouse_gpm         +statusline        -xpm
+eval              -mouse_jsbterm     -sun_workshop      -xsmp
+ex_extra          +mouse_netterm     +syntax            -xterm_clipboard
+extra_search      +mouse_sgr         +tag_binary        -xterm_save
-farsi             -mouse_sysmouse    -tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/Users/mityu/.local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -DMACOS_X -DMACOS_X_DARWIN -O2 -Wall -Wno-deprecated-declarations -I/opt/homebrew/Cellar/libsodium/1.0.19/include -D_REENTRANT -I/opt/homebrew/Cellar/libsodium/1.0.19/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: gcc -L/usr/local/lib -o vim -lm -lncurses -L/opt/homebrew/Cellar/libsodium/1.0.19/lib -lsodium -liconv -framework AppKit 

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

  • vimrc.vim
set nocompatible
syntax on

set runtimepath^=~/.cache/vim/pack/minpac/opt/denops.vim
set runtimepath^=~/.cache/vim/pack/minpac/opt/ddu.vim
set runtimepath^=~/.cache/vim/pack/minpac/opt/ddu-ui-ff
set runtimepath^=~/.cache/vim/pack/minpac/opt/ddu-source-file
set runtimepath^=~/.cache/vim/pack/minpac/opt/ddu-filter-matcher_substring

call ddu#register('column', expand('<sfile>:p:h') .. '/test_column.ts')
call ddu#custom#patch_global(#{
    \   ui: 'ff',
    \   sources: [{'name': 'file'}],
    \   sourceOptions: #{
    \     _: #{ columns: ['test_column'], matchers: ['matcher_substring'] }
    \   },
    \   filterParams: #{matcher_substring: #{highlightMatched: 'Search'}},
    \ })

autocmd FileType ddu-ff nnoremap i <Cmd>call ddu#ui#do_action('openFilterWindow')<CR>
autocmd FileType ddu-ff nnoremap q <Cmd>call ddu#ui#do_action('quit')<CR>
autocmd FileType ddu-ff-filter
      \ nnoremap <CR> <Esc><Cmd>call ddu#ui#do_action('closeFilterWindow')<CR>
autocmd FileType ddu-ff-filter
      \ inoremap <CR> <Esc><Cmd>call ddu#ui#do_action('closeFilterWindow')<CR>

nnoremap @ <Cmd>call ddu#start()<CR>
  • test_column.ts
import {
  BaseColumn,
  DduItem,
} from "https://deno.land/x/[email protected]/types.ts";
import { GetTextResult } from "https://deno.land/x/[email protected]/base/column.ts";

type Never = Record<number, never>

export class Column extends BaseColumn<Never> {
    override async getLength(_: Never): Promise<number> {
        return Promise.resolve(14);
    }

    override async getText(args: {
        item: DduItem;
        startCol: number;
    }): Promise<GetTextResult> {
        return Promise.resolve({
            text: "(test-column) " + args.item.word,
            highlights: [{
              name: 'ddu_column_test',
              hl_group: 'Special',
              col: args.startCol,
              width: 14,
            }],
        })
    }

    override params(): Never {
        return {}
    }
}

Note that vimrc.vim and test_column.ts should be placed under the same directory.

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

  1. vim -u /path/to/vimrc.vim
  2. Type @ to start ddu.
  3. Type i to open filtering window.
  4. Type some characters to filter items.

Screenshot (if possible)

  • with no columns
image
  • with test_column
  • image

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

Calling `ddu#set_static_import_path`, error raises

Problems summary

Calling ddu#set_static_import_path, error raises like below.

Error detected while processing function ddu#set_static_import_path:
line    2:
E121: Undefined variable: ddu#denops#_mods
E116: Invalid arguments for function writefile

Expected

No error

Environment Information

  • ddu.vim version (SHA1): e31ef17d43876b75158407fb90a3366720f5d3c7
  • denops.vim version (SHA1): 9dd9ae9da9b8d65916dd44e0e4d881665397de63
  • deno version(deno -V output): deno 1.43.6
  • OS: Arch Linux
  • neovim/Vim :version output:
NVIM v0.11.0-dev-ffbd09e
Build type: Release
LuaJIT 2.1.1716656478
Run ":verbose version" for more info

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

set rtp+=/path/to/rtp/denops.vim
set rtp+=/path/to/rtp/ddu.vim

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

  1. :call ddu#set_static_import_path()

Screenshot (if possible)

2_2  wslhost exe 2024_05_27 21_26_30

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

Error detected while processing function ddu#set_static_import_path:
line    2:
E121: Undefined variable: ddu#denops#_mods
E116: Invalid arguments for function writefile

startFilter being ignored with resume

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

Problems summary

Expected

Respect startFilter: v:true when resuming the UI

Environment Information

  • ddu.vim version (SHA1): 493c0ce933b25bf94d69bfd3eea9307a8de18ddd

  • denops.vim version (SHA1): a104cbff7e47a63978cfb3921da4333465fc6d15

  • deno version(deno -V output): deno 1.19.2

  • OS: macOS

  • neovim/Vim :version output:

NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Monterey

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
     fall-back for $VIM: "/usr/local/Cellar/neovim/0.7.0/share/nvim"

     Run :checkhealth for more info
  • :checkhealth or :CheckHealth result(neovim only):

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

if has('vim_starting')
  let s:config_path = stdpath('config')
  for s:repo in [
    \ 'vim-denops/denops.vim',
    \ 'Shougo/ddu.vim',
    \ 'Shougo/ddu-ui-ff',
    \ 'Shougo/ddu-kind-file',
    \ 'matsui54/ddu-filter-fzy',
  \ ]
    let s:path = s:config_path . '/dein/repos/github.com/' . s:repo
    let &g:rtp .= ',' . s:path
  endfor
endif

call ddu#custom#patch_global({
  \ 'ui': 'ff',
  \ 'sourceOptions': {
    \ 'ghq': {
      \ 'matchers': ['matcher_fzy'],
    \ },
  \ },
\ })

command! Open call s:open()
function! s:open() abort
  call ddu#start({
    \ 'name': 'ghq',
    \ 'sources': [{ 'name': 'ghq' }],
    \ 'uiParams': { 'ff': { 'startFilter': v:true } },
    \ 'resume': v:true,
  \ })
endfunction

augroup _init_ddu
  autocmd!
  autocmd FileType ddu-ff call <SID>init_ddu()
  autocmd FileType ddu-ff-filter call <SID>init_ddu()
augroup END

function! s:init_ddu() abort
  nnoremap <buffer> <Esc> <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  nnoremap <buffer> q <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  nnoremap <buffer> <C-q> <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  inoremap <buffer> <C-q> <Cmd>call ddu#ui#ff#do_action('quit')<CR>

  nnoremap <buffer> <CR> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  inoremap <buffer> <CR> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  nnoremap <buffer> <C-j> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  inoremap <buffer> <C-j> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>

  if &filetype ==# 'ddu-ff-filter'
    inoremap <buffer> <C-p> <Cmd>call ddu#ui#ff#execute("call cursor(line('.')-1,0)")<CR>
    inoremap <buffer> <C-n> <Cmd>call ddu#ui#ff#execute("call cursor(line('.')+1,0)")<CR>
  endif
endfunction

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

  1. Open ddu-ui by :Open
  2. Enter query & move cursor
  3. Quit with <C-q>
  4. Reopen ddu-ui

Screenshot (if possible)

Screen.Recording.2022-07-15.at.20.20.02.mov

The prompt will be hidden.

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

Problems summary

<C-j> hides the prompt.

Expected

<C-j> does not hide the prompt.

Environment Information

  • ddu.vim version (SHA1): 8a765f0

  • denops.vim version (SHA1): e2f17041495123e8ed9baa69098c947c5d7f6358

  • deno version(deno -V output): 1.18.2

  • OS: Mac

  • neovim/Vim :version output:

NVIM v0.7.0-dev+1017-g28d5face2
Build type: Release
LuaJIT 2.1.0-beta3
  • :checkhealth or :CheckHealth result(neovim only): OK

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

if &compatible
    set nocompatible
endif

let $CACHE = expand('~/.cache')

if !isdirectory(expand($CACHE))
    call mkdir(expand($CACHE), 'p')
endif

let s:dein_dir = expand('$CACHE/dein')
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'

if &runtimepath !~# '/dein.vim'
    if !isdirectory(s:dein_repo_dir)
        execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
    endif
    execute 'set runtimepath^=' . s:dein_repo_dir
endif

call dein#begin(s:dein_dir, expand('<sfile>'))

call dein#add('vim-denops/denops.vim')
call dein#add('Shougo/ddu.vim')
call dein#add('Shougo/ddu-commands.vim')
call dein#add('Shougo/ddu-ui-std')
call dein#add('Shougo/ddu-filter-matcher_substring')
call dein#add('Shougo/ddu-source-file_rec')
call dein#add('Shougo/ddu-kind-file')

call dein#end()
call dein#save_state()

call ddu#custom#patch_global({
    \   'ui': 'std',
    \   'sourceOptions': {
    \     '_': {
    \       'matchers': ['matcher_substring'],
    \     },
    \   },
    \   'uiParams': {
    \     'std': {
    \       'split': 'floating',
    \       'prompt': '>'
    \     },
    \   },
    \ })

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

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

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

  1. Start Neovim.
  2. Run call dein#update() commnad.
  3. Restart Neovim.
  4. Run call ddu#start({'sources': [{'name': 'file_rec'}]}) command.
  5. Type i (Open filter)
  6. Type <C-j>

Screenshot (if possible)

スクリーンショット 2022-02-06 20 16 05

mismatched highlight in ddu-column

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

Problems summary

highlights set by the each column plugin does not work well.

Expected

each highlights is set correctly.

Environment Information

  • ddu.vim version (SHA1):
    1b098b9
  • denops.vim version (SHA1):
    886bfa0
  • deno version(deno -V output):
    deno 1.38.0
  • OS:
    WSL2 Ubuntu22.04.3 LTS
  • neovim/Vim :version output:
    NVIM v0.10.0-dev-1846+gf31f260f0
    Build type: RelWithDebInfo
    LuaJIT 2.1.1702233742
    Run ":verbose version" for more info

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

Firstly, you have to clone this repository and install nerdfont. this repository is created for testing ddu-column.

https://github.com/kamecha/ddu-column-test

and write vimrc like bellow. ( the vimrc is included in ddu-column-test as min.vim)

" Your minimal init.vim/vimrc
set rtp+=~/.cache/dein/nvim/repos/github.com/vim-denops/denops.vim

" ddu
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu.vim
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-ui-ff

set rtp+=~/workspace/Plugin/ddu-column-test

filetype plugin indent on

" setting for ddu
let s:ddu_setting_json =<< trim END
{
	"ui": "ff",
	"sources": ["otameshi"],
	"sourceOptions": {
		"_": {
			"columns": ["icon", "icon"]
		}
	}
}
END

call ddu#custom#patch_global(s:ddu_setting_json->join('')->json_decode())

nnoremap <silent> <Leader>d <Cmd>call ddu#start()<CR>

" filetype(ddu-ff) setting

autocmd FileType ddu-ff call s:ddu_ff_setting()

function s:ddu_ff_setting()
	nnoremap <buffer><silent> q
				\	<Cmd>call ddu#ui#do_action('quit')<CR>
	nnoremap <buffer><silent> e
				\	<Cmd>call ddu#ui#ff#do_action('expandItem', #{ mode: "toggle" })<CR>
endfunction

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

  1. start vim
  2. type \ d for start ddu. (\ or specified <Leader> key)
  3. in ddu window, highlight is sed incorrectly

Screenshot (if possible)

image

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

filters for parent item in `expandItem` and `collapseItem` is not working when use filters and columns.

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

Problems summary

SSIA

Expected

filters is applied for parent item even after expandItem and collapseItem when use filters and columns.

Environment Information

  • ddu.vim version (SHA1):
    f754dbf

  • denops.vim version (SHA1):
    6489b17

  • deno version(deno -V output):
    deno 1.38.5

  • OS:
    WSL2 Ubuntu 22.04.3

  • neovim/Vim :version output:
    NVIM v0.10.0-dev-1846+gf31f260f0
    Build type: RelWithDebInfo
    LuaJIT 2.1.1702233742

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

set rtp+=~/.cache/dein/nvim/repos/github.com/vim-denops/denops.vim

set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu.vim
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-ui-ff
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-source-file
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-kind-file
set rtp+=~/.cache/dein/nvim/repos/github.com/kamecha/ddu-filter-converter_file_info
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-column-filename

nnoremap [ddu] <Nop>
nmap <Space>u [ddu]
nmap <silent> [ddu]F <Cmd>call ddu#start(#{
			\ ui: 'ff',
			\ sources: [#{name: 'file', options: #{
			\   columns: [#{name: 'filename'}],
			\   converters: [#{name: 'converter_file_info'}],
			\ }}],
			\ })<CR>

autocmd FileType ddu-ff call s:ddu_my_settings()

function! s:ddu_my_settings() abort
	nnoremap <buffer> e
				\ <Cmd>call ddu#ui#do_action('expandItem', {'mode': 'toggle'})<CR>
	nnoremap <buffer><silent> q
				\ <Cmd>call ddu#ui#do_action('quit')<CR>
endfunction

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

  1. type <Space> u F to start ddu
  2. type e on directory item to fire expandItem action
  3. the parent item's display is not applied converters

Screenshot (if possible)

hoge

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

Note

when I don't use columns and fire expandItem, the display is applied converter.

ddu dose not close ui when toggle of uiOptions sets v:true.

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

Problems summary

If toggle in uiOptions is set to v:true and ddu#start() is called when the cursor is in another window, ddu closes the window at the cursor position without closing ui.

This problem occurs in both vim and neovim, ddu-ui-ff and ddu-ui-filer.

Expected

ddu closes the ddu-ui window without closing the window at the cursor position.

Environment Information

  • ddu.vim version (SHA1): aaf11ea

  • denops.vim version (SHA1): a40e0c10be0c67b5fd6cb9713914b9259dafa7e2

  • deno version(deno -V output): deno 1.24.1

  • OS: MacOS

  • neovim/Vim :version output:

NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

      システム vimrc: "$VIM/sysinit.vim"
       省略時の $VIM: "/opt/homebrew/Cellar/neovim/0.7.2_1/share/nvim"

Run :checkhealth for more info

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

if !has("nvim")
  set nocompatible
  filetype plugin indent on
  syntax enable
endif

let s:plugins = [
      \ 'vim-denops/denops.vim',
      \ 'Shougo/ddu.vim',
      \ 'Shougo/ddu-ui-filer',
      \ 'Shougo/ddu-source-file',
      \ ]

for item in s:plugins
  execute 'set runtimepath+=~/.cache/dein/repos/github.com/' . item
endfor

call ddu#custom#patch_global({
    \   'ui': 'filer',
    \   'sources': [{'name': 'file'}],
    \   'uiOptions': {
    \     '_': { 'toggle': v:true }
    \    },
    \ })
nnoremap <Space>o <Cmd>call ddu#start()<CR>

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

  1. Start ddu by <Space>o
  2. Move upper window by <C-w>k
  3. <Space>o

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

The above vimrc does not be errored. But if you use:

... snip ...
call ddu#custom#patch_global({
    \   'ui': 'filer',
    \   'sources': [{'name': 'file'}],
    \   'uiOptions': {
    \     '_': { 'toggle': v:true }
    \    },
    \   'uiParams': {
    \     '_': { 'split': 'floating' }
    \    }
    \ })
... snip ...

and <Space>o -> <C-w>k -> <Space>o, error is occured.

function ddu#start[1]..ddu#_request[22]..denops#request[1]..denops#server#request[6]..<SNR>30_request の処理中にエラーが検出されました:
行    1:
Error invoking 'invoke' on channel 4:
Error: Failed to call 'start' with [{}]: Error: Failed to call 'call' with ["denops#api#cmd","close!",{}]: Error: Failed to call 'nvim_call_function' with ["denops#api#cmd",["close!",{}]]: [0,"Vim(c
lose):E444: 最後のウィンドウを閉じることはできません"]
    at Session.call (https://deno.land/x/[email protected]/session.ts:207:13)
    at async Service.call (file:///Users/---/.cache/dein/repos/github.com/vim-denops/denops.vim/denops/@denops-private/service.ts:93:12)
    at async Session.call (file:///Users/---/.cache/dein/repos/github.com/vim-denops/denops.vim/denops/@denops-private/service.ts:153:14)
    at async Session.dispatch (https://deno.land/x/[email protected]/session.ts:99:12)
    at async https://deno.land/x/[email protected]/session.ts:108:18
    at async Session.handleRequest (https://deno.land/x/[email protected]/session.ts:104:29)
    at Session.call (https://deno.land/x/[email protected]/session.ts:207:13)
    at async DenopsImpl.cmd (file:///Users/---/.cache/dein/repos/github.com/vim-denops/denops.vim/denops/@denops/impl.ts:51:5)
    at async Ui.quit (file:///Users/---/.cache/dein/repos/github.com/Shougo/ddu-ui-filer/denops/@ddu-uis/filer.ts:380:7)
    at async Ddu.uiQuit (file:///Users/---/.cache/dein/repos/github.com/Shougo/ddu.vim/denops/ddu/ddu.ts:448:5)
    at async Ddu.start (file:///Users/---/.cache/dein/repos/github.com/Shougo/ddu.vim/denops/ddu/ddu.ts:166:7)
    at async Session.start (file:///Users/---/.cache/dein/repos/github.com/Shougo/ddu.vim/denops/ddu/app.ts:130:7)
    at async Session.dispatch (https://deno.land/x/[email protected]/session.ts:99:12)
    at async https://deno.land/x/[email protected]/session.ts:108:18
    at async Session.handleRequest (https://deno.land/x/[email protected]/session.ts:104:29)
    at Session.call (https://deno.land/x/[email protected]/session.ts:207:13)
    at async Service.dispatch (file:///Users/---/.cache/dein/repos/github.com/vim-denops/denops.vim/denops/@denops-private/service.ts:108:14)
    at async Session.invoke (file:///Users/---/.cache/dein/repos/github.com/vim-denops/denops.vim/denops/@denops-private/host/nvim.ts:48:16)
    at async Session.dispatch (https://deno.land/x/[email protected]/session.ts:99:12)
    at async https://deno.land/x/[email protected]/session.ts:108:18
    at async Session.handleRequest (https://deno.land/x/[email protected]/session.ts:104:29)

`resum` doesn't work when I set custom column via dictionary style

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

Problems summary

When I use ddu-column-custom via dictionary style ( in Neovim),
resume option doesn't work.

Expected

it is work as I set ddu-column-custom without dictionary style.

Environment Information

  • ddu.vim version (SHA1):
    68bef91

  • denops.vim version (SHA1):
    16d4bbc

  • deno version(deno -V output):
    deno 1.38.5

  • OS:
    WSL2 Ubuntu 22.04.3

  • neovim/Vim :version output:
    NVIM v0.10.0-dev-1846+gf31f260f0
    Build type: RelWithDebInfo
    LuaJIT 2.1.1702233742

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

" Your minimal init.vim/vimrc
set rtp+=~/.cache/dein/nvim/repos/github.com/vim-denops/denops.vim

set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu.vim
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-ui-filer
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-source-file
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-kind-file
set rtp+=~/.cache/dein/nvim/repos/github.com/kamecha/ddu-column-custom

nnoremap [ddu] <Nop>
nmap <Space>u [ddu]

lua << EOF
vim.keymap.set('n', '[ddu]e', function()

	local function getLengthCallback(args)
		local length = 0
		for _, item in ipairs(args.items) do
			local display = item["word"]
			if item["display"] ~= nil and item["display"] ~= "" then
				display = item["display"]
			end
			display = " " .. "+" .. display
			length = math.max(length, #display)
		end
		return length
	end

	local function getTextCallback(args)
		local display = args.item["word"]
		if args.item["display"] ~= nil and args.item["display"] ~= "" then
			display = args.item["display"]
		end
		local text = ""
		if args.item["__level"] == 0 then
			if args.item["__expanded"] then
				text = "-" .. display
			else
				text = "+" .. display
			end
		else
			text = " " .. "|" ..display
		end
		return { text = text }
	end

	vim.fn["ddu#start"]({
		ui = "filer",
		resume = true,
		sources = {
			{
				name = "file",
				options = {
					columns = {
						{
							name = "custom",
							params = {
								getLengthCallbackId = vim.fn["denops#callback#register"](getLengthCallback),
								getTextCallbackId = vim.fn["denops#callback#register"](getTextCallback),
							}
						}
					}
				},
			},
		},
	})
end, { remap = true })

EOF

autocmd FileType ddu-filer call s:ddu_filer_my_settings()

function s:ddu_filer_my_settings() abort
	nnoremap <buffer> e
				\ <Cmd>call ddu#ui#do_action('expandItem', {'mode': 'toggle'})<CR>
	nnoremap <buffer> q
				\ <Cmd>call ddu#ui#do_action('quit')<CR>
endfunction

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

to fire expandItem action, current working directory has directory item.

  1. type <Space> u e to start ddu
  2. type e on directory item to fire ecpandItem action
  3. type q to quit ddu
  4. type <Space> u e to start ddu <- in this, the tree (expanded) does not resume... 😭

Screenshot (if possible)

hoge

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

Note

  • what about ddu-column-custom
    it is ddu column plugin I create.
    this plugin allows you to set column with callback registered via denops#callback#register()
  • if I use vimscript to set via dictionary style, it works well
vimscript and use dictionary style ( ** it works correctly**)
function GetLengthCallback(args) abort
	let length = 0
	for item in a:args->get("items")
		let display = item["word"]
		if item->get("display") != 0 && item["display"] != ""
			let display = item["display"]
		endif
		let display = " " .. "+" .. display
		let length = max([length, len(display)])
	endfor
	return length
endfunction

function GetTextCallback(args) abort
	let display = a:args->get("item")["word"]
	if a:args->get("item")->get("display") != 0 && a:args->get("item")->get("display") != ""
		let display = a:args->get("item")["display"]
	endif
	let text = ""
	if a:args->get("item")["__level"] == 0
		if a:args->get("item")["__expanded"]
			let text = "-" .. display
		else
			let text = "+" .. display
		endif
	else
		let text = " " .. "|" ..display
	endif
	return { "text": text }
endfunction

nmap <silent> [ddu]F <Cmd>call ddu#start(#{
			\ ui: 'filer',
			\ resume: v:true,
			\ sources: [
			\   #{
			\     name: 'file',
			\     options: #{
			\       columns: [
			\         #{
			\           name: 'custom',
			\           params: #{
			\             getLengthCallbackId: denops#callback#register(function('GetLengthCallback')),
			\             getTextCallbackId: denops#callback#register(function('GetTextCallback')),
			\           }
			\         }
			\       ]
			\     }
			\   }
			\ ],
			\ })<CR>
  • if I don't use dictionary style setting, it works well
setting without dictionary style ( **it works correctly**)
lua << EOF
vim.keymap.set('n', '[ddu]E', function()
	local function getLengthCallback(args)
		local length = 0
		for _, item in ipairs(args.items) do
			local display = item["word"]
			if item["display"] ~= nil and item["display"] ~= "" then
				display = item["display"]
			end
			display = " " .. "+" .. display
			length = math.max(length, #display)
		end
		return length
	end

	local function getTextCallback(args)
		local display = args.item["word"]
		if args.item["display"] ~= nil and args.item["display"] ~= "" then
			display = args.item["display"]
		end
		local text = ""
		if args.item["__level"] == 0 then
			if args.item["__expanded"] then
				text = "-" .. display
			else
				text = "+" .. display
			end
		else
			text = " " .. "|" .. display
		end
		return { text = text }
	end

	vim.fn["ddu#start"]({
		ui = "filer",
		resume = true,
		sources = {
			{
				name = "file",
				options = { columns = { "custom" } },
			},
		},
		columnParams = {
			custom = {
				getLengthCallbackId = vim.fn["denops#callback#register"](getLengthCallback),
				getTextCallbackId = vim.fn["denops#callback#register"](getTextCallback),
			}
		},
	})
end, { remap = true })
EOF

ExpandItem is broken.

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

Problems summary

Tree expansion does not work properly.

Expected

Environment Information

All up-to-date. Updated just before making this issue.

  • ddu.vim version (SHA1):

  • denops.vim version (SHA1):

  • deno version(deno -V output):

  • OS:
    Ubuntu 22.04 (WSL2)

  • neovim/Vim :version output:
    NVIM v0.10.0-dev-a0375b6

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

Note that you need the hierarchy branch of nvim_lsp source, not the main branch.

set runtimepath+=/path/to/denops.vim
set runtimepath+=/path/to/ddu.vim
set runtimepath+=/path/to/ddu-ui-ff
set runtimepath+=/path/to/ddu-source-nvim_lsp
set runtimepath+=/path/to/nvim-lspconfig

lua <<EOL
vim.fn["ddu#custom#patch_global"]({
  sources = {
    { name = "nvim_lsp", params = { method = "callHierarchy/incomingCalls" } }
  },
  ui = "ff",
  uiParams = {
    ff = {
      displayTree = true,
    },
  },
  kindOptions = {
    _ = {
      defaultAction = "open",
    },
  },
})

require("lspconfig").denols.setup({
  settings = {
    deno = true,
  },
})
EOL

augroup my-ddu-ff
  autocmd!
  autocmd FileType ddu-ff call <SID>ddu_ff_mapping()
augroup END

function! s:ddu_ff_mapping() abort
  nnoremap <buffer><silent> <CR> <Cmd>call ddu#ui#do_action('itemAction')<CR>
  nnoremap <buffer><silent> <Esc> <Cmd>call ddu#ui#do_action('quit')<CR>
  nnoremap <buffer><silent> e <Cmd>call ddu#ui#do_action('expandItem')<CR>
endfunction

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

Use nvim_lsp source code.

  1. Open denops/@ddu-sources/nvim_lsp.ts and place the cursor on row 493, column 10 (on callHierarchyHandler symbol).
  2. Run :call ddu#start({}).
  3. Call expandItem with e on callHierarchyHandler symbol.
  4. The searchChildren symbol will appear, so expandItem in the same way.
  5. The callHierarchyHandler symbol disappears and the searchChildren symbol increases to two.

Screenshot (if possible)

expandItem

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

`expandItem` does not work well with not directory item

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

Problems summary

SSIA

Expected

When expandItem fired with not directory item, expandItem action doesn't do anything.

Environment Information

  • ddu.vim version (SHA1):
    bc0cc74
  • denops.vim version (SHA1):
    05de850
  • deno version(deno -V output):
    deno 1.30.3
  • OS:
    WSL2 Ubuntu22.04
  • neovim/Vim :version output:
    NVIM v0.9.0-dev-1088+gd66832c76
    Build type: RelWithDebInfo
    LuaJIT 2.1.0-beta3

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

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

nnoremap [ddu] <Nop>
nmap <Space>u [ddu]
nmap <silent> [ddu]f <Cmd>call ddu#start({
			\ 'ui': 'ff',
			\ 'sources': [
			\	{'name': 'file', 'params': {}},
			\ ],
			\ })<CR>
autocmd FileType ddu-ff call s:ddu_my_settings()

function! s:ddu_my_settings() abort
	nnoremap <buffer> e
				\ <Cmd>call ddu#ui#do_action('expandItem', {'mode': 'toggle'})<CR>
endfunction

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

  1. type <Space> u f for start ddu
  2. type e when the cursor is on the file, not directory.
  3. the item is expanded even though it is not directory.

Screenshot (if possible)

type e when the cursor is on min.vim (not directory) ...

image

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

Window focus does not move in kind action that returns `ActionFlags.RefreshItems` or `ActionFlags.Persist`

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

Problems summary

Window focus does not move when executing term_start() in kind action that returns ActionFlags.RefreshItems or ActionFlags.Persist.

Works as expected for kind actions that return ActionFlags.None or ActionFlags.Redraw.

Expected

Focus is moved to the window opened by term_start().

Environment Information

  • ddu.vim version (SHA1): 12633f6

  • denops.vim version (SHA1): 8f3899de3d3add07105221262dca90a31c4c2d4c

  • deno version(deno -V output): deno 1.31.1

  • OS: Linux (6.1.0-4-amd64)

  • neovim/Vim :version output:

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Mar  4 2023 19:53:01)
適用済パッチ: 1-1376

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

" Your minimal init.vim/vimrc
set runtimepath+=~/path/to/ddu.vim/
set runtimepath+=~/path/to/ddu-ui-ff/
set runtimepath+=~/path/to/test_kind/
  • ~/path/to/test_kind/denops/@ddu-kinds/test.ts
import {
  ActionArguments,
  ActionFlags,
  BaseKind,
} from "https://deno.land/x/[email protected]/types.ts";
import { term_start } from "https://deno.land/x/[email protected]/function/vim/mod.ts";

type Params = Record<never, never>;

export class Kind extends BaseKind<Params> {
  actions: Record<
    string,
    (args: ActionArguments<Params>) => Promise<ActionFlags>
  > = {
    test: async (args: ActionArguments<Params>): Promise<ActionFlags> => {
      await term_start(args.denops, ["ls", "-la"]);

      return ActionFlags.RefreshItems;
    },
  };

  params(): Params {
    return {};
  }
}
  • ~/path/to/test_kind/denops@ddu-sources/test.ts
import { BaseSource, Item } from "https://deno.land/x/[email protected]/types.ts";
import { GatherArguments } from "https://deno.land/x/[email protected]/base/source.ts";

type Params = Record<never, never>;

export class Source extends BaseSource<Params> {
  kind = "test";

  gather(_args: GatherArguments<Params>): ReadableStream<Item<never>[]> {
    return new ReadableStream({
      start(controler) {
        controler.enqueue([{
          word: "test",
        }]);
        controler.close();
      },
    });
  }

  params(): Params {
    return {};
  }
}

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

  1. :call ddu#start({'ui': 'ff', 'sources': [{'name': 'test'}]})
  2. :call ddu#ui#ff#do_action('itemAction', {'name': 'test'})

Screenshot (if possible)

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

option 'resume' doesn't work properly

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

Problems summary

After starting ddu.vim with 'resume' option, ddu ignores specified source and always startup with the resumed buffer.
Seems f97f6a3 is related to this problem.

Expected

ddu opens with specified options.

Environment Information

  • ddu.vim version (SHA1): 13273fd

  • denops.vim version (SHA1): a40e0c1

  • deno version(deno -V output): deno 1.24.1

  • OS: macOS 12.4 (21F2081)

  • neovim/Vim :version output: NVIM v0.8.0-dev-751-g8952def50

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

let s:plugins = [
      \ 'vim-denops/denops.vim',
      \ 'Shougo/ddu.vim',
      \ 'Shougo/ddu-ui-ff',
      \ 'Shougo/ddu-source-file',
      \ 'Shougo/ddu-source-file_old',
      \ ]

for item in s:plugins
  execute 'set runtimepath+=~/.cache/dein/repos/github.com/' . item
endfor

call ddu#custom#patch_global({
  \ 'ui': 'ff',
\ })

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

  1. :call ddu#start({'sources':[{'name':'file'}]})<CR>
  2. :close<CR>
  3. :call ddu#start({'resume': v:true})<CR> # open 1. buffer
  4. :close<CR>
  5. :call ddu#start({'sources':[{'name':'file_old'}]})<CR> # still open 1. buffer

Screenshot (if possible)

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

`toggle` and `resume` dose not work well.

Tanks you for Shougo/ddu-ui-filer#3 and Shougo/ddu-ui-filer#5. But I found new bugs related to them.

Problems summary

There are 2 bugs about toggle of uiParams and resume of ddu-options.

  1. When setting resume in ddu#custom#path_global(), there is bug: Shougo/ddu-ui-filer#5. But setting in ddu#start(), there is no bug (ddu restores the previous state as I expected).
  2. When setting both resume and toggle, resume works well but toggle does not work.

Expected

  1. If setting resume in ddu#custom#path_global()`, ddu restores the previous state.
  2. toggle works with or without resume setting

Environment Information

  • ddu.vim version (SHA1): e044e11fe9433335923b0edcac9e2cb99908923e

  • denops.vim version (SHA1): a104cbff7e47a63978cfb3921da4333465fc6d15

  • deno version(deno -V output): deno 1.23.3

  • OS: MacOS 12.4

  • neovim/Vim :version output:

neovim
NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

      システム vimrc: "$VIM/sysinit.vim"
       省略時の $VIM: "/opt/homebrew/Cellar/neovim/0.7.2/share/nvim"

Run :checkhealth for more info
  • :checkhealth or :CheckHealth result(neovim only):
defx: health#defx#check
========================================================================
## defx.nvim
  - OK: has("python3") was successful
  - OK: Python 3.6.1+ was successful

denops: health#denops#check
========================================================================
  - INFO: Supported Deno version: `1.17.1`
  - INFO: Detected Deno version: `1.23.3`
  - OK: Deno version check: passed
  - INFO: Supported Neovim version: `0.6.0`
  - INFO: Detected Neovim version: `0.7.2`
  - OK: Neovim version check: passed
  - INFO: Denops status: `running`
  - OK: Denops status check: passed

nvim: health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=^H
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $TERM_PROGRAM='tmux'
  - INFO: $COLORTERM='truecolor'

## tmux
  - OK: escape-time: 0
  - INFO: Checking stuff
  - OK: focus-events: on
  - INFO: $TERM: screen-256color

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.7.0
  - WARNING: **Go**: not available
  - OK: **cargo**: `cargo 1.62.0 (a748cf5a3 2022-06-08)`
  - WARNING: **luarocks**: not available
  - OK: **Ruby**: `ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]`
  - OK: **RubyGem**: `3.3.7`
  - WARNING: **Composer**: not available
  - OK: **PHP**: `PHP 8.1.8 (cli) (built: Jul  8 2022 10:46:35) (NTS)`
  - OK: **npm**: `8.13.2`
  - OK: **node**: `v18.4.0`
  - OK: **python3**: `Python 3.10.4`
  - OK: **pip3**: `pip 22.1.1 from /Users/otsukiryota/.pyenv/versions/3.10.4/lib/python3.10/site-packages/pip (python 3.10)`
  - WARNING: **javac**: not available
  - WARNING: **java**: not available
  - WARNING: **julia**: not available
  - OK: **wget**: `GNU Wget 1.21.3 built on darwin21.3.0.`
  - OK: **curl**: `curl 7.79.1 (x86_64-apple-darwin21.0) libcurl/7.79.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.45.1`
  - OK: **gzip**: `Apple gzip 353.100.22`
  - OK: **tar**: `bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 `
  - OK: **bash**: `GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)`
  - OK: **sh**: `Ok`
  - OK: GitHub API rate limit. Used: 0. Remaining: 5000. Limit: 5000. Reset: 木  7/14 00:24:38 2022.

nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
  - OK: `tree-sitter` found 0.20.6 (parser generator, only needed for :TSInstallFromGrammar)
  - OK: `node` found v18.4.0 (only needed for :TSInstallFromGrammar)
  - OK: `git` executable found.
  - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: Apple clang version 13.1.6 (clang-1316.0.21.2.5)
  - OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

## Parser/Features H L F I J
  - ql             ✓ ✓ . ✓ ✓ 
  - java           ✓ ✓ . ✓ ✓ 
  - kotlin         ✓ ✓ ✓ . ✓ 
  - pascal         ✓ ✓ ✓ ✓ ✓ 
  - cpp            ✓ ✓ ✓ ✓ ✓ 
  - julia          ✓ ✓ ✓ ✓ ✓ 
  - javascript     ✓ ✓ ✓ ✓ ✓ 
  - bash           ✓ ✓ ✓ . ✓ 
  - comment        ✓ . . . . 
  - css            ✓ . ✓ ✓ ✓ 
  - jsdoc          ✓ . . . . 
  - scss           ✓ . . ✓ . 
  - hcl            ✓ . ✓ ✓ ✓ 
  - erlang         ✓ . ✓ . . 
  - glimmer        ✓ . . . . 
  - elixir         ✓ ✓ ✓ ✓ ✓ 
  - gdscript       ✓ ✓ . ✓ ✓ 
  - gleam          ✓ ✓ ✓ ✓ ✓ 
  - markdown       ✓ . ✓ . ✓ 
  - godot_resource ✓ ✓ ✓ . . 
  - tiger          ✓ ✓ ✓ ✓ ✓ 
  - eex            ✓ . . . ✓ 
  - v              ✓ ✓ ✓ ✓ ✓ 
  - heex           ✓ ✓ ✓ ✓ ✓ 
  - turtle         ✓ ✓ ✓ ✓ ✓ 
  - ocaml          ✓ ✓ ✓ . ✓ 
  - devicetree     ✓ ✓ ✓ ✓ ✓ 
  - qmljs          ✓ . ✓ . . 
  - proto          ✓ . ✓ . . 
  - ocaml_interface✓ ✓ ✓ . ✓ 
  - svelte         ✓ . ✓ ✓ ✓ 
  - tsx            ✓ ✓ ✓ ✓ ✓ 
  - ocamllex       ✓ . . . ✓ 
  - wgsl           ✓ . ✓ . . 
  - org            . . . . . 
  - sql            ✓ . . . ✓ 
  - swift          ✓ ✓ . . . 
  - scheme         ✓ . ✓ . ✓ 
  - elvish         ✓ . . . ✓ 
  - fortran        ✓ . ✓ ✓ . 
  - rust           ✓ ✓ ✓ ✓ ✓ 
  - todotxt        ✓ . . . . 
  - bibtex         ✓ . ✓ ✓ . 
  - rego           ✓ . . . ✓ 
  - typescript     ✓ ✓ ✓ ✓ ✓ 
  - zig            ✓ . ✓ ✓ ✓ 
  - c_sharp        ✓ ✓ ✓ . ✓ 
  - scala          ✓ . ✓ . ✓ 
  - embedded_template✓ . . . ✓ 
  - vala           ✓ . . . . 
  - supercollider  ✓ ✓ ✓ ✓ ✓ 
  - clojure        ✓ ✓ ✓ . ✓ 
  - regex          ✓ . . . . 
  - slint          ✓ . . ✓ . 
  - commonlisp     ✓ ✓ ✓ . . 
  - json5          ✓ . . . ✓ 
  - haskell        ✓ . ✓ . ✓ 
  - query          ✓ ✓ ✓ ✓ ✓ 
  - pioasm         ✓ . . . ✓ 
  - foam           ✓ ✓ ✓ ✓ ✓ 
  - cuda           ✓ ✓ ✓ ✓ ✓ 
  - beancount      ✓ . ✓ . . 
  - hocon          ✓ . . . ✓ 
  - make           ✓ . . . ✓ 
  - help           ✓ . . . . 
  - latex          ✓ . ✓ . ✓ 
  - cmake          ✓ . ✓ . . 
  - llvm           ✓ . . . . 
  - http           ✓ . . . ✓ 
  - hjson          ✓ ✓ ✓ ✓ ✓ 
  - dockerfile     ✓ . . . ✓ 
  - prisma         ✓ . . . . 
  - cooklang       ✓ . . . . 
  - markdown_inline✓ . . . ✓ 
  - rnoweb         ✓ . ✓ . ✓ 
  - rasi           ✓ ✓ ✓ ✓ . 
  - tlaplus        ✓ ✓ ✓ . ✓ 
  - r              ✓ ✓ . ✓ ✓ 
  - astro          ✓ ✓ ✓ ✓ ✓ 
  - sparql         ✓ ✓ ✓ ✓ ✓ 
  - hack           ✓ . . . . 
  - toml           ✓ ✓ ✓ ✓ ✓ 
  - norg           . . . . . 
  - verilog        ✓ ✓ ✓ . ✓ 
  - m68k           ✓ ✓ ✓ . ✓ 
  - fennel         ✓ ✓ . . ✓ 
  - rst            ✓ ✓ . . ✓ 
  - pug            ✓ . . . ✓ 
  - dart           ✓ ✓ . ✓ ✓ 
  - gomod          ✓ . . . ✓ 
  - vue            ✓ . ✓ ✓ ✓ 
  - go             ✓ ✓ ✓ ✓ ✓ 
  - c              ✓ ✓ ✓ ✓ ✓ 
  - jsonc          ✓ ✓ ✓ ✓ ✓ 
  - lalrpop        ✓ ✓ . . . 
  - php            ✓ ✓ ✓ ✓ ✓ 
  - elm            ✓ . . . ✓ 
  - solidity       ✓ . . . . 
  - yaml           ✓ ✓ ✓ ✓ ✓ 
  - glsl           ✓ ✓ ✓ ✓ ✓ 
  - yang           ✓ . ✓ ✓ . 
  - gowork         ✓ . . . ✓ 
  - vim            ✓ ✓ ✓ . ✓ 
  - ninja          ✓ . ✓ ✓ . 
  - graphql        ✓ . . ✓ ✓ 
  - d              ✓ . ✓ ✓ ✓ 
  - nix            ✓ ✓ ✓ . ✓ 
  - ruby           ✓ ✓ ✓ ✓ ✓ 
  - dot            ✓ . . . ✓ 
  - fusion         ✓ ✓ ✓ ✓ . 
  - perl           ✓ . ✓ . . 
  - python         ✓ ✓ ✓ ✓ ✓ 
  - ledger         ✓ . ✓ ✓ ✓ 
  - json           ✓ ✓ ✓ ✓ . 
  - fish           ✓ ✓ ✓ ✓ ✓ 
  - surface        ✓ . ✓ ✓ ✓ 
  - teal           ✓ ✓ ✓ ✓ ✓ 
  - lua            ✓ ✓ ✓ ✓ ✓ 
  - html           ✓ ✓ ✓ ✓ ✓ 

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang}

provider: health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: pbcopy

## Python 3 provider (optional)
  - INFO: pyenv: Path: /opt/homebrew/Cellar/pyenv/2.3.2/libexec/pyenv
  - INFO: pyenv: $PYENV_ROOT is not set. Infer from `pyenv root`.
  - INFO: pyenv: Root: /Users/otsukiryota/.pyenv
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Executable: /Users/otsukiryota/.pyenv/versions/3.10.4/bin/python3
  - INFO: Python version: 3.10.4
  - INFO: pynvim version: 0.4.3
  - OK: Latest pynvim is installed.

## Python virtualenv
  - OK: no $VIRTUAL_ENV

## Ruby provider (optional)
  - INFO: Ruby: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
  - INFO: Host: /Users/otsukiryota/.rbenv/shims/neovim-ruby-host
  - OK: Latest "neovim" gem is installed: 0.9.0

## Node.js provider (optional)
  - INFO: Node.js: v18.4.0
  - INFO: Nvim node.js host: /Users/otsukiryota/.nodebrew/node/v18.4.0/lib/node_modules/neovim/bin/cli.js
  - OK: Latest "neovim" npm/yarn package is installed: 4.10.1

## Perl provider (optional)
  - WARNING: "Neovim::Ext" cpan module is not installed
    - ADVICE:
      - See :help |provider-perl| for more information.
      - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim

vim.lsp: require("vim.lsp.health").check()
========================================================================
  - INFO: LSP log level : WARN
  - INFO: Log path: /Users/otsukiryota/.cache/nvim/lsp.log
  - INFO: Log size: 71667 KB

vim.treesitter: require("vim.treesitter.health").check()
========================================================================
  - INFO: Runtime ABI version : 14
  - OK: Loaded parser for astro: ABI version 13
  - OK: Loaded parser for bash: ABI version 13
  - OK: Loaded parser for beancount: ABI version 13
  - OK: Loaded parser for bibtex: ABI version 13
  - OK: Loaded parser for c: ABI version 13
  - OK: Loaded parser for clojure: ABI version 13
  - OK: Loaded parser for cmake: ABI version 13
  - OK: Loaded parser for comment: ABI version 13
  - OK: Loaded parser for commonlisp: ABI version 13
  - OK: Loaded parser for cooklang: ABI version 13
  - OK: Loaded parser for cpp: ABI version 13
  - OK: Loaded parser for css: ABI version 13
  - OK: Loaded parser for cuda: ABI version 13
  - OK: Loaded parser for c_sharp: ABI version 13
  - OK: Loaded parser for d: ABI version 14
  - OK: Loaded parser for dart: ABI version 13
  - OK: Loaded parser for devicetree: ABI version 14
  - OK: Loaded parser for dockerfile: ABI version 13
  - OK: Loaded parser for dot: ABI version 13
  - OK: Loaded parser for eex: ABI version 13
  - OK: Loaded parser for elixir: ABI version 13
  - OK: Loaded parser for elm: ABI version 13
  - OK: Loaded parser for elvish: ABI version 13
  - OK: Loaded parser for embedded_template: ABI version 13
  - OK: Loaded parser for erlang: ABI version 13
  - OK: Loaded parser for fennel: ABI version 13
  - OK: Loaded parser for fish: ABI version 13
  - OK: Loaded parser for foam: ABI version 13
  - OK: Loaded parser for fortran: ABI version 13
  - OK: Loaded parser for fusion: ABI version 13
  - OK: Loaded parser for gdscript: ABI version 13
  - OK: Loaded parser for gleam: ABI version 13
  - OK: Loaded parser for glimmer: ABI version 13
  - OK: Loaded parser for glsl: ABI version 13
  - OK: Loaded parser for go: ABI version 13
  - OK: Loaded parser for godot_resource: ABI version 14
  - OK: Loaded parser for gomod: ABI version 13
  - OK: Loaded parser for gowork: ABI version 13
  - OK: Loaded parser for graphql: ABI version 13
  - OK: Loaded parser for hack: ABI version 13
  - OK: Loaded parser for haskell: ABI version 13
  - OK: Loaded parser for hcl: ABI version 13
  - OK: Loaded parser for heex: ABI version 13
  - OK: Loaded parser for help: ABI version 13
  - OK: Loaded parser for hjson: ABI version 13
  - OK: Loaded parser for hocon: ABI version 13
  - OK: Loaded parser for html: ABI version 13
  - OK: Loaded parser for http: ABI version 13
  - OK: Loaded parser for java: ABI version 13
  - OK: Loaded parser for javascript: ABI version 13
  - OK: Loaded parser for jsdoc: ABI version 13
  - OK: Loaded parser for json: ABI version 13
  - OK: Loaded parser for json5: ABI version 13
  - OK: Loaded parser for jsonc: ABI version 13
  - OK: Loaded parser for julia: ABI version 13
  - OK: Loaded parser for kotlin: ABI version 13
  - OK: Loaded parser for lalrpop: ABI version 13
  - OK: Loaded parser for latex: ABI version 13
  - OK: Loaded parser for ledger: ABI version 13
  - OK: Loaded parser for llvm: ABI version 13
  - OK: Loaded parser for lua: ABI version 13
  - OK: Loaded parser for m68k: ABI version 13
  - OK: Loaded parser for make: ABI version 13
  - OK: Loaded parser for markdown: ABI version 13
  - OK: Loaded parser for markdown_inline: ABI version 13
  - OK: Loaded parser for ninja: ABI version 13
  - OK: Loaded parser for nix: ABI version 13
  - OK: Loaded parser for norg: ABI version 13
  - OK: Loaded parser for ocaml: ABI version 13
  - OK: Loaded parser for ocamllex: ABI version 14
  - OK: Loaded parser for ocaml_interface: ABI version 13
  - OK: Loaded parser for org: ABI version 13
  - OK: Loaded parser for pascal: ABI version 13
  - OK: Loaded parser for perl: ABI version 13
  - OK: Loaded parser for php: ABI version 13
  - OK: Loaded parser for pioasm: ABI version 13
  - OK: Loaded parser for prisma: ABI version 13
  - OK: Loaded parser for proto: ABI version 13
  - OK: Loaded parser for pug: ABI version 13
  - OK: Loaded parser for python: ABI version 13
  - OK: Loaded parser for ql: ABI version 13
  - OK: Loaded parser for qmljs: ABI version 13
  - OK: Loaded parser for query: ABI version 13
  - OK: Loaded parser for r: ABI version 13
  - OK: Loaded parser for rasi: ABI version 13
  - OK: Loaded parser for regex: ABI version 13
  - OK: Loaded parser for rego: ABI version 13
  - OK: Loaded parser for rnoweb: ABI version 13
  - OK: Loaded parser for rst: ABI version 13
  - OK: Loaded parser for ruby: ABI version 13
  - OK: Loaded parser for rust: ABI version 13
  - OK: Loaded parser for scala: ABI version 13
  - OK: Loaded parser for scheme: ABI version 13
  - OK: Loaded parser for scss: ABI version 13
  - OK: Loaded parser for slint: ABI version 13
  - OK: Loaded parser for solidity: ABI version 13
  - OK: Loaded parser for sparql: ABI version 13
  - OK: Loaded parser for sql: ABI version 13
  - OK: Loaded parser for supercollider: ABI version 13
  - OK: Loaded parser for surface: ABI version 13
  - OK: Loaded parser for svelte: ABI version 13
  - OK: Loaded parser for swift: ABI version 14
  - OK: Loaded parser for teal: ABI version 14
  - OK: Loaded parser for tiger: ABI version 13
  - OK: Loaded parser for tlaplus: ABI version 13
  - OK: Loaded parser for todotxt: ABI version 13
  - OK: Loaded parser for toml: ABI version 13
  - OK: Loaded parser for tsx: ABI version 13
  - OK: Loaded parser for turtle: ABI version 13
  - OK: Loaded parser for typescript: ABI version 13
  - OK: Loaded parser for v: ABI version 13
  - OK: Loaded parser for vala: ABI version 13
  - OK: Loaded parser for verilog: ABI version 13
  - OK: Loaded parser for vim: ABI version 13
  - OK: Loaded parser for vue: ABI version 13
  - OK: Loaded parser for wgsl: ABI version 13
  - OK: Loaded parser for yaml: ABI version 13
  - OK: Loaded parser for yang: ABI version 13
  - OK: Loaded parser for zig: ABI version 13

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

Both bugs use follow vimrc.

if !has("nvim")
  set nocompatible
  filetype plugin indent on
  syntax enable
endif

let s:plugins = [
      \ 'vim-denops/denops.vim',
      \ 'Shougo/ddu.vim',
      \ 'Shougo/ddu-ui-filer',
      \ 'Shougo/ddu-column-filename',
      \ 'Shougo/ddu-source-file',
      \ 'Shougo/ddu-kind-file',
      \ ]

for item in s:plugins
  execute 'set runtimepath+=~/.cache/dein/repos/github.com/' . item
endfor

autocmd FileType ddu-filer call s:ddu_my_settings()
function! s:ddu_my_settings() abort
  nnoremap <buffer><expr> <CR> ddu#ui#filer#is_directory()
    \ ? "<Cmd>call ddu#ui#filer#do_action('expandItem', {'mode': 'toggle'})<CR>"
    \ : "<Cmd>call ddu#ui#filer#do_action('itemAction')<CR>"
  nnoremap <buffer> q <Cmd>call ddu#ui#filer#do_action('quit')<CR>
endfunction

For the 1st bug, add follow vimrc.

call ddu#custom#patch_global({
    \   'ui': 'filer',
    \   'sources': [{'name': 'file'}],
    \   'resume': v:true,
    \   'sourceOptions': {
    \     '_': { 'columns': ['filename'] }
    \   },
    \   'kindOptions': {
    \     'file': {
    \       'defaultAction': 'open',
    \     },
    \   }
    \ })

For the 2nd bug, add follow vimrc.

call ddu#custom#patch_global({
    \   'ui': 'filer',
    \   'sources': [{'name': 'file'}],
    \   'uiOptions': {
    \     '_': { 'toggle': v:true }
    \    },
    \   'sourceOptions': {
    \     '_': { 'columns': ['filename'] }
    \   },
    \   'kindOptions': {
    \     'file': {
    \       'defaultAction': 'open',
    \     },
    \   }
    \ })

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

For the 1st bug.

  1. Call ddu#start({})
  2. On a directory, push <CR> to expand the directory.
  3. Push q to quit ddu.
  4. Call ddu#start({})

then you will see that ddu does not restore the previous state.
But,

  1. Set resume in ddu#custom#pach_global() v:false.
  2. Call ddu#start({ 'resume': v:true })
  3. On a directory, push <CR> to expand the directory.
  4. Push q to quit ddu.
  5. Call ddu#start({ 'resume': v:true })

then you will see that ddu restores the previous state.

For the 2nd bug.

  1. Call ddu#start({ 'resume': v:true })
  2. Call ddu#start({ 'resume': v:true })

then, you will see that ddu-ui-filer still open.
But,

  1. Call ddu#start({})
  2. Call ddu#start({})

then ddu close.

`item.__expanded` in column looks always false.

Problems summary

filename column (ddu-column-filename, ddu-column-icon_filename) does not display open directory icons (expandedIcon).

This is caused by ee729b0.

Expected

Display the open directory icon (expandedIcon).

Environment Information

  • ddu.vim version (SHA1): latest

  • denops.vim version (SHA1): latest

  • deno version(deno -V output): deno 1.39.1

  • OS: macOS

  • neovim/Vim :version output:

NVIM v0.10.0-dev-2037+ge09adfdcf-Homebrew
Build type: Release
LuaJIT 2.1.1703358377
Run ":verbose version" for more info

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

if !has("nvim")
  set nocompatible
  filetype plugin indent on
  syntax enable
endif

let s:plugins = [
      \ 'vim-denops/denops.vim',
      \ 'Shougo/ddu.vim',
      \ 'Shougo/ddu-ui-filer',
      \ 'Shougo/ddu-column-filename',
      \ 'Shougo/ddu-source-file',
      \ 'Shougo/ddu-kind-file',
      \ ]
for item in s:plugins
  execute 'set runtimepath+=~/.cache/dein/repos/github.com/' .. item
endfor

call ddu#custom#patch_global(#{
    \   ui: 'filer',
    \   sources: [{'name': 'file'}],
    \   sourceOptions: #{
    \     _: { 'columns': ['filename'] }
    \   },
    \   kindOptions: #{
    \     file: #{
    \       defaultAction: 'open',
    \     },
    \   }
    \ })

autocmd FileType ddu-filer call s:ddu_my_settings()
function! s:ddu_my_settings() abort
  nnoremap <buffer><expr> <CR> ddu#ui#get_item()->get('isTree', v:false)
    \ ? "<Cmd>call ddu#ui#sync_action('expandItem', {'mode': 'toggle'})<CR>"
    \ : "<Cmd>call ddu#ui#sync_action('itemAction')<CR>"
  nnoremap <buffer> q <Cmd>call ddu#ui#sync_action('quit')<CR>
endfunction

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

  1. start neovim/vim
  2. :call ddu#start()
  3. type <CR> on the directory.

Expected: opened directory icon - (expandedIcon).
Actual: closed directory icon + (collapsedIcon).

Screenshot (if possible)

Preserve the input on resume

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

Problems summary

Expected

Do not reset the input on resume.

Environment Information

  • ddu.vim version (SHA1): 493c0ce933b25bf94d69bfd3eea9307a8de18ddd

  • denops.vim version (SHA1): a104cbff7e47a63978cfb3921da4333465fc6d15

  • deno version(deno -V output): deno 1.19.2

  • OS: macOS

  • neovim/Vim :version output:

NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Monterey

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
     fall-back for $VIM: "/usr/local/Cellar/neovim/0.7.0/share/nvim"

     Run :checkhealth for more info
  • :checkhealth or :CheckHealth result(neovim only):

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

if has('vim_starting')
  let s:config_path = stdpath('config')
  for s:repo in [
    \ 'vim-denops/denops.vim',
    \ 'Shougo/ddu.vim',
    \ 'Shougo/ddu-ui-ff',
    \ 'Shougo/ddu-kind-file',
    \ 'matsui54/ddu-filter-fzy',
  \ ]
    let s:path = s:config_path . '/dein/repos/github.com/' . s:repo
    let &g:rtp .= ',' . s:path
  endfor
endif

call ddu#custom#patch_global({
  \ 'ui': 'ff',
  \ 'sourceOptions': {
    \ 'ghq': {
      \ 'matchers': ['matcher_fzy'],
    \ },
  \ },
\ })

command! Open call s:open()
function! s:open() abort
  call ddu#start({
    \ 'name': 'ghq',
    \ 'sources': [{ 'name': 'ghq' }],
    \ 'uiParams': { 'ff': { 'startFilter': v:true } },
    \ 'resume': v:true,
  \ })
endfunction

augroup _init_ddu
  autocmd!
  autocmd FileType ddu-ff call <SID>init_ddu()
  autocmd FileType ddu-ff-filter call <SID>init_ddu()
augroup END

function! s:init_ddu() abort
  nnoremap <buffer> <Esc> <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  nnoremap <buffer> q <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  nnoremap <buffer> <C-q> <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  inoremap <buffer> <C-q> <Cmd>call ddu#ui#ff#do_action('quit')<CR>

  nnoremap <buffer> <CR> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  inoremap <buffer> <CR> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  nnoremap <buffer> <C-j> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  inoremap <buffer> <C-j> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>

  if &filetype ==# 'ddu-ff-filter'
    inoremap <buffer> <C-p> <Cmd>call ddu#ui#ff#execute("call cursor(line('.')-1,0)")<CR>
    inoremap <buffer> <C-n> <Cmd>call ddu#ui#ff#execute("call cursor(line('.')+1,0)")<CR>
  endif
endfunction

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

  1. Open ddu-ui by :Open
  2. Enter query & move cursor
  3. Quit with <C-q>
  4. Reopen ddu-ui

Screenshot (if possible)

Screen.Recording.2022-07-17.at.16.08.08.mov

Tree expanded does not be kept by `resume`

Problems summary

ddu does not keep the previous tree expanded even if I set resume to true.

This behavior occurs from 7fef2fb

Expected

Keep the tree expanded.

Environment Information

  • ddu.vim version (SHA1): 3202e53

  • denops.vim version (SHA1): 62b1d22b3e60fcc9e570a531a5af1e4b2393c15a

  • deno version(deno -V output): deno 1.34.3

  • OS: MacOS

  • neovim/Vim :version output:

NVIM v0.10.0-dev-1973+g54807231c-Homebrew
Build type: Release
LuaJIT 2.1.0-beta3
Run ":verbose version" for more info

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

if !has("nvim")
  set nocompatible
  filetype plugin indent on
  syntax enable
endif

let s:plugins = [
      \ 'vim-denops/denops.vim',
      \ 'Shougo/ddu.vim',
      \ 'Shougo/ddu-ui-filer',
      \ 'ryota2357/ddu-column-icon_filename',
      \ 'Shougo/ddu-source-file',
      \ 'Shougo/ddu-kind-file',
      \ ]
for item in s:plugins
  execute 'set runtimepath+=~/.cache/dein/repos/github.com/' .. item
endfor

call ddu#custom#patch_global(#{
    \   ui: 'filer',
    \   sources: [{'name': 'file'}],
    \   resume: v:true,
    \   sourceOptions: {
    \     '_': { 'columns': ['icon_filename'] }
    \   },
    \   kindOptions: #{
    \     file: #{
    \       defaultAction: 'open',
    \     },
    \   }
    \ })

autocmd FileType ddu-filer call s:ddu_my_settings()
function! s:ddu_my_settings() abort
  nnoremap <buffer><expr> <CR> ddu#ui#get_item()->get('isTree', v:false)
    \ ? "<Cmd>call ddu#ui#filer#do_action('expandItem', {'mode': 'toggle'})<CR>"
    \ : "<Cmd>call ddu#ui#filer#do_action('itemAction')<CR>"
  nnoremap <buffer> q <Cmd>call ddu#ui#filer#do_action('quit')<CR>
endfunction

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

  1. start neovim
  2. call ddu#start().
  3. <CR> on the directory to expand the tree.
  4. q to quit.
  5. call ddu#start() to restart.

Screenshot (if possible)

2023-07-03.1.33.10.mov

I do not understand how to call defaultAction or add input

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

Problems summary

Hi. I am migrating from Denite and I get the general flow of how this new plugin works, but I cannot figure out how to accomplish two things.

  1. How to define and call actions in the init.vim file? Currently I can pull up the ddu buffer, but then I have no way to open files.
  2. How to refine input with the fuzzy finder? for instance if 'file_rec' pulls up too many files, how can I refine my search after the buffer comes up?

Expected

I have looked through the documentation, but I do not see any examples of how to do this.

Environment Information

  • ddu.vim version (SHA1): 649e50b

  • denops.vim version (SHA1): d01a89773b158255073cefa88f6527fb9f522e59

  • deno version(deno -V output): deno 1.20.6

  • OS: Ubuntu 20.04

  • neovim/Vim :version output: NVIM v0.7.0-dev+1254-g6dc2c8293

  • :checkhealth or :CheckHealth result(neovim only):

  2 denops: health#denops#check                                                                                                                                                   
  3 ========================================================================                                                                                                      
  4   - info: supported deno version: `1.17.1`                                                                                                                                    
  5   - info: detected deno version: `1.20.6`                                                                                                                                     
  6   - ok: deno version check: passed                                                                                                                                            
  7   - info: supported neovim version: `0.6.0`                                                                                                                                   
  8   - info: detected neovim version: `0.7.0`                                                                                                                                    
  9   - ok: neovim version check: passed                                                                                                                                          
 10   - info: denops status: `running`                                                                                                                                            
 11   - ok: denops status check: passed                                                                                                                                           
 12                                                                                                                                                                               
 13 nvim: health#nvim#check                                                                                                                                                       
 14 ========================================================================                                                                                                      
 15 ## configuration                                                                                                                                                              
 16   - ok: no issues found                                                                                                                                                       
 17                                                                                                                                                                               
 18 ## performance                                                                                                                                                                
 19   - ok: build type: relwithdebinfo                                                                                                                                            
 20                                                                                                                                                                               
 21 ## remote plugins                                                                                                                                                             
 22   - ok: up to date                                                                                                                                                            
 23                                                                                                                                                                               
 24 ## terminal                                                                                                                                                                   
 25   - info: key_backspace (kbs) terminfo entry: key_backspace=\177                                                                                                              
 26   - info: key_dc (kdch1) terminfo entry: key_dc=\e[3~                                                                                                                         
 27   - info: $ssh_tty='/dev/pts/3'                                                                                                                                               
 28                                                                                                                                                                               
 29 ## tmux                                                                                                                                                                       
 30   - ok: escape-time: 10                                                                                                                                                       
 31   - info: checking stuff                                                                                                                                                      
 32   - ok: focus-events: on                                                                                                                                                      
 33   - info: $term: screen-256color                                                                                                                                              
 34                                                                                                                                                                               
 35 provider: health#provider#check                                                                                                                                               
 36 ========================================================================                                                                                                      
 37 ## clipboard (optional)                                                                                                                                                       
 38   - ok: clipboard tool found: tmux                                                                                                                                            
 39                                                                                                                                                                               
 40 ## python 3 provider (optional)                                                                                                                                               
 41   - info: pyenv: path: /st1/jeff/.pyenv/libexec/pyenv                                                                                                                         
 42   - info: pyenv: root: /st1/jeff/.pyenv                                                                                                                                       
 43   - info: using: g:python3_host_prog = "/st1/jeff/.venv/nvim/bin/python"                                                                                                      
 44   - info: executable: /st1/jeff/.venv/nvim/bin/python                                                                                                                         
 45   - info: python version: 3.8.13                                                                                                                                              
 46   - info: pynvim version: 0.4.3                                                                                                                                               
 47   - ok: latest pynvim is installed.                                                                                                                                           
 48                                                                                                                                                                               
 49 ## python virtualenv                                                                                                                                                          
 50   - info: $virtual_env is set to: /st1/jeff/.venv/env                                                                                                                         
 51   - info: python version: 3.8.13                                                                                                                                              
 52   - ok: $virtual_env provides :!python.                                                                                                                                       
 53                                                                                                                                                                               
 54 ## ruby provider (optional)                                                                                                                                                   
 55   - warning: `ruby` and `gem` must be in $path.                                                                                                                               
 56     - advice:                                                                                                                                                                 
 57       - install ruby and verify that `ruby` and `gem` commands work.                                                                                                          
 58                                                                                                                                                                               
 59 ## node.js provider (optional)                                                                                                                                                
 60   - warning: `node` and `npm` (or `yarn`) must be in $path.                                                                                                                   
 61     - advice:                                                                                                                                                                 
 62       - install node.js and verify that `node` and `npm` (or `yarn`) commands work.                                                                                           
 63                                                                                                                                                                               
 64 ## perl provider (optional)                                                                                                                                                   
 65   - error: perl provider error:                                                                                                                                               
 66     - advice:                                                                                                                                                                 
 67       - "neovim::ext" cpan module is not installed                                                                                                                            
 68                                                                                                                                                                               
 69 vim.lsp: require("vim.lsp.health").check()                                                                                                                                    
 70 ========================================================================                                                                                                      
 71   - info: lsp log level : warn                                                                                                                                                
 72   - info: log path: /st1/jeff/.cache/nvim/lsp.log                                                                                                                             
 73   - info: log size: 2 kb                                                                                                                                                      
 74                                                                                                                                                                               
 75 vim.treesitter: require("vim.treesitter.health").check()                                                                                                                      
 76 ========================================================================                                                                                                      
 77   - info: runtime abi version : 14                                                                                                                                            
 78   - ok: loaded parser for c: abi version 13 

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

 call plug#begin('~/.config/nvim/plugged')
                  
Plug 'vim-denops/denops.vim'                                                                 
                                                                               
Plug 'Shougo/ddu.vim'                        
Plug 'shun/ddu-source-buffer'                        
Plug 'Shougo/ddu-ui-ff'                                          
Plug 'shun/ddu-source-rg'              
Plug 'Shougo/ddu-source-file_rec'                                                     

call ddu#custom#patch_global({         
    \ 'ui': 'ff',                                                          
    \ })                                                              
                                                                                                      
call ddu#custom#patch_global({                                              
    \   'kindOptions': {                                                 
    \     'file': {                                               
    \       'defaultAction': 'open',                      
    \     },                              
    \   }                                                                     
    \ })            
                                                                          
call ddu#custom#patch_global({                            
    \   'sourceOptions': {    
    \     '_': {                                           
    \       'matchers': ['matcher_substring'],                                 
    \     },                                                                    
    \     'file_rec': {'path': expand("~")},               
    \   }                                                              
    \ })                                                                  
                                                                               
call ddu#custom#patch_global({
    \   'sourceParams' : {                                                
    \     'rg' : {     
    \       'args': ['--column', '--no-heading', '--color', 'never'],
    \     },                            
    \   },                                                                                    
    \ })                                                                        
                                           
                                        
function! s:ddu_rg_live() abort                   
  call ddu#start({                            
        \   'volatile': v:true,        
        \   'sources': [{            
        \     'name': 'rg',                           
        \     'options': {'matchers': []},
        \   }],                      
        \   'uiParams': {'ff': { 
        \     'ignoreEmpty': v:false,                           
        \     'autoResize': v:false,
        \   }},                        
        \ })                                                                    
endfunction                                                                                                             
                                      
" open list of buffers, open directory for seatch, search for test in files (rg)                            
nnoremap <leader><leader> <Cmd>call ddu#start({'sources': [{'name': 'buffer'}]})<CR>
nnoremap <leader><Space> <Cmd>call ddu#start({'sources': [{'name': 'file_rec'}]})<CR>
nnoremap <leader><Space><Space> <Cmd>call <SID>ddu_rg_live()<CR>
nnoremap <CR> <Cmd>ddu#ui_action('default')<CR>  

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

  1. foo
  2. bar
  3. baz

Screenshot (if possible)

Unexpected background color when cursor has moved with `ddu#ui#ff#execute()`

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

Problems summary

Somehow unexpected background is applied to previous selected lines. When you hit <C-o><C-l>, the highlight is fixed.

CleanShot.2022-09-02.at.15.05.43.mp4

Expected

Only current selected line is highlighted.

Environment Information

  • ddu.vim version (SHA1): 87653d7

  • denops.vim version (SHA1): 17030b4178076eefbde60f682a74a5b62b10c5e0

  • deno version(deno -V output): 1.24.2

  • OS: macOS 12.5.1 (Apple Sillicon)

  • neovim/Vim :version output: NVIM v0.8.0-dev-2465-g12fe197cf-dirty

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

if exists('+compatible') && &compatible
  set nocompatible
endif

" Disable Vim's native pack feature
set packpath=

" Clone https://github.com/lambdalisue/fern.vim in somewhere
" and specify that directory to the below
set runtimepath^=~/.config/nvim/pack/jetpack/src/github.com/vim-denops/denops.vim
set runtimepath^=~/.config/nvim/pack/jetpack/src/github.com/Shougo/ddu.vim
set runtimepath^=~/.config/nvim/pack/jetpack/src/github.com/Shougo/ddu-ui-ff
set runtimepath^=~/.config/nvim/pack/jetpack/src/github.com/Shougo/ddu-source-file_rec
set runtimepath^=~/.config/nvim/pack/jetpack/src/github.com/Shougo/ddu-filter-matcher_substring
set runtimepath^=~/.config/nvim/pack/jetpack/src/github.com/EdenEast/nightfox.nvim

filetype plugin indent on
syntax on
"----------------------------------------------------------------

nnoremap ; :
nnoremap : ;


call ddu#custom#patch_global({
      \ 'ui': 'ff',
      \ 'sources': [
      \   {
      \     'name': 'file_rec',
      \   },
      \ ],
      \ 'sourceOptions': {
      \   '_': {
      \     'matchers': ['matcher_substring'],
      \   },
      \ },
      \ 'uiParams': {
      \   'ff': {
      \     'split': 'floating',
      \     'startFilter': v:true,
      \     'prompt': '> ',
      \   },
      \ },
      \})

function! s:my_ddu_ff() abort
  nnoremap <buffer><silent> <Esc>
        \ <Cmd>call ddu#ui#ff#do_action('quit')<CR>
endfunction

function! s:my_ddu_ff_filter() abort
  inoremap <buffer><silent> <Esc> <Esc><Cmd>call ddu#ui#ff#close()<CR>
  nnoremap <buffer><silent> <Esc> <Cmd>call ddu#ui#ff#close()<CR>

  inoremap <buffer><silent> <C-n>
	  \ <Cmd>call ddu#ui#ff#execute("call cursor(line('.')+1,0)")<CR>
  inoremap <buffer><silent> <C-p>
	  \ <Cmd>call ddu#ui#ff#execute("call cursor(line('.')-1,0)")<CR>
endfunction

augroup my-ddu
  autocmd!
  autocmd FileType ddu-ff call s:my_ddu_ff()
  autocmd FileType ddu-ff-filter call s:my_ddu_ff_filter()
augroup END

colorscheme nightfox

"----------------------------------------------------------------
echomsg "Custom minimal vimrc has loaded"

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

  1. call ddu#start({})
  2. Hit <C-n> or <C-p>

Screenshot (if possible)

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

Toggle hidden files does not work

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

Problems summary

I tried toggling hidden files, but it didn't work from e07df9d.

This seems to be the problem.

ddu.vim/denops/ddu/ddu.ts

Lines 1574 to 1576 in a897c77

const ret = {
...this.#options,
};

ret.sourceOptions === this.#options.sourceOptions // true

ret.sourceOptions[source.name] = sourceOptions;

This will fix it, but I'm not sure if it's correct.

const ret = structuredClone(this.#options);

Expected

Can toggle.

Environment Information

  • ddu.vim version (SHA1):
    a897c77

  • denops.vim version (SHA1):
    16d4bbc

  • deno version(deno -V output):
    deno 1.40.2

  • OS:
    Ubuntu 22.04 in WSL2

  • neovim/Vim :version output:
    NVIM v0.9.5
    Build type: Release
    LuaJIT 2.1.1692716794

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

set rtp+=/path/to/github.com/vim-denops/denops.vim
set rtp+=/path/to/github.com/Shougo/ddu.vim
set rtp+=/path/to/github.com/Shougo/ddu-ui-ff
set rtp+=/path/to/github.com/Shougo/ddu-source-file
set rtp+=/path/to/github.com/Shougo/ddu-filter-matcher_hidden

call ddu#custom#patch_global(#{
  \ ui: 'ff',
  \ sources: ['file'],
  \ sourceOptions: #{
  \   _: #{
  \     matchers:['matcher_hidden'],
  \     },
  \   },
  \})

autocmd FileType ddu-ff call s:ddu_ff_setting()

function s:ddu_ff_setting()
  nnoremap <buffer> >
  \ <Cmd>call ddu#ui#do_action('updateOptions', #{
  \   sourceOptions: #{
  \     _: #{
  \       matchers: ToggleHidden(),
  \     },
  \   },
  \ })<CR>
  \<Cmd>call ddu#ui#do_action('redraw')<CR>
endfunction

function ToggleHidden()
  const current = ddu#custom#get_current(b:ddu_ui_name)
  const source_options = get(current, 'sourceOptions', {})
  const source_options_all = get(source_options, '_', {})
  const matchers = get(source_options_all, 'matchers', [])
  return empty(matchers) ? ['matcher_hidden'] : []
endfunction

function EchoMatchers()
  const current = ddu#custom#get_current(b:ddu_ui_name)
  const source_options = get(current, 'sourceOptions', {})
  const source_options_all = get(source_options, '_', {})
  const source_options_file = get(source_options, 'file', {})
  echo "_:" . string(get(source_options_all, 'matchers'))
  echo "file:" . string(get(source_options_file, 'matchers'))
endfunction

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

  1. nvim -u init.vim
  2. :call ddu#start()
  3. :call EchoMatchers()
  4. type >
  5. :call EchoMatchers()

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

// before toggle
_:['matcher_hidden']
file:['matcher_hidden']

// after toggle
_:[]
file:['matcher_hidden']

Toggle mode of expandItem does not work when treePath is string[].

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

Problems summary

SSIA

Expected

Can toggle.

Environment Information

  • ddu.vim version (SHA1):
    53f1d5e

  • denops.vim version (SHA1):
    3b489d50ba2e034c829a09475a4002176bffbef7

  • deno version(deno -V output):
    deno 1.34.3

  • OS:
    Ubuntu 22.04 (WSL2)

  • neovim/Vim :version output:
    NVIM v0.10.0-dev-96b94f8

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

set runtimepath+=/path/to/denops.vim
set runtimepath+=/path/to/ddu.vim
set runtimepath+=/path/to/ddu-ui-ff

call ddu#custom#patch_global(#{
      \ sources: [#{ name: 'expand' }],
      \ ui: 'ff',
      \ uiParams: #{
      \   ff: #{
      \     displayTree: v:true,
      \   },
      \ },
      \})

augroup my-ddu-ff
  autocmd!
  autocmd FileType ddu-ff        call <SID>ddu_ff_mapping()
  autocmd FileType ddu-ff-filter call <SID>ddu_ff_filter_mapping()
augroup END

function! s:ddu_ff_mapping() abort
  nnoremap <buffer><silent> <CR>
        \ <Cmd>call ddu#ui#do_action('itemAction')<CR>
  nnoremap <buffer><silent> <Esc>
        \ <Cmd>call ddu#ui#do_action('quit')<CR>
  nnoremap <buffer><silent> e
        \ <Cmd>call ddu#ui#do_action('expandItem', #{mode: 'toggle'})<CR>
endfunction

function! s:ddu_ff_filter_mapping() abort
  nnoremap <buffer><silent> <Esc>
        \ <Cmd>call ddu#ui#do_action('closeFilterWindow')<CR>
endfunction

Place the following source under runtimepath.

  • denops/@ddu-sources/expand.ts
import { BaseSource, DduItem } from "https://deno.land/x/[email protected]/types.ts";
import { Denops } from "https://deno.land/x/[email protected]/deps.ts";

type Params = Record<never, never>;

export class Source extends BaseSource<Params> {
  gather(args: {
    sourceParams: Params;
    denops: Denops;
    parent?: DduItem;
  }) {
    return new ReadableStream({
      start(controller) {
        if (args.parent === undefined) {
          controller.enqueue([{
            word: "foo",
            treePath: ["foo"],
            // treePath: "/foo",
            isTree: true,
          }]);
        } else if (args.parent.word === "foo") {
          controller.enqueue([{
            word: "bar",
            treePath: ["foo", "bar"],
            // treePath: "/foo/bar",
            isTree: true,
          }]);
        } else if (args.parent.word === "bar") {
          controller.enqueue([{
            word: "baz",
            treePath: ["foo", "bar", "baz"],
            // treePath: "/foo/bar/baz",
            isTree: false,
          }]);
        }

        controller.close();
      },
    });
  }

  params() {
    return {};
  }
}

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

  1. call ddu#start({})
  2. Call expandItem with e. Since it is a toggle, it should close when it is already open, but it keeps adding new item

FYI: If you switch to a string treePath, which is commented out in expand.ts, this problem does not occur.

Screenshot (if possible)

treePath

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

If the same preview command exists, the second and subsequent commands are not executed.

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

Problems summary

If the same preview command exists, the second and subsequent commands are not executed.

Expected

All preview commands are executed.

Environment Information

  • ddu.vim version (SHA1): 07e9a28

  • denops.vim version (SHA1): 8f3899de3d3add07105221262dca90a31c4c2d4c

  • deno version(deno -V output): deno 1.31.1

  • OS: Linux (6.1.0-4-amd64)

  • neovim/Vim :version output:

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Mar  4 2023 19:53:01)
適用済パッチ: 1-1376

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

" Your minimal init.vim/vimrc
set runtimepath+=~/path/to/ddu.vim/
set runtimepath+=~/path/to/ddu-ui-ff/
set runtimepath+=~/path/to/test_kind/
  • ~/path/to/test_kind/denops/@ddu-sources/test.ts
import { BaseSource, Item } from "https://deno.land/x/[email protected]/types.ts";
import { GatherArguments } from "https://deno.land/x/[email protected]/base/source.ts";
import { ActionData } from "../@ddu-kinds/test.ts";

type Params = Record<never, never>;

export class Source extends BaseSource<Params> {
  kind = "test";

  gather(_args: GatherArguments<Params>): ReadableStream<Item<ActionData>[]> {
    return new ReadableStream({
      start(controler) {
        controler.enqueue([
          { word: "test-1", action: { time: 10 } },
          { word: "test-2", action: { time: 10 } },
          { word: "test-3", action: { time: 10 } },
        ]);
        controler.close();
      },
    });
  }

  params(): Params {
    return {};
  }
}
  • ~/path/to/test_kind/denops/@ddu-kinds/test.ts
import {
  ActionArguments,
  ActionFlags,
  BaseKind,
  Previewer,
} from "https://deno.land/x/[email protected]/types.ts";
import { GetPreviewerArguments } from "https://deno.land/x/[email protected]/base/kind.ts";
import { term_start } from "https://deno.land/x/[email protected]/function/vim/mod.ts";

type Params = Record<never, never>;

export type ActionData = {
  time: number;
}

export class Kind extends BaseKind<Params> {
  actions: Record<
    string,
    (args: ActionArguments<Params>) => Promise<ActionFlags>
  > = {};

  getPreviewer(args: GetPreviewerArguments): Promise<Previewer | undefined> {
    const action = args.item.action as ActionData
    return Promise.resolve({
      kind: "terminal",
      cmds: ["sleep", action.time],
    });
  }

  params(): Params {
    return {};
  }
}

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

  1. :call ddu#start({'ui': 'ff', 'sources': [{'name': 'test'}]})
  2. jj (invoke 2 preview commands)

Screenshot (if possible)

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

Cannot expand the tree from the beginning

Problems summary

I would like to expand items from the beginning, but it doesn't work.

Expected

The tree structure is displayed correctly.

Environment Information

  • ddu.vim version (SHA1):
    426c150

  • denops.vim version (SHA1):
    3b489d50ba2e034c829a09475a4002176bffbef7

  • deno version(deno -V output):
    deno 1.34.1

  • OS:
    Ubuntu 22.04 (WSL2)

  • neovim/Vim :version output:
    NVIM v0.10.0-dev-0370e4d

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

set runtimepath+=/path/to/denops.vim
set runtimepath+=/path/to/ddu.vim
set runtimepath+=/path/to/ddu-ui-ff
set runtimepath+=/path/to/ddu-kind-file

call ddu#custom#patch_global(#{
      \ sources: [#{ name: 'expand' }],
      \ ui: 'ff',
      \ uiParams: #{
      \   ff: #{
      \     displayTree: v:true,
      \   },
      \ },
      \})

augroup my-ddu-ff
  autocmd!
  autocmd FileType ddu-ff call <SID>ddu_ff_mapping()
augroup END

function! s:ddu_ff_mapping() abort
  nnoremap <buffer><silent> <Esc> <Cmd>call ddu#ui#do_action('quit')<CR>
endfunction

And place this source under stdpath('config').

  • denops/@ddu-sources/expand.ts
import { BaseSource, Item } from "https://deno.land/x/[email protected]/types.ts";
import { ActionData } from "https://deno.land/x/[email protected]/file.ts";

type Params = Record<never, never>;

export class Source extends BaseSource<Params> {
  kind = "file";

  gather(): ReadableStream<Item<ActionData>[]> {
    return new ReadableStream({
      start(controller) {
        controller.enqueue([
          {
            word: "foo",
            isTree: true,
            treePath: "/foo",
            isExpanded: true,
          },
          {
            word: "bar",
            isTree: false,
            treePath: "/foo/bar",
          },
        ]);
        controller.close();
      },
    });
  }

  params(): Params {
    return {};
  }
}

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

  1. call ddu#start({})
  2. You can already see that it's not a tree.

Screenshot (if possible)

image

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

Crash on `call ddu#start({})` by `E523: Not allowed here` in some case

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

Problems summary

Invoking call ddu#start({}) crashes denops.vim itself by E523: Not allowed here when statusline/tabline call function that invokes RPC call on Vim and Neovim (or sleep on Neovim.)

It seems sbuffer is called in statusline/tabline update context because of RPC asynchronous call and it seems that's not allowed. So I guess this is more likely a bug on Vim/Neovim side but not sure...

I wonder if call ddu#start({}) wrap internal call with timer_start() to evacuate sbuffer from that context solves this issue or not.

Expected

Works properly

Environment Information

  • ddu.vim version (SHA1): b52e60b

  • denops.vim version (SHA1): 963a8a9

  • gin.vim (SHA1): fe45b9e

    • NOTE: Workaround for this issue is already applied so you MUST use this SHA1 to reproduce the issue
  • deno version(deno -V output): deno 1.20.3

  • OS: macOS 12.3

  • neovim/Vim :version output:

    • Neovim v0.7.0-dev+1373-g80d4d6b48
    • Neovim v0.6.2
    • Vim 8.2.4600
  • :checkhealth or :CheckHealth result(neovim only):

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

if exists('+compatible') && &compatible
  set nocompatible
endif

" Disable Vim's native pack feature
set packpath=

" Clone https://github.com/lambdalisue/fern.vim in somewhere
" and specify that directory to the below
set runtimepath^=~/.config/nvim/pack/jetpack/src/denops.vim
set runtimepath^=~/.config/nvim/pack/jetpack/src/gin.vim
set runtimepath^=~/.config/nvim/pack/jetpack/src/ddu.vim
set runtimepath^=~/.config/nvim/pack/jetpack/src/ddu-ui-ff
set runtimepath^=~/.config/nvim/pack/jetpack/src/ddu-kind-file
set runtimepath^=~/.config/nvim/pack/jetpack/src/ddu-source-file_rec
set runtimepath^=~/.config/nvim/pack/jetpack/src/ddu-filter-matcher_substring

filetype plugin indent on
syntax on
"----------------------------------------------------------------

nnoremap ; :
nnoremap : ;

call ddu#custom#patch_global({
    \   'ui': 'ff',
    \   'sources': [{'name': 'file_rec', 'params': {}}],
    \   'sourceOptions': {
    \     '_': {
    \       'matchers': ['matcher_substring'],
    \     },
    \   },
    \   'kindOptions': {
    \     'file': {
    \       'defaultAction': 'open',
    \     },
    \   }
    \ })

set showtabline=2
" Crash with RPC calls in Vim or Neovim
set tabline=%{gin#component#worktree#name()}
" Or crash with sleep in Neovim (Vim won't)
" set tabline=%{Sleep()}
function! Sleep() abort
  sleep 10m
  return "Hello"
endfunction

"----------------------------------------------------------------
echomsg "Custom minimal vimrc has loaded"

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

  1. Invoke :call ddu#start({})

Screenshot (if possible)

CleanShot 2022-04-01 at 08 08 11

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.