Fix infinite autocompletion loop#5130
Merged
w0rp merged 6 commits intoMay 28, 2026
Merged
Conversation
Contributor
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. |
w0rp
approved these changes
May 28, 2026
Member
w0rp
left a comment
There was a problem hiding this comment.
This looks sensible to me.
Cheers! 🍻
Member
|
There's probably some way to mitigate the test suite locking up, but if it works it'll work. |
Contributor
Author
|
Great, thanks for merging :) |
Contributor
Author
The only way I could think of, would be to run the test in a separate test-suite with a timeout. Something like: But maybe setting up a separate test-suite just to mitigate a problem, which is unlikely to happen, is a bit over-engineered here ;) |
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.