-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
feat: extend complete_add function #16662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
adf2150
to
3d21256
Compare
What is the benefit of this over calling |
Calling complete again will not redraw? Complete will also call ins_compl_del_pum and then rebuild pum. LSP allows multiple clients to handle completion requests. Currently complete_add will use del_pum false to prevent ins_compl_add from deleting pum. You can check the linked issue to understand the problem. compelte_remove is also needed, but I want to confirm the behavior of PR first |
3d21256
to
cfb0541
Compare
cfb0541
to
c7986a5
Compare
What is this purpose of this PR? |
|
Shouldn't LSP Clients cache incomplete results in both scenarios?
I would expect modern LSP clients to have already solved this issue. You may verify this with the authors. |
How to cache when the characters are different? . complete_add exists to extend matches but is currently too limited. linked issue is sufficient to explain the problem |
I read the issue you linked, but it is not clear. If the LSP client can choose to append to the existing match list instead of replacing it entirely, it can always use The issue you linked looks like a bug in LSP client implementation in neovim. client2 should be triggered on |
d3a93a6
to
84cd15d
Compare
It is feasible. but the time complexity here increases with the number of items. Secondly, when the merge process is completed, calling complete again on the C side still requires memory allocation. Isn't this more wasteful? and calling compelte_info also requires memory allocation. |
complete_add support adding matches to list of current completion
84cd15d
to
e3e3c92
Compare
Hm, I am still not sure about this. The use case seems quite niche and a user reading the help file, won't be necessarily clear when to use |
The documentation states: “The {startcol} must match the current completion column.” In practice, |
I tend to agree |
I think you didn't see the problem clearly. b triggers textDocumention/completion request again because isIncomplete, how to merge the new result with all existing results. Your approach is to get complete_items from complete_info and then get lsp from user_data structure and then merge. How much memory allocation efficiency is there here. This is not a niche problem. There will be many lsp clients in one buffer. |
This PR appends the new request results and updates pum, complete_add needs to specify an existing startcol to ensure that it is the same as the current. Or the complete function returns an id and uses this id as the remaining book. |
complete_add support adding matches to list of current completion