Fix infinite autocompletion loop#5130
Open
letorbi wants to merge 6 commits into
Open
Conversation
Author
|
Sorry for adding additional commits, despite the PR was not marked as a draft. I am done now and the PR is ready for review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I stumbled upon an infinite loop while using "pure" omnicompletion with ALE's omnifunction and Vim's native autocompletion:
Apparently
ale#completion#OmniFuncdoes not ever return, if the language server has no completion capabilities. I was able to track the cause down to the while-loop, which waits for the server result. This PR breaks the infinite-loop by introducing a timeout check in the while-loop. The timeout is 3 seconds by default, but can be configured viag:ale_completion_timeout, which takes a float value that is interpreted as seconds.Additionally, I was able to fix the underlying cause by returning an empty result, if the language server does not have completion capabilities. This fixes the problem, but IMHO the timeout should still be included in order to prevent locks due to other reasons.
A test has also been added, but I am not sure whether it should really be included in the test suite, because it might lock the whole suite, if the timeout does not work as expected.