Fix vim8 hang when ch_status() == 'buffered' but ch_read returns nothing #121
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It seems that sometimes, the ch_status is buffered, but ch_read is
returning nothing. vim_oneshot_handler is stuck in an infinite loop.
Since this is happening in the main thread, vim appears to lockup until
you hit Ctrl+c or something to interrupt eval of this code.
Specifically, I've seen this when using the clang autocompletion on
C-like languages. If I was typing particularly fast, I would see this
issue occur. It was getting annoying.
I ran vim in GDB to try and figure out what was going
on, saw that it was evaling this code inside this function. I then added
logging to this function and confirmed that the problem was here.
Based on my understanding, it is safe to exit the loop early, you might
just not get all your completions...