Index package-level properties
This commit is contained in:
@@ -185,6 +185,7 @@
|
||||
<stubIndex implementation="org.jetbrains.jet.plugin.stubindex.JetAllShortFunctionNameIndex"/>
|
||||
<stubIndex implementation="org.jetbrains.jet.plugin.stubindex.JetSuperClassIndex"/>
|
||||
<stubIndex implementation="org.jetbrains.jet.plugin.stubindex.JetTopLevelFunctionsFqnNameIndex" />
|
||||
<stubIndex implementation="org.jetbrains.jet.plugin.stubindex.JetTopLevelPropertiesFqnNameIndex" />
|
||||
|
||||
<contentBasedClassFileProcessor implementation="org.jetbrains.jet.plugin.libraries.JetContentBasedFileSubstitutor" />
|
||||
<psi.clsCustomNavigationPolicy implementation="org.jetbrains.jet.plugin.libraries.JetClsNavigationPolicy" />
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.jet.plugin.stubindex;
|
||||
import com.intellij.psi.stubs.StubIndexKey;
|
||||
import org.jetbrains.jet.lang.psi.JetClassOrObject;
|
||||
import org.jetbrains.jet.lang.psi.JetNamedFunction;
|
||||
import org.jetbrains.jet.lang.psi.JetProperty;
|
||||
|
||||
/**
|
||||
* @author Nikolay Krasko
|
||||
@@ -38,6 +39,9 @@ public interface JetIndexKeys {
|
||||
StubIndexKey<String, JetNamedFunction> TOP_LEVEL_FUNCTIONS_FQN_NAME_KEY =
|
||||
StubIndexKey.createIndexKey("jet.top.level.functions.fqn.name");
|
||||
|
||||
StubIndexKey<String, JetProperty> TOP_LEVEL_PROPERTY_FQN_NAME_KEY =
|
||||
StubIndexKey.createIndexKey("jet.top.level.property.fqn.name");
|
||||
|
||||
StubIndexKey<String, JetNamedFunction> FUNCTIONS_SHORT_NAME_KEY = StubIndexKey.createIndexKey("jet.functions.short.name");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.stubindex;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.stubs.StringStubIndexExtension;
|
||||
import com.intellij.psi.stubs.StubIndexKey;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetProperty;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author Nikolay Krasko
|
||||
*/
|
||||
public class JetTopLevelPropertiesFqnNameIndex extends StringStubIndexExtension<JetProperty> {
|
||||
private static final JetTopLevelPropertiesFqnNameIndex INSTANCE = new JetTopLevelPropertiesFqnNameIndex();
|
||||
|
||||
public static JetTopLevelPropertiesFqnNameIndex getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public StubIndexKey<String, JetProperty> getKey() {
|
||||
return JetIndexKeys.TOP_LEVEL_PROPERTY_FQN_NAME_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<JetProperty> get(final String s, final Project project, @NotNull final GlobalSearchScope scope) {
|
||||
return super.get(s, project, new JetSourceFilterScope(scope));
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import com.intellij.psi.stubs.IndexSink;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetClassStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetFunctionStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetObjectStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetPropertyStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.StubIndexService;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
@@ -76,4 +77,14 @@ public class StubIndexServiceImpl implements StubIndexService {
|
||||
sink.occurrence(JetIndexKeys.FUNCTIONS_SHORT_NAME_KEY, name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void indexProperty(PsiJetPropertyStub stub, IndexSink sink) {
|
||||
if (stub.isTopLevel()) {
|
||||
FqName topFQName = stub.getTopFQName();
|
||||
if (topFQName != null) {
|
||||
sink.occurrence(JetIndexKeys.TOP_LEVEL_PROPERTY_FQN_NAME_KEY, topFQName.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-17
@@ -19,12 +19,9 @@ package org.jetbrains.jet.plugin.stubindex.resolve;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetClassOrObject;
|
||||
import org.jetbrains.jet.lang.psi.JetDeclaration;
|
||||
import org.jetbrains.jet.lang.psi.JetNamedFunction;
|
||||
import org.jetbrains.jet.lang.psi.JetProperty;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.DeclarationProvider;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -37,20 +34,6 @@ public abstract class AbstractStubDeclarationProvider implements DeclarationProv
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<JetNamedFunction> getFunctionDeclarations(@NotNull Name name) {
|
||||
// TODO:
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<JetProperty> getPropertyDeclarations(@NotNull Name name) {
|
||||
// TODO:
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetClassOrObject getClassOrObjectDeclaration(@NotNull Name name) {
|
||||
// TODO:
|
||||
|
||||
+19
@@ -17,8 +17,13 @@
|
||||
package org.jetbrains.jet.plugin.stubindex.resolve;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetNamedFunction;
|
||||
import org.jetbrains.jet.lang.psi.JetProperty;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.ClassMemberDeclarationProvider;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.data.JetClassLikeInfo;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author Nikolay Krasko
|
||||
@@ -30,4 +35,18 @@ public class StubClassMemberDeclarationProvider extends AbstractStubDeclarationP
|
||||
// TODO:
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<JetNamedFunction> getFunctionDeclarations(@NotNull Name name) {
|
||||
// TODO:
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<JetProperty> getPropertyDeclarations(@NotNull Name name) {
|
||||
// TODO:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -30,10 +30,10 @@ import org.jetbrains.jet.lang.resolve.lazy.PackageMemberDeclarationProvider;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.plugin.stubindex.JetTopLevelFunctionsFqnNameIndex;
|
||||
import org.jetbrains.jet.plugin.stubindex.JetTopLevelPropertiesFqnNameIndex;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Nikolay Krasko
|
||||
@@ -68,8 +68,8 @@ public class StubPackageMemberDeclarationProvider extends AbstractStubDeclaratio
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<JetProperty> getPropertyDeclarations(@NotNull Name name) {
|
||||
return super.getPropertyDeclarations(name); //To change body of overridden methods use File | Settings | File Templates.
|
||||
public Collection<JetProperty> getPropertyDeclarations(@NotNull Name name) {
|
||||
return JetTopLevelPropertiesFqnNameIndex.getInstance().get(fqName.child(name).toString(), project, GlobalSearchScope.allScope(project));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user