mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
make completion work in java type arguments inside cast
This commit is contained in:
+6
-1
@@ -789,6 +789,11 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
}
|
||||
|
||||
if (context.getCompletionType() == CompletionType.BASIC) {
|
||||
if (PsiTreeUtil.findElementOfClassAtOffset(file, context.getStartOffset() - 1, PsiReferenceParameterList.class, false) != null) {
|
||||
context.setDummyIdentifier(CompletionInitializationContext.DUMMY_IDENTIFIER_TRIMMED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (semicolonNeeded(context.getEditor(), file, context.getStartOffset())) {
|
||||
context.setDummyIdentifier(CompletionInitializationContext.DUMMY_IDENTIFIER.trim() + ";");
|
||||
return;
|
||||
@@ -818,7 +823,7 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean semicolonNeeded(final Editor editor, PsiFile file, final int startOffset) {
|
||||
public static boolean semicolonNeeded(Editor editor, PsiFile file, int startOffset) {
|
||||
PsiJavaCodeReferenceElement ref = PsiTreeUtil.findElementOfClassAtOffset(file, startOffset, PsiJavaCodeReferenceElement.class, false);
|
||||
if (ref != null && !(ref instanceof PsiReferenceExpression)) {
|
||||
if (ref.getParent() instanceof PsiTypeElement) {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class Z {
|
||||
{
|
||||
Object o = ((Mapx<Integer, Str<caret>ing>) o1).get();
|
||||
}
|
||||
}
|
||||
+5
@@ -1794,5 +1794,10 @@ class Bar {
|
||||
configure()
|
||||
assert myFixture.lookupElements.collect { LookupElementPresentation.renderElement(it).itemText } == ['Bar.valueOf', 'Foo.valueOf', 'Enum.valueOf']
|
||||
}
|
||||
|
||||
void testTypeArgumentInCast() {
|
||||
configure()
|
||||
myFixture.assertPreferredCompletionItems 0, 'String'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user