diff --git a/idea/src/org/jetbrains/jet/plugin/completion/KeywordCompletion.kt b/idea/src/org/jetbrains/jet/plugin/completion/KeywordCompletion.kt index 9c135c50924..02dd563b584 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/KeywordCompletion.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/KeywordCompletion.kt @@ -22,7 +22,7 @@ import org.jetbrains.jet.lang.psi.* import com.intellij.psi.PsiElement import com.intellij.psi.filters.position.PositionElementFilter import com.intellij.codeInsight.completion.* -import org.jetbrains.jet.plugin.completion.handlers.JetFunctionInsertHandler +import org.jetbrains.jet.plugin.completion.handlers.KotlinFunctionInsertHandler import com.intellij.codeInsight.lookup.LookupElementBuilder import com.intellij.psi.PsiErrorElement import org.jetbrains.jet.lexer.JetKeywordToken @@ -60,7 +60,7 @@ object KeywordCompletion { .withInsertHandler(if (keywordToken !in FUNCTION_KEYWORDS) KotlinKeywordInsertHandler else - JetFunctionInsertHandler.NO_PARAMETERS_HANDLER) + KotlinFunctionInsertHandler.NO_PARAMETERS_HANDLER) collector.addElement(element) } } diff --git a/idea/src/org/jetbrains/jet/plugin/completion/KotlinLookupElementFactory.kt b/idea/src/org/jetbrains/jet/plugin/completion/KotlinLookupElementFactory.kt index 635c331d472..017d40e183f 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/KotlinLookupElementFactory.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/KotlinLookupElementFactory.kt @@ -92,7 +92,7 @@ public object KotlinLookupElementFactory { element = element.withIcon(JetDescriptorIconProvider.getIcon(descriptor, declaration, Iconable.ICON_FLAG_VISIBILITY)) element = element.withStrikeoutness(KotlinBuiltIns.getInstance().isDeprecated(descriptor)) - if (insertHandler is JetFunctionInsertHandler && insertHandler.lambdaInfo != null) { + if (insertHandler is KotlinFunctionInsertHandler && insertHandler.lambdaInfo != null) { element.putUserData(KotlinCompletionCharFilter.ACCEPT_OPENING_BRACE, true) } @@ -104,7 +104,7 @@ public object KotlinLookupElementFactory { is FunctionDescriptor -> { val parameters = descriptor.getValueParameters() when (parameters.size) { - 0 -> JetFunctionInsertHandler.NO_PARAMETERS_HANDLER + 0 -> KotlinFunctionInsertHandler.NO_PARAMETERS_HANDLER 1 -> { val parameterType = parameters.single().getType() @@ -112,17 +112,17 @@ public object KotlinLookupElementFactory { val parameterCount = KotlinBuiltIns.getInstance().getParameterTypeProjectionsFromFunctionType(parameterType).size() if (parameterCount <= 1) { // otherwise additional item with lambda template is to be added - return JetFunctionInsertHandler(CaretPosition.IN_BRACKETS, GenerateLambdaInfo(parameterType, false)) + return KotlinFunctionInsertHandler(CaretPosition.IN_BRACKETS, GenerateLambdaInfo(parameterType, false)) } } - JetFunctionInsertHandler.WITH_PARAMETERS_HANDLER + KotlinFunctionInsertHandler.WITH_PARAMETERS_HANDLER } - else -> JetFunctionInsertHandler.WITH_PARAMETERS_HANDLER + else -> KotlinFunctionInsertHandler.WITH_PARAMETERS_HANDLER } } - is PropertyDescriptor -> JetPropertyInsertHandler + is PropertyDescriptor -> KotlinPropertyInsertHandler is ClassDescriptor -> KotlinClassInsertHandler diff --git a/idea/src/org/jetbrains/jet/plugin/completion/LookupElementsCollector.kt b/idea/src/org/jetbrains/jet/plugin/completion/LookupElementsCollector.kt index c15a6261066..e495430c5d3 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/LookupElementsCollector.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/LookupElementsCollector.kt @@ -79,7 +79,7 @@ class LookupElementsCollector(private val prefixMatcher: PrefixMatcher, private } override fun handleInsert(context: InsertionContext) { - JetFunctionInsertHandler(CaretPosition.IN_BRACKETS, GenerateLambdaInfo(parameterType, true)).handleInsert(context, this) + KotlinFunctionInsertHandler(CaretPosition.IN_BRACKETS, GenerateLambdaInfo(parameterType, true)).handleInsert(context, this) } }) } diff --git a/idea/src/org/jetbrains/jet/plugin/completion/handlers/KotlinCallableInsertHandler.kt b/idea/src/org/jetbrains/jet/plugin/completion/handlers/KotlinCallableInsertHandler.kt index d83ce8884fa..dbeeb8dea9e 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/handlers/KotlinCallableInsertHandler.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/handlers/KotlinCallableInsertHandler.kt @@ -39,7 +39,7 @@ import org.jetbrains.jet.lang.descriptors.CallableDescriptor import org.jetbrains.jet.lang.psi.JetBinaryExpression import org.jetbrains.jet.lang.psi.JetSimpleNameExpression -public abstract class JetCallableInsertHandler : BaseDeclarationInsertHandler() { +public abstract class KotlinCallableInsertHandler : BaseDeclarationInsertHandler() { public override fun handleInsert(context: InsertionContext, item: LookupElement) { super.handleInsert(context, item) @@ -76,7 +76,7 @@ public abstract class JetCallableInsertHandler : BaseDeclarationInsertHandler() } } -public object JetPropertyInsertHandler : JetCallableInsertHandler() +public object KotlinPropertyInsertHandler : KotlinCallableInsertHandler() public enum class CaretPosition { IN_BRACKETS @@ -85,7 +85,7 @@ public enum class CaretPosition { public data class GenerateLambdaInfo(val lambdaType: JetType, val explicitParameters: Boolean) -public class JetFunctionInsertHandler(val caretPosition : CaretPosition, val lambdaInfo: GenerateLambdaInfo?) : JetCallableInsertHandler() { +public class KotlinFunctionInsertHandler(val caretPosition : CaretPosition, val lambdaInfo: GenerateLambdaInfo?) : KotlinCallableInsertHandler() { { if (caretPosition == CaretPosition.AFTER_BRACKETS && lambdaInfo != null) { throw IllegalArgumentException("CaretPosition.AFTER_BRACKETS with lambdaInfo != null combination is not supported") @@ -190,8 +190,8 @@ public class JetFunctionInsertHandler(val caretPosition : CaretPosition, val lam } class object { - public val NO_PARAMETERS_HANDLER: JetFunctionInsertHandler = JetFunctionInsertHandler(CaretPosition.AFTER_BRACKETS, null) - public val WITH_PARAMETERS_HANDLER: JetFunctionInsertHandler = JetFunctionInsertHandler(CaretPosition.IN_BRACKETS, null) + public val NO_PARAMETERS_HANDLER: KotlinFunctionInsertHandler = KotlinFunctionInsertHandler(CaretPosition.AFTER_BRACKETS, null) + public val WITH_PARAMETERS_HANDLER: KotlinFunctionInsertHandler = KotlinFunctionInsertHandler(CaretPosition.IN_BRACKETS, null) private fun shouldAddBrackets(element : PsiElement) : Boolean { return PsiTreeUtil.getParentOfType(element, javaClass()) == null diff --git a/idea/src/org/jetbrains/jet/plugin/completion/smart/TypeInstantiationItems.kt b/idea/src/org/jetbrains/jet/plugin/completion/smart/TypeInstantiationItems.kt index 409591fc0f0..297a2d15d7c 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/smart/TypeInstantiationItems.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/smart/TypeInstantiationItems.kt @@ -29,7 +29,7 @@ import com.intellij.codeInsight.lookup.LookupElementDecorator import com.intellij.codeInsight.lookup.LookupElementPresentation import com.intellij.codeInsight.completion.InsertionContext import org.jetbrains.jet.plugin.project.ResolveSessionForBodies -import org.jetbrains.jet.plugin.completion.handlers.JetFunctionInsertHandler +import org.jetbrains.jet.plugin.completion.handlers.KotlinFunctionInsertHandler import org.jetbrains.jet.plugin.completion.* import org.jetbrains.jet.plugin.completion.handlers.CaretPosition import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor @@ -102,11 +102,11 @@ class TypeInstantiationItems(val resolveSession: ResolveSessionForBodies, val bi itemText += "()" val baseInsertHandler = (if (visibleConstructors.size == 0) - JetFunctionInsertHandler.NO_PARAMETERS_HANDLER + KotlinFunctionInsertHandler.NO_PARAMETERS_HANDLER else if (visibleConstructors.size == 1) KotlinLookupElementFactory.getDefaultInsertHandler(visibleConstructors.single()) else - JetFunctionInsertHandler.WITH_PARAMETERS_HANDLER) as JetFunctionInsertHandler + KotlinFunctionInsertHandler.WITH_PARAMETERS_HANDLER) as KotlinFunctionInsertHandler insertHandler = object : InsertHandler { override fun handleInsert(context: InsertionContext, item: LookupElement) { context.getDocument().replaceString(context.getStartOffset(), context.getTailOffset(), typeText)