-
Notifications
You must be signed in to change notification settings - Fork 401
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
Limit completion results #1298
Limit completion results #1298
Conversation
e156a5b
to
e6eedde
Compare
ec32884
to
ef1e043
Compare
ef1e043
to
4402722
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some suggestions.
if (i >= p2Length) { | ||
return -1; | ||
} | ||
res = Character.compare(p1.getCompletion()[i], p2.getCompletion()[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we cache the result of getCompletion()
with a variable outside the for loop? The implementation of getCompletion
is pretty complex in org.eclipse.jdt.internal.codeassist.InternalCompletionProposal
and calling it in each iteration looks expensive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
private String getSortText(CompletionItem ci) { | ||
return StringUtils.defaultString(ci.getSortText(), "99999999999"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the SortTextHelper.CELING
for consistency?
Its value is 999_999_999
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
2aa4845
to
abb3a2c
Compare
TextEdits need to be computed during the completion call, but this can be extremely slow when a large number of results is returned. This change tries to mitigate the issue by returning a partial result list and marking the results as incomplete. Smaller payload means computing Textedits is now more affordable. Hopefully the UX should be improved as well since completion queries will return faster too. The number of completion results is configurable with the java.completion.maxResults preference (defaults to 50). Setting 0 will disable the limit and return all results. Be aware the performance will be very negatively impacted as textEdits for all results will be computed eagerly (can be thousands of results). Fixes eclipse-jdtls#465 Signed-off-by: Fred Bricon <[email protected]>
abb3a2c
to
e04188e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
TextEdits need to be computed during the
completion
call, but this can be extremely slow when a large number of results is returned. This PR tries to mitigate the issue by returning partial result lists and marking the results as incomplete. Smaller payload means computing Textedits is now more affordable. Hopefully the UX should be improved as well since completion queries will return faster too.The number of completion results is configurable with the
java.completion.maxResults
preference (defaults to 50). Setting 0 will disable the limit and return all results. Be aware the performance will be very negatively impacted as textEdits for all results will be computed eagerly (can be thousands of results).Fixes #465
Signed-off-by: Fred Bricon [email protected]