-
Notifications
You must be signed in to change notification settings - Fork 408
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
No completion for FQN constructors #2152
Conversation
It definitely works. I'm just not sure if we should be accepting this without also fixing the duplicate constructor issue in JDT Core. |
Ok, so this is basically the same principle as redhat-developer/vscode-java#2538 ? The language server is doing the right thing and returning all the constructor invocations that match
Update : I noticed the constructors don't define a
Update 2 : |
@rgrunber I have updated the PR. Please review it. |
Awesome. Is there any downside to adding the typeInfo as filterText to all constructor invocations (not just when they're qualified with package name) ? It should simplify the logic quite a bit. |
|
@rgrunber I have updated the PR. |
@testforstephen , let me know if you're ok with with merging this. The only downside is it would expose eclipse-jdt/eclipse.jdt.core#195 until it gets fixed. |
I see some side effects with current change.
|
@snjeza initially had a change to only do the Do we need to abandon the |
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.
Seems fixed to me. @testforstephen , can you confirm ? The duplicate issue would be fixed after we update the target platform.
...rc/org/eclipse/jdt/ls/core/internal/contentassist/CompletionProposalDescriptionProvider.java
Outdated
Show resolved
Hide resolved
A related PR - #2158 |
ICompilationUnit unit = JDTUtils.resolveCompilationUnit(uri); | ||
if (unit != null) { | ||
IDocument document = JsonRpcHelpers.toDocument(unit.getBuffer()); | ||
String prefix = document.get(requiredProposal.getReplaceStart(), requiredProposal.getReplaceEnd() - requiredProposal.getReplaceStart()); | ||
if (prefix != null && prefix.indexOf(".") > -1) { |
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.
The new commit works well for the two cases I mentioned previously. One additional concern is performance.
The profiling shows the operation JDTUtils.resolveCompliationUnit
is not cheap. For all constructor completion proposals, the completion context prefix should be the same, can we calculate it only once and reuse it?
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.
Fixed.
@rgrunber @testforstephen I have updated the PR. |
Object data = item.getData(); | ||
if (data instanceof Map) { | ||
String uri = ((Map<String, String>) data).get(CompletionResolveHandler.DATA_FIELD_URI); |
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.
The latest commit works better.
A minor comment is to remove the unnecessary lines 344 ~ Line 346.
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.
Fixed.
Signed-off-by: Snjezana Peco <[email protected]>
@rgrunber @testforstephen I have updated the PR. |
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
Fixes #2147
Signed-off-by: Snjezana Peco [email protected]