Open snjeza opened 4 months ago
Can you please check with latest 4.32 I-Build?
Can you please check with latest 4.32 I-Build?
Unfortunately, the recent work on patterns is pure compiler work and does not cover code completion and https://github.com/eclipse-jdt/eclipse.jdt.core/pull/1349 and its cousins are also only focussed on code selection not completion.
@snjeza - the fix proposed in https://github.com/eclipse-jdt/eclipse.jdt.core/pull/2107 is suspect. You should never have to fiddle with ExtraCompilerModifiers.AccOutOfFlowScope
bits.
The parse tree recovered in the working case you report is:
import java.util.ArrayList;
import java.util.List;
public class SimpleJavaClass {
String things;
public SimpleJavaClass() {
}
public static void main(String[] args) {
Object unknown;
{
things.is Object;
if ((unknown instanceof List things))
<CompleteOnName:things.is>;
}
}
}
and the parse tree recovered in the non-working case is:
import java.util.ArrayList;
import java.util.List;
public class SimpleJavaClass {
String things;
public SimpleJavaClass() {
}
public static void main(String[] args) {
Object unknown;
{
if ((unknown instanceof List things))
<CompleteOnType:things.is> Object;
}
}
}
There in lies the problem.
Completion is being attempted on a Name
in both instances. Why do we think it is being attempted on a Type
? I can help with reviewing an alternate fix. Thanks
Can you please check with latest 4.32 I-Build?
I have reproduced the issue in the master branch - https://github.com/eclipse-jdt/eclipse.jdt.core/commit/d767ba20f5a1ae9ef4edec3b247d999f5c40a92c
Completion is being attempted on a Name in both instances. Why do we think it is being attempted on a Type ? I can help with reviewing an alternate fix. Thanks
The parser returns CompletionOnQualifiedNameReference
in line 10 (it works) and CompletionOnQualifiedTypeReference
in line 8 (it doesn't work)
Completion is being attempted on a Name in both instances. Why do we think it is being attempted on a Type ? I can help with reviewing an alternate fix. Thanks
The parser returns
CompletionOnQualifiedNameReference
in line 10 (it works) andCompletionOnQualifiedTypeReference
in line 8 (it doesn't work)
Right, that is the bug that needs fixing.
the fix proposed in https://github.com/eclipse-jdt/eclipse.jdt.core/pull/2107 is suspect. You should never have to fiddle with ExtraCompilerModifiers.AccOutOfFlowScope bits.
I have restored it at https://github.com/eclipse-jdt/eclipse.jdt.core/pull/2107/commits/015c32e1e474ddbe8dbc2efbf6b6b3052cd87fa3#diff-8469e0f05a7f350e7047101a3e20fe0bf4d0f65df01fa0a18eb6378128c5de5aR2364
I can help with reviewing an alternate fix. Right, that is the bug that needs fixing.
I will try. Thanks.
I can help with reviewing an alternate fix. Right, that is the bug that needs fixing.
I will try. Thanks.
Good luck! You may want to compare how the parse tree looks with code select when you control click on things.isEmpty() at both places.
The related issues:
From https://github.com/eclipse-jdtls/eclipse.jdt.ls/issues/3068 Consider the following code:
CA returns no results if requested for the first occurrence of things.is. It returns isEmpty(), however, for the second occurrence of thing.is