kyoh86 / vim-ripgrep

A plugin for Vim8/Neovim to search text by ripgrep (rg) asynchronously
MIT License
30 stars 3 forks source link

ripgrep#observe#add_observer() ignores two or more observers #13

Closed a5ob7r closed 7 months ago

a5ob7r commented 7 months ago

ripgrep#observe#add_observer() doesn't add an observer if the first observer for the same event has already been added.

Reproduction steps are as below in Vim 9.1(patches: 1-163).

function! Observer1(_) abort
  call setqflist([{ 'text': 'Observer1' }], 'a')
endfunction

function! Observer2(_) abort
  call setqflist([{ 'text': 'Observer2' }], 'a')
endfunction

call ripgrep#observe#add_observer('match', 'Observer1')
call ripgrep#observe#add_observer('match', 'Observer2')

call ripgrep#search('ripgrep')
copen
" Only "Observer1" are listed in the quickfix window.
kyoh86 commented 7 months ago

@a5ob7r It was a bug. I fixed it so could you try it?

a5ob7r commented 7 months ago

I confirmed it works well. Thank you.