Skip to content

Commit

Permalink
Add 1 second delay before replaying requests
Browse files Browse the repository at this point in the history
We don't know exactly when the server is fully initialised, and sending
requests too early can cause issues, see:
OmniSharp/omnisharp-roslyn#1521
  • Loading branch information
nickspoons committed Jul 31, 2019
1 parent b4b36ff commit 5d9bef5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions autoload/OmniSharp/stdio.vim
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ function! s:HandleServerEvent(job, res) abort
endif
let a:job.loaded = 1
silent doautocmd <nomodeline> User OmniSharpReady
call s:ReplayRequests()

" TODO: Remove this delay once we have better information about when the
" server is completely initialised:
" https://github.com/OmniSharp/omnisharp-roslyn/issues/1521
call timer_start(1000, function('s:ReplayRequests'))
" call s:ReplayRequests()

unlet a:job.loading
call timer_stop(a:job.loading_timeout)
unlet a:job.loading_timeout
Expand Down Expand Up @@ -193,7 +199,7 @@ function! s:RawRequest(body, command, opts, ...) abort
return 1
endfunction

function! s:ReplayRequests() abort
function! s:ReplayRequests(...) abort
for key in keys(s:pendingRequests)
call s:Request(key, s:pendingRequests[key])
unlet s:pendingRequests[key]
Expand Down

0 comments on commit 5d9bef5

Please sign in to comment.