From 5807d03a52d3d690e26098a2312fc21c2efe5b5a Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Thu, 14 May 2015 15:54:51 +0300 Subject: [PATCH] Keyword completion: "reified" keyword is now supported --- .../idea/completion/KeywordCompletion.kt | 30 +++++++++---------- .../testData/keywords/AfterClassProperty.kt | 4 ++- .../testData/keywords/AfterClasses.kt | 4 ++- .../testData/keywords/AfterFuns.kt | 4 ++- .../keywords/GlobalPropertyAccessors.kt | 4 ++- .../testData/keywords/InClassBeforeFun.kt | 4 ++- .../testData/keywords/InClassScope.kt | 4 ++- .../keywords/InTopScopeAfterPackage.kt | 4 ++- .../testData/keywords/PropertyAccessors.kt | 4 ++- .../testData/keywords/PropertyAccessors2.kt | 4 ++- .../testData/keywords/PropertySetter.kt | 4 ++- .../testData/keywords/TopScope.kt | 4 ++- 12 files changed, 47 insertions(+), 27 deletions(-) diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KeywordCompletion.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KeywordCompletion.kt index 7ab8a3bf6f4..da7c21cb7cf 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KeywordCompletion.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KeywordCompletion.kt @@ -16,30 +16,28 @@ package org.jetbrains.kotlin.idea.completion +import com.intellij.codeInsight.lookup.LookupElement +import com.intellij.codeInsight.lookup.LookupElementBuilder +import com.intellij.openapi.project.Project +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiErrorElement import com.intellij.psi.filters.* import com.intellij.psi.filters.position.LeftNeighbour -import org.jetbrains.kotlin.psi.* -import com.intellij.psi.PsiElement import com.intellij.psi.filters.position.PositionElementFilter -import org.jetbrains.kotlin.idea.completion.handlers.KotlinFunctionInsertHandler -import com.intellij.codeInsight.lookup.LookupElementBuilder -import com.intellij.psi.PsiErrorElement -import org.jetbrains.kotlin.lexer.JetKeywordToken -import com.intellij.openapi.project.Project -import org.jetbrains.kotlin.idea.completion.handlers.KotlinKeywordInsertHandler -import org.jetbrains.kotlin.psi.psiUtil.siblings - -import org.jetbrains.kotlin.lexer.JetTokens.* -import org.jetbrains.kotlin.psi.psiUtil.prevLeafSkipWhitespacesAndComments -import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType import com.intellij.psi.tree.IElementType -import com.intellij.codeInsight.lookup.LookupElement +import org.jetbrains.kotlin.idea.completion.handlers.KotlinFunctionInsertHandler +import org.jetbrains.kotlin.idea.completion.handlers.KotlinKeywordInsertHandler +import org.jetbrains.kotlin.lexer.JetKeywordToken +import org.jetbrains.kotlin.lexer.JetTokens.* +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType +import org.jetbrains.kotlin.psi.psiUtil.prevLeafSkipWhitespacesAndComments +import org.jetbrains.kotlin.psi.psiUtil.siblings object KeywordLookupObject object KeywordCompletion { - private val NON_ACTUAL_KEYWORDS = setOf(REIFIED_KEYWORD, - CAPITALIZED_THIS_KEYWORD, + private val NON_ACTUAL_KEYWORDS = setOf(CAPITALIZED_THIS_KEYWORD, TYPE_ALIAS_KEYWORD, TRAIT_KEYWORD) private val ALL_KEYWORDS = (KEYWORDS.getTypes() + SOFT_KEYWORDS.getTypes()) diff --git a/idea/idea-completion/testData/keywords/AfterClassProperty.kt b/idea/idea-completion/testData/keywords/AfterClassProperty.kt index d68173bfc94..18a204365e7 100644 --- a/idea/idea-completion/testData/keywords/AfterClassProperty.kt +++ b/idea/idea-completion/testData/keywords/AfterClassProperty.kt @@ -20,6 +20,8 @@ class MouseMovedEventArgs // EXIST: open // EXIST: out /*why?*/ +// EXIST: reified +/*why?*/ // EXIST: override // EXIST: private // EXIST: protected @@ -32,4 +34,4 @@ class MouseMovedEventArgs // EXIST: constructor // EXIST: init /*why?*/ -// NUMBER: 26 +// NUMBER: 27 diff --git a/idea/idea-completion/testData/keywords/AfterClasses.kt b/idea/idea-completion/testData/keywords/AfterClasses.kt index f0bcc0df2ea..12b69e436dd 100644 --- a/idea/idea-completion/testData/keywords/AfterClasses.kt +++ b/idea/idea-completion/testData/keywords/AfterClasses.kt @@ -26,6 +26,8 @@ class B { // EXIST: open // EXIST: out /*why?*/ +// EXIST: reified +/*why?*/ // EXIST: override // EXIST: private // EXIST: protected @@ -35,4 +37,4 @@ class B { // EXIST: var // EXIST: vararg /*why?*/ -// NUMBER: 21 +// NUMBER: 22 diff --git a/idea/idea-completion/testData/keywords/AfterFuns.kt b/idea/idea-completion/testData/keywords/AfterFuns.kt index 9d1f7ba667b..dbb8e1ce541 100644 --- a/idea/idea-completion/testData/keywords/AfterFuns.kt +++ b/idea/idea-completion/testData/keywords/AfterFuns.kt @@ -24,6 +24,8 @@ class A { // EXIST: open // EXIST: out /*why?*/ +// EXIST: reified +/*why?*/ // EXIST: override // EXIST: private // EXIST: protected @@ -35,4 +37,4 @@ class A { // EXIST: constructor // EXIST: init /*why?*/ -// NUMBER: 23 +// NUMBER: 24 diff --git a/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt b/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt index b78b93f3af0..b93eced11c8 100644 --- a/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt +++ b/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt @@ -25,6 +25,8 @@ var a : Int // EXIST: open // EXIST: out /*why?*/ +// EXIST: reified +/*why?*/ // EXIST: override // EXIST: private // EXIST: protected @@ -35,4 +37,4 @@ var a : Int // EXIST: var // EXIST: vararg /*why?*/ -// NUMBER: 24 +// NUMBER: 25 diff --git a/idea/idea-completion/testData/keywords/InClassBeforeFun.kt b/idea/idea-completion/testData/keywords/InClassBeforeFun.kt index da74fb17f8c..1256fc49ba6 100644 --- a/idea/idea-completion/testData/keywords/InClassBeforeFun.kt +++ b/idea/idea-completion/testData/keywords/InClassBeforeFun.kt @@ -22,6 +22,8 @@ public class Test { // EXIST: open // EXIST: out /*why?*/ +// EXIST: reified +/*why?*/ // EXIST: override // EXIST: private // EXIST: protected @@ -33,4 +35,4 @@ public class Test { // EXIST: constructor // EXIST: init /*why?*/ -// NUMBER: 23 +// NUMBER: 24 diff --git a/idea/idea-completion/testData/keywords/InClassScope.kt b/idea/idea-completion/testData/keywords/InClassScope.kt index 3f04fae7f85..dbeccfb9888 100644 --- a/idea/idea-completion/testData/keywords/InClassScope.kt +++ b/idea/idea-completion/testData/keywords/InClassScope.kt @@ -16,6 +16,8 @@ class TestClass { // EXIST: open // EXIST: out /*why?*/ +// EXIST: reified +/*why?*/ // EXIST: override // EXIST: private // EXIST: protected @@ -27,4 +29,4 @@ class TestClass { /*why?*/ // EXIST: constructor // EXIST: init -// NUMBER: 23 +// NUMBER: 24 diff --git a/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt b/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt index 626ba8e340d..ddddb47234d 100644 --- a/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt +++ b/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt @@ -17,6 +17,8 @@ package Test // EXIST: open // EXIST: out /*why?*/ +// EXIST: reified +/*why?*/ // EXIST: override // EXIST: private // EXIST: protected @@ -26,4 +28,4 @@ package Test // EXIST: var // EXIST: vararg /*why?*/ -// NUMBER: 22 +// NUMBER: 23 diff --git a/idea/idea-completion/testData/keywords/PropertyAccessors.kt b/idea/idea-completion/testData/keywords/PropertyAccessors.kt index 1a5fd10e14f..13b6ea01dca 100644 --- a/idea/idea-completion/testData/keywords/PropertyAccessors.kt +++ b/idea/idea-completion/testData/keywords/PropertyAccessors.kt @@ -19,6 +19,8 @@ class Some { // EXIST: open // EXIST: out /*why?*/ +// EXIST: reified +/*why?*/ // EXIST: override // EXIST: private // EXIST: protected @@ -31,4 +33,4 @@ class Some { /*why?*/ // EXIST: constructor // EXIST: init -// NUMBER: 26 +// NUMBER: 27 diff --git a/idea/idea-completion/testData/keywords/PropertyAccessors2.kt b/idea/idea-completion/testData/keywords/PropertyAccessors2.kt index a59fc204e7b..6fa56ddfc84 100644 --- a/idea/idea-completion/testData/keywords/PropertyAccessors2.kt +++ b/idea/idea-completion/testData/keywords/PropertyAccessors2.kt @@ -19,6 +19,8 @@ class Some { // EXIST: open // EXIST: out /*why?*/ +// EXIST: reified +/*why?*/ // EXIST: override // EXIST: private // EXIST: protected @@ -31,4 +33,4 @@ class Some { /*why?*/ // EXIST: constructor // EXIST: init -// NUMBER: 26 +// NUMBER: 27 diff --git a/idea/idea-completion/testData/keywords/PropertySetter.kt b/idea/idea-completion/testData/keywords/PropertySetter.kt index 26cfa1eac80..31e9f05e465 100644 --- a/idea/idea-completion/testData/keywords/PropertySetter.kt +++ b/idea/idea-completion/testData/keywords/PropertySetter.kt @@ -21,6 +21,8 @@ class Some { // EXIST: open // EXIST: out /*why?*/ +// EXIST: reified +/*why?*/ // EXIST: override // EXIST: private // EXIST: protected @@ -33,4 +35,4 @@ class Some { /*why?*/ // EXIST: constructor // EXIST: init -// NUMBER: 26 +// NUMBER: 27 diff --git a/idea/idea-completion/testData/keywords/TopScope.kt b/idea/idea-completion/testData/keywords/TopScope.kt index d7650ab8e26..c13169196d0 100644 --- a/idea/idea-completion/testData/keywords/TopScope.kt +++ b/idea/idea-completion/testData/keywords/TopScope.kt @@ -15,6 +15,8 @@ // EXIST: open // EXIST: out /*why?*/ +// EXIST: reified +/*why?*/ // EXIST: override // EXIST: package // EXIST: private @@ -25,4 +27,4 @@ // EXIST: var // EXIST: vararg /*why?*/ -// NUMBER: 23 +// NUMBER: 24