neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.15k stars 953 forks source link

Asynchronous Completion for `isIncomplete` Items in coc.nvim #5028

Open hexh250786313 opened 1 month ago

hexh250786313 commented 1 month ago

In the current implementation of coc.nvim, when there are isIncomplete items in the completion panel, the entire panel is blocked waiting for the completion results of these isIncomplete items. During this time, even if the user has other inputs, the completion panel will not update because it is completely blocked.

This behavior is not very user-friendly, as the completion results for isIncomplete items may be slow, leading to a poor experience with the entire completion panel. I suggest that for these isIncomplete items, completion should be performed asynchronously in the background. The completion panel can then be updated once their completion results are returned, rather than blocking the entire panel.

Meanwhile, other non-isIncomplete items should be able to display their results immediately, instead of being blocked along with the isIncomplete items.

https://github.com/neoclide/coc.nvim/assets/26080416/246ac5ae-c0bc-435b-ba82-4c039856ee16

As can be seen from the screenshot above, when I input s and remove it, the entire completion panel updates very slowly, it is completely blocked by the [Cop] completion source. In this example, the [A] completion source should not wait for the results of [Cop], it should update immediately when s changes, and then update the entire completion panel again after the results of [Cop] are returned.