Merged
Conversation
randy3k
reviewed
Apr 8, 2021
| } | ||
|
|
||
| init_count <- length(completions) | ||
| nmax <- getOption("languageserver.max_completions", 200) |
Member
There was a problem hiding this comment.
I think this setting name should be more explicit, it gives users a feeling that this is the absolute maximum number of items.
Member
Author
There was a problem hiding this comment.
It is indeed the max number of completion items to return to the client. The results will be truncated to this number if it is more than that. Am I misunderstanding your meaning?
Member
There was a problem hiding this comment.
Ya, you are correct. I was confused. Sorry for the noise.
randy3k
requested changes
Apr 8, 2021
randy3k
approved these changes
Apr 9, 2021
kar9222
pushed a commit
to kar9222/languageserver
that referenced
this pull request
Apr 20, 2021
Faster completion
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.
Closes #412
This PR improves the performance of completion by limiting the max number of completions to return to the client and utilizing the
isIncompletefeature.If the completion list contains more than
nmax(by default, 200) items, then the list is sorted by whether it starts withtokenand thesortTextof the item, and the topnmaxitems are returned withisIncomplete = TRUEso that subsequent keystrokes will still trigger completion requests until the completion list is narrowed down to no greater thannmax.This largely avoids too much traffic from the response to the completion request triggered by the first keystroke, which could potentially match too many results.
Old behavior (on my machine working in languageserver project):
aisIncomplete=FALSE, and subsequent keystrokes do not trigger completion request.In this case, a notable delay could be observed on first keystroke of a token.
New behavior:
aisIncomplete=TRUE.sisIncomplete=TRUE.isIncomplete=FALSE, and subsequent keystrokes do not trigger completion request.In this case, the traffic between server and client is reduced and the delay on first keystroke is much reduced.