Make Kotlin light classes pass "element instanceof StubBasedPsiElement" in LocalSearchScope scope
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
public class ImplementJavaInnerInterface {
|
||||
interface Test {
|
||||
void foo();
|
||||
}
|
||||
|
||||
void test() {
|
||||
Test test = new Test() {
|
||||
@Override
|
||||
public void foo() {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void usage(Test test) {
|
||||
test.<caret>foo();
|
||||
}
|
||||
}
|
||||
|
||||
// REF: (in KotlinTest).foo()
|
||||
// REF: <anonymous>.foo()
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class KotlinTest : ImplementJavaInnerInterface.Test {
|
||||
override fun foo() {}
|
||||
}
|
||||
+8
@@ -62,10 +62,18 @@ public class JetGotoImplementationMultifileTest extends JetLightCodeInsightFixtu
|
||||
doKotlinJavaTest();
|
||||
}
|
||||
|
||||
public void testImplementJavaInnerInterface() throws Exception {
|
||||
doJavaKotlinTest();
|
||||
}
|
||||
|
||||
private void doKotlinJavaTest() throws Exception {
|
||||
doMultifileTest(getTestName(false) + ".kt", getTestName(false) + ".java");
|
||||
}
|
||||
|
||||
private void doJavaKotlinTest() throws Exception {
|
||||
doMultifileTest(getTestName(false) + ".java", getTestName(false) + ".kt");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.test;
|
||||
|
||||
import com.intellij.navigation.ItemPresentation;
|
||||
import com.intellij.navigation.NavigationItem;
|
||||
import com.intellij.psi.PsiAnonymousClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiPackage;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
@@ -49,6 +50,9 @@ public final class ReferenceUtils {
|
||||
|
||||
String presentableText = presentation.getPresentableText();
|
||||
String locationString = presentation.getLocationString();
|
||||
if (locationString == null && element.getParent() instanceof PsiAnonymousClass) {
|
||||
locationString = "<anonymous>";
|
||||
}
|
||||
return locationString == null || navigationElement instanceof PsiPackage
|
||||
// for PsiPackage, presentableText is FQ name of current package
|
||||
? presentableText
|
||||
|
||||
Reference in New Issue
Block a user