mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not claim inner / anonymous classes as indexable (we process them from top level class)
This commit is contained in:
@@ -43,16 +43,21 @@ public class ClassFileViewProvider extends SingleRootFileViewProvider {
|
||||
}
|
||||
|
||||
// skip inners & anonymous
|
||||
if (isInnerClass(vFile)) return null;
|
||||
|
||||
return new ClsFileImpl(PsiManager.getInstance(project), this);
|
||||
}
|
||||
|
||||
public static boolean isInnerClass(VirtualFile vFile) {
|
||||
String name = vFile.getNameWithoutExtension();
|
||||
int index = name.lastIndexOf('$', name.length());
|
||||
if (index > 0 && index < name.length() - 1) {
|
||||
String supposedParentName = name.substring(0, index) + ".class";
|
||||
if (vFile.getParent().findChild(supposedParentName) != null) {
|
||||
return null;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return new ClsFileImpl(PsiManager.getInstance(project), this);
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.ClassFileViewProvider;
|
||||
import com.intellij.psi.impl.source.JavaFileElementType;
|
||||
import com.intellij.psi.stubs.BinaryFileStubBuilder;
|
||||
import com.intellij.psi.stubs.PsiFileStub;
|
||||
@@ -39,7 +40,7 @@ public class ClassFileStubBuilder implements BinaryFileStubBuilder {
|
||||
|
||||
@Override
|
||||
public boolean acceptsFile(final VirtualFile file) {
|
||||
return true;
|
||||
return !ClassFileViewProvider.isInnerClass(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user