statiolake / ddc-ale

ALE source for ddc.vim
14 stars 1 forks source link

Timeout causes issues #2

Closed amadeus closed 3 years ago

amadeus commented 3 years ago

I've found the timeout functionality in this plugin can cause some strange and inconsistent behavior.

Here's an example with this plugin, using the latest code on master that shows the bug:

https://user-images.githubusercontent.com/83376/131296504-3929e97b-8110-4e64-80dc-f08454b603cf.mp4

And here's what it looks like if I remove the timeout:

https://user-images.githubusercontent.com/83376/131296446-334c7f8f-35c8-4bf5-b8af-0b2f9e04ae09.mp4

My configuration for this plugin and DDC are:

call ddc#custom#patch_global('sources', ['ale', 'buffer'])

call ddc#custom#patch_global('sourceOptions', {
  \ '_': {
    \ 'matchers': ['matcher_head'],
    \ 'converters': ['converter_remove_overlap'],
    \ 'sorters': ['sorter_rank'],
    \ 'minAutoCompleteLength': 1,
    \ 'isVolatile': v:true,
  \ },
  \ 'ale': {
    \ 'mark': 'lsp',
    \ 'forceCompletionPattern': '\.|:|->'
  \ },
  \ 'buffer': { 'mark': 'buf' },
\ })

call ddc#custom#patch_global('sourceParams', {
  \ 'buffer': {'requireSameFiletype': v:false},
\ })
statiolake commented 3 years ago

Thank you. I reverted the commit for now. That commit was an experimental fix for the issue I found in my environment, but I was not sure that actually fixes my issue...

amadeus commented 3 years ago

thx!

amadeus commented 3 years ago

FWIW, I did notice that the modules you are using for this plugin are a bit behind the current versions (and have noticed, that after some time, I start seeing some strange messagepack timeout errors). I'll test out upgrading to the latest ddc_vim lib and see if that fixes things.

amadeus commented 3 years ago

It looks like upgrading does not fix the issue. I suspect the issue is that there are times, quite often, when ale decides not to respond to the completion callbacks, which I think, in essence means that it never resolves.

Not sure if this is something that should be fixed by ddc, or if it's something that should be fixed with this particular library. I am doing a quick test to try and see if I can cut down on requests that don't respond.

amadeus commented 3 years ago

I believe the timeout issues should now be solved on ddc's side via this commit:

https://github.com/Shougo/ddc.vim/commit/2f77ab5d4fc53d9ec831799725351c98507d6315

If interested in more context, I did some digging here: https://github.com/Shougo/ddc.vim/issues/39#issuecomment-908816454

statiolake commented 3 years ago

Now I understood the cause of timeout. Thank you for your investigation!