diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetProperty.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetProperty.java
index 32a87fe3985..4923cd6b7dd 100644
--- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetProperty.java
+++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetProperty.java
@@ -17,6 +17,8 @@
package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode;
+import com.intellij.navigation.ItemPresentation;
+import com.intellij.navigation.ItemPresentationProviders;
import com.intellij.psi.PsiElement;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.SearchScope;
@@ -169,4 +171,9 @@ public class JetProperty extends JetTypeParameterListOwnerStub
+
@@ -198,6 +199,7 @@
+
diff --git a/idea/src/org/jetbrains/jet/plugin/caches/JetGotoSymbolContributor.java b/idea/src/org/jetbrains/jet/plugin/caches/JetGotoSymbolContributor.java
index 402e6c2e13d..6c5bf23852f 100644
--- a/idea/src/org/jetbrains/jet/plugin/caches/JetGotoSymbolContributor.java
+++ b/idea/src/org/jetbrains/jet/plugin/caches/JetGotoSymbolContributor.java
@@ -38,19 +38,26 @@ public class JetGotoSymbolContributor implements ChooseByNameContributor {
@NotNull
@Override
public String[] getNames(Project project, boolean includeNonProjectItems) {
- final Collection items = StubIndex.getInstance().getAllKeys(JetIndexKeys.FUNCTIONS_SHORT_NAME_KEY, project);
+ Collection items = StubIndex.getInstance().getAllKeys(JetIndexKeys.FUNCTIONS_SHORT_NAME_KEY, project);
+ items.addAll(StubIndex.getInstance().getAllKeys(JetIndexKeys.PROPERTIES_SHORT_NAME_KEY, project));
+
return ArrayUtil.toStringArray(items);
}
@NotNull
@Override
public NavigationItem[] getItemsByName(String name, String pattern, Project project, boolean includeNonProjectItems) {
- final GlobalSearchScope scope = includeNonProjectItems ? GlobalSearchScope.allScope(project) : GlobalSearchScope.projectScope(project);
+ GlobalSearchScope scope = includeNonProjectItems ? GlobalSearchScope.allScope(project) : GlobalSearchScope.projectScope(project);
- final Collection extends NavigationItem> functions = StubIndex.getInstance().get(
+ Collection extends NavigationItem> functions = StubIndex.getInstance().get(
JetIndexKeys.FUNCTIONS_SHORT_NAME_KEY, name, project, scope);
+ Collection extends NavigationItem> properties = StubIndex.getInstance().get(
+ JetIndexKeys.PROPERTIES_SHORT_NAME_KEY, name, project, scope);
+
final List items = new ArrayList(Collections2.filter(functions, Predicates.notNull()));
+ items.addAll(properties);
+
return ArrayUtil.toObjectArray(items, NavigationItem.class);
}
}
diff --git a/idea/src/org/jetbrains/jet/plugin/presentation/JetPropertyPresenter.java b/idea/src/org/jetbrains/jet/plugin/presentation/JetPropertyPresenter.java
new file mode 100644
index 00000000000..ce1cf887420
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/presentation/JetPropertyPresenter.java
@@ -0,0 +1,28 @@
+/*
+ * 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.presentation;
+
+import com.intellij.navigation.ItemPresentation;
+import com.intellij.navigation.ItemPresentationProvider;
+import org.jetbrains.jet.lang.psi.JetProperty;
+
+public class JetPropertyPresenter implements ItemPresentationProvider {
+ @Override
+ public ItemPresentation getPresentation(final JetProperty item) {
+ return new JetDefaultNamedDeclarationPresentation(item);
+ }
+}
\ No newline at end of file
diff --git a/idea/src/org/jetbrains/jet/plugin/stubindex/JetIndexKeys.java b/idea/src/org/jetbrains/jet/plugin/stubindex/JetIndexKeys.java
index 874d714d2b9..6ae438a71fd 100644
--- a/idea/src/org/jetbrains/jet/plugin/stubindex/JetIndexKeys.java
+++ b/idea/src/org/jetbrains/jet/plugin/stubindex/JetIndexKeys.java
@@ -44,6 +44,7 @@ public interface JetIndexKeys {
StubIndexKey.createIndexKey("jet.top.level.property.fqn.name");
StubIndexKey FUNCTIONS_SHORT_NAME_KEY = StubIndexKey.createIndexKey("jet.functions.short.name");
+ StubIndexKey PROPERTIES_SHORT_NAME_KEY = StubIndexKey.createIndexKey("jet.properties.short.name");
StubIndexKey ANNOTATIONS_KEY = StubIndexKey.createIndexKey("jet.annotations");
}
diff --git a/idea/src/org/jetbrains/jet/plugin/stubindex/JetShortPropertiesNameIndex.java b/idea/src/org/jetbrains/jet/plugin/stubindex/JetShortPropertiesNameIndex.java
new file mode 100644
index 00000000000..625a521b376
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/stubindex/JetShortPropertiesNameIndex.java
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+public class JetShortPropertiesNameIndex extends StringStubIndexExtension {
+ private static final JetShortPropertiesNameIndex ourInstance = new JetShortPropertiesNameIndex();
+
+ public static JetShortPropertiesNameIndex getInstance() {
+ return ourInstance;
+ }
+
+ @NotNull
+ @Override
+ public StubIndexKey getKey() {
+ return JetIndexKeys.PROPERTIES_SHORT_NAME_KEY;
+ }
+
+ @Override
+ public Collection get(final String s, final Project project, @NotNull final GlobalSearchScope scope) {
+ return super.get(s, project, new JetSourceFilterScope(scope));
+ }
+}
\ No newline at end of file
diff --git a/idea/src/org/jetbrains/jet/plugin/stubindex/StubIndexServiceImpl.java b/idea/src/org/jetbrains/jet/plugin/stubindex/StubIndexServiceImpl.java
index bb303807ae7..b729763fd6f 100644
--- a/idea/src/org/jetbrains/jet/plugin/stubindex/StubIndexServiceImpl.java
+++ b/idea/src/org/jetbrains/jet/plugin/stubindex/StubIndexServiceImpl.java
@@ -81,11 +81,16 @@ public class StubIndexServiceImpl implements StubIndexService {
@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());
+ String propertyName = stub.getName();
+ if (propertyName != null) {
+ if (stub.isTopLevel()) {
+ FqName topFQName = stub.getTopFQName();
+ if (topFQName != null) {
+ sink.occurrence(JetIndexKeys.TOP_LEVEL_PROPERTY_FQN_NAME_KEY, topFQName.toString());
+ }
}
+
+ sink.occurrence(JetIndexKeys.PROPERTIES_SHORT_NAME_KEY, propertyName);
}
}
diff --git a/idea/testData/navigation/gotoSymbol/functions.kt b/idea/testData/navigation/gotoSymbol/functions.kt
new file mode 100644
index 00000000000..50953703f0f
--- /dev/null
+++ b/idea/testData/navigation/gotoSymbol/functions.kt
@@ -0,0 +1,12 @@
+fun testFunction() {
+}
+
+class Some {
+ fun testFunInClass() = 12
+}
+
+// SEARCH_TEXT: test
+// REF: (in ).testFunction()
+// REF: (in Some).testFunInClass()
+
+
diff --git a/idea/testData/navigation/gotoSymbol/properties.kt b/idea/testData/navigation/gotoSymbol/properties.kt
new file mode 100644
index 00000000000..bd9d3766d2e
--- /dev/null
+++ b/idea/testData/navigation/gotoSymbol/properties.kt
@@ -0,0 +1,23 @@
+val testGlobal = 12
+
+fun some() {
+ val testInFun = 12
+}
+
+trait SomeTrait {
+ val testInTrait
+}
+
+class Some() {
+ val testInClass = 12
+
+ class object {
+ val testInClassObject = 12
+ }
+}
+
+// SEARCH_TEXT: test
+// REF: ().testGlobal
+// REF: (Some).testInClass
+// REF: (Some).testInClassObject
+// REF: (SomeTrait).testInTrait
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/jet/plugin/navigation/ImplementationTestUtils.java b/idea/tests/org/jetbrains/jet/plugin/navigation/ImplementationTestUtils.java
index 427ec683978..416fcc38cdd 100644
--- a/idea/tests/org/jetbrains/jet/plugin/navigation/ImplementationTestUtils.java
+++ b/idea/tests/org/jetbrains/jet/plugin/navigation/ImplementationTestUtils.java
@@ -21,15 +21,20 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Ordering;
import com.intellij.codeInsight.navigation.GotoImplementationHandler;
import com.intellij.codeInsight.navigation.GotoTargetHandler;
+import com.intellij.ide.util.gotoByName.GotoSymbolModel2;
import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.progress.util.ProgressIndicatorBase;
+import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.testFramework.UsefulTestCase;
import junit.framework.Assert;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.InTextDirectivesUtils;
import org.jetbrains.jet.testing.ReferenceUtils;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -67,4 +72,36 @@ public final class ImplementationTestUtils {
UsefulTestCase.assertEmpty(expectedReferences);
}
}
+
+ public static void assertGotoSymbol(@NotNull Project project, @NotNull Editor editor) {
+
+ List searchTextList = InTextDirectivesUtils.findListWithPrefix("// SEARCH_TEXT:", editor.getDocument().getText());
+ Assert.assertFalse("There's no search text in test data file given. Use '// SEARCH_TEXT:' directive",
+ searchTextList.isEmpty());
+
+ List expectedReferences = InTextDirectivesUtils.findListWithPrefix("// REF:", editor.getDocument().getText());
+
+ String searchText = searchTextList.get(0);
+
+ List