-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Description
Is your feature request about something that is currently impossible or hard to do? Please describe the problem.
Manual Insert mode completion (like after <C-n>) is blocking and can take non-negligible amount of time to finish (like when there is a big buffer open).
Recently #17812 introduced a concept of "timing out" a 'complete' source while returning candidates found within allocated time slot. If applied to manual completion, this seems to improve the blocking behavior.
The problem is that timeout is not configurable (which seems to be by initial design) and only applied when 'autocomplete' is enabled.
Describe the solution you'd like
A way to configure "timeout for 'complete' source" that will apply to both 'autocomplete' (probably as initial timeout before decay) and manual <C-n> invocation (probably without decaying and applied to each source separately).
Being able to configure this will improve both manual and auto completion experience.
One of the way to do it might be to allow a new completeopt flag that configures timeout. Maybe something like timeout:ms, so that set completeopt+=timeout:500 sets timeout to 500 milliseconds.
The other way is a separate option, like 'completetimeout'.
Describe alternatives you've considered
Asking for manual completion to be non-blocking, but this seems to be too complicated. There seems to already be an infrastructure for "timeout" feature which is a reasonable solution.
Additional context
There is a note in #17812 that "Timeout values are intentionally not configurable". I do understand the "just work" approach, but the problem is that slow completion candidate computation might be a result of slow machine or generally slow LSP server. And although there might be small amount of candidates available within 80 ms window, it might be inconvenient to not have more candidates at the cost of small time increase (if user wants it).
Allowing users to adjust timeout seems like a not overly complicated way to solve this. So it can "just work" with enabled 'autocomplete', but still allow users to adjust for both auto and manual completion.
cc @girishji as you are the most qualified person to discuss and potentially add this.