Class renames
This commit is contained in:
@@ -247,7 +247,7 @@
|
||||
<completion.contributor language="jet"
|
||||
id="JetCompletionContributor"
|
||||
order="first"
|
||||
implementationClass="org.jetbrains.jet.plugin.completion.JetCompletionContributor"/>
|
||||
implementationClass="org.jetbrains.jet.plugin.completion.KotlinCompletionContributor"/>
|
||||
|
||||
<completion.contributor language="jet"
|
||||
id="JetLiveTemplateCompletionContributor"
|
||||
@@ -262,7 +262,7 @@
|
||||
<completion.skip implementation="org.jetbrains.jet.plugin.liveTemplates.JetLiveTemplateCompletionContributor$Skipper"
|
||||
id="skipLiveTemplate"/>
|
||||
|
||||
<lookup.charFilter implementation="org.jetbrains.jet.plugin.completion.JetCompletionCharFilter"/>
|
||||
<lookup.charFilter implementation="org.jetbrains.jet.plugin.completion.KotlinCompletionCharFilter"/>
|
||||
|
||||
<psi.referenceContributor language="jet" implementation="org.jetbrains.jet.plugin.references.JetReferenceContributor"/>
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.intellij.util.containers.MultiMap
|
||||
import java.util.HashSet
|
||||
import com.intellij.codeInsight.completion.*
|
||||
import org.jetbrains.jet.plugin.completion.handlers.JetFunctionInsertHandler
|
||||
import org.jetbrains.jet.plugin.completion.handlers.JetKeywordInsertHandler
|
||||
import org.jetbrains.jet.plugin.completion.handlers.KotlinKeywordInsertHandler
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
||||
import java.util.ArrayList
|
||||
|
||||
@@ -50,7 +50,7 @@ class KeywordCompletion {
|
||||
val element = LookupElementBuilder.create(KeywordLookupObject(keyword), keyword)
|
||||
.bold()
|
||||
.withInsertHandler(if (keyword !in FUNCTION_KEYWORDS)
|
||||
JetKeywordInsertHandler
|
||||
KotlinKeywordInsertHandler
|
||||
else
|
||||
JetFunctionInsertHandler.NO_PARAMETERS_HANDLER)
|
||||
collector.addElement(element)
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import org.jetbrains.jet.lang.psi.JetFile
|
||||
import org.jetbrains.jet.plugin.completion.handlers.JetFunctionInsertHandler
|
||||
import com.intellij.openapi.util.Key
|
||||
|
||||
public open class JetCompletionCharFilter() : CharFilter() {
|
||||
public class KotlinCompletionCharFilter() : CharFilter() {
|
||||
class object {
|
||||
public val ACCEPT_OPENING_BRACE: Key<Boolean> = Key<Boolean>("JetCompletionCharFilter.ACCEPT_OPENNING_BRACE")
|
||||
public val ACCEPT_EQ: Key<Boolean> = Key<Boolean>("JetCompletionCharFilter.ACCEPT_EQ")
|
||||
+1
-1
@@ -44,7 +44,7 @@ import com.intellij.psi.PsiErrorElement
|
||||
import com.intellij.psi.search.PsiElementProcessor
|
||||
import com.intellij.psi.PsiComment
|
||||
|
||||
public class JetCompletionContributor : CompletionContributor() {
|
||||
public class KotlinCompletionContributor : CompletionContributor() {
|
||||
|
||||
private val AFTER_NUMBER_LITERAL = psiElement().afterLeafSkipping(psiElement().withText(""), psiElement().withElementType(elementType().oneOf(JetTokens.FLOAT_LITERAL, JetTokens.INTEGER_LITERAL)))
|
||||
private val AFTER_INTEGER_LITERAL_AND_DOT = psiElement().afterLeafSkipping(psiElement().withText("."), psiElement().withElementType(elementType().oneOf(JetTokens.INTEGER_LITERAL)))
|
||||
+6
-6
@@ -29,7 +29,7 @@ import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns
|
||||
import org.jetbrains.jet.plugin.JetDescriptorIconProvider
|
||||
import org.jetbrains.jet.plugin.completion.handlers.CaretPosition
|
||||
import org.jetbrains.jet.plugin.completion.handlers.GenerateLambdaInfo
|
||||
import org.jetbrains.jet.plugin.completion.handlers.JetClassInsertHandler
|
||||
import org.jetbrains.jet.plugin.completion.handlers.KotlinClassInsertHandler
|
||||
import org.jetbrains.jet.plugin.completion.handlers.JetFunctionInsertHandler
|
||||
import org.jetbrains.jet.renderer.DescriptorRenderer
|
||||
import org.jetbrains.jet.plugin.completion.handlers.BaseDeclarationInsertHandler
|
||||
@@ -37,10 +37,10 @@ import org.jetbrains.jet.plugin.completion.handlers.JetPropertyInsertHandler
|
||||
import com.intellij.psi.PsiClass
|
||||
import org.jetbrains.jet.asJava.KotlinLightClass
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaResolverPsiUtils
|
||||
import org.jetbrains.jet.plugin.completion.handlers.JetJavaClassInsertHandler
|
||||
import org.jetbrains.jet.plugin.completion.handlers.KotlinJavaClassInsertHandler
|
||||
import com.intellij.codeInsight.completion.JavaPsiClassReferenceElement
|
||||
|
||||
public object DescriptorLookupConverter {
|
||||
public object KotlinLookupElementFactory {
|
||||
public fun createLookupElement(analyzer: KotlinCodeAnalyzer, descriptor: DeclarationDescriptor): LookupElement {
|
||||
val _descriptor = if (descriptor is CallableMemberDescriptor)
|
||||
DescriptorUtils.unwrapFakeOverride(descriptor)
|
||||
@@ -50,7 +50,7 @@ public object DescriptorLookupConverter {
|
||||
}
|
||||
|
||||
public fun createLookupElementForJavaClass(psiClass: PsiClass): LookupElement {
|
||||
return JavaPsiClassReferenceElement(psiClass).setInsertHandler(JetJavaClassInsertHandler)
|
||||
return JavaPsiClassReferenceElement(psiClass).setInsertHandler(KotlinJavaClassInsertHandler)
|
||||
}
|
||||
|
||||
private fun createLookupElement(analyzer: KotlinCodeAnalyzer, descriptor: DeclarationDescriptor, declaration: PsiElement?): LookupElement {
|
||||
@@ -95,7 +95,7 @@ public object DescriptorLookupConverter {
|
||||
element = element.withInsertHandler(insertHandler)
|
||||
|
||||
if (insertHandler is JetFunctionInsertHandler && insertHandler.lambdaInfo != null) {
|
||||
element.putUserData<Boolean>(JetCompletionCharFilter.ACCEPT_OPENING_BRACE, true)
|
||||
element.putUserData<Boolean>(KotlinCompletionCharFilter.ACCEPT_OPENING_BRACE, true)
|
||||
}
|
||||
|
||||
element = element.withTailText(tailText, true).withTypeText(typeText).withPresentableText(presentableText)
|
||||
@@ -130,7 +130,7 @@ public object DescriptorLookupConverter {
|
||||
|
||||
is PropertyDescriptor -> JetPropertyInsertHandler
|
||||
|
||||
is ClassDescriptor -> JetClassInsertHandler
|
||||
is ClassDescriptor -> KotlinClassInsertHandler
|
||||
|
||||
else -> BaseDeclarationInsertHandler()
|
||||
}
|
||||
@@ -57,7 +57,7 @@ class LookupElementsCollector(private val prefixMatcher: PrefixMatcher,
|
||||
if (!descriptorFilter(descriptor)) return
|
||||
|
||||
run {
|
||||
val lookupElement = DescriptorLookupConverter.createLookupElement(resolveSession, descriptor)
|
||||
val lookupElement = KotlinLookupElementFactory.createLookupElement(resolveSession, descriptor)
|
||||
if (suppressAutoInsertion) {
|
||||
addElementWithAutoInsertionSuppressed(lookupElement)
|
||||
}
|
||||
@@ -74,7 +74,7 @@ class LookupElementsCollector(private val prefixMatcher: PrefixMatcher,
|
||||
if (KotlinBuiltIns.getInstance().isFunctionOrExtensionFunctionType(parameterType)) {
|
||||
val parameterCount = KotlinBuiltIns.getInstance().getParameterTypeProjectionsFromFunctionType(parameterType).size()
|
||||
if (parameterCount > 1) {
|
||||
val lookupElement = DescriptorLookupConverter.createLookupElement(resolveSession, descriptor)
|
||||
val lookupElement = KotlinLookupElementFactory.createLookupElement(resolveSession, descriptor)
|
||||
addElement(object : LookupElementDecorator<LookupElement>(lookupElement) {
|
||||
override fun renderElement(presentation: LookupElementPresentation) {
|
||||
super.renderElement(presentation)
|
||||
|
||||
@@ -94,7 +94,7 @@ object NamedParametersCompletion {
|
||||
.withIcon(JetIcons.PARAMETER)
|
||||
.withInsertHandler(NamedParameterInsertHandler(name))
|
||||
.assignPriority(ItemPriority.NAMED_PARAMETER)
|
||||
lookupElement.putUserData(JetCompletionCharFilter.ACCEPT_EQ, true);
|
||||
lookupElement.putUserData(KotlinCompletionCharFilter.ACCEPT_EQ, true);
|
||||
|
||||
collector.addElement(lookupElement)
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ object PackageDirectiveCompletion {
|
||||
|
||||
val variants = TipsManager.getPackageReferenceVariants(ref.expression, bindingContext)
|
||||
for (variant in variants) {
|
||||
val lookupElement = DescriptorLookupConverter.createLookupElement(resolveSession, variant)
|
||||
val lookupElement = KotlinLookupElementFactory.createLookupElement(resolveSession, variant)
|
||||
if (!lookupElement.getLookupString().contains(DUMMY_IDENTIFIER)) {
|
||||
result.addElement(lookupElement)
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class TypesCompletion(val parameters: CompletionParameters, val resolveSession:
|
||||
addLookupElementForCompiledKotlinClass(psiClass, collector)
|
||||
}
|
||||
else {
|
||||
collector.addElementWithAutoInsertionSuppressed(DescriptorLookupConverter.createLookupElementForJavaClass(psiClass))
|
||||
collector.addElementWithAutoInsertionSuppressed(KotlinLookupElementFactory.createLookupElementForJavaClass(psiClass))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import org.jetbrains.jet.plugin.completion.DeclarationLookupObject
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor
|
||||
import org.jetbrains.jet.plugin.completion.qualifiedNameForSourceCode
|
||||
|
||||
public object JetClassInsertHandler : BaseDeclarationInsertHandler() {
|
||||
public object KotlinClassInsertHandler : BaseDeclarationInsertHandler() {
|
||||
override fun handleInsert(context: InsertionContext, item: LookupElement) {
|
||||
super.handleInsert(context, item)
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ import org.jetbrains.jet.plugin.quickfix.ImportInsertHelper
|
||||
* Handler for inserting java class completion.
|
||||
* - Should place import directive if necessary.
|
||||
*/
|
||||
object JetJavaClassInsertHandler : InsertHandler<JavaPsiClassReferenceElement> {
|
||||
object KotlinJavaClassInsertHandler : InsertHandler<JavaPsiClassReferenceElement> {
|
||||
override fun handleInsert(context: InsertionContext, item: JavaPsiClassReferenceElement) {
|
||||
PsiDocumentManager.getInstance(context.getProject()).commitAllDocuments()
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import org.jetbrains.jet.lang.psi.JetFunction
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil
|
||||
import org.jetbrains.jet.lexer.JetTokens
|
||||
|
||||
public object JetKeywordInsertHandler : InsertHandler<LookupElement> {
|
||||
public object KotlinKeywordInsertHandler : InsertHandler<LookupElement> {
|
||||
private val NO_SPACE_AFTER = setOf(JetTokens.THIS_KEYWORD.toString(),
|
||||
JetTokens.SUPER_KEYWORD.toString(),
|
||||
JetTokens.CAPITALIZED_THIS_KEYWORD.toString(),
|
||||
@@ -21,7 +21,7 @@ import com.intellij.codeInsight.lookup.LookupElementBuilder
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns
|
||||
import org.jetbrains.jet.plugin.completion.handlers.insertLambdaTemplate
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import org.jetbrains.jet.plugin.completion.JetCompletionCharFilter
|
||||
import org.jetbrains.jet.plugin.completion.KotlinCompletionCharFilter
|
||||
import org.jetbrains.jet.plugin.completion.ExpectedInfo
|
||||
import org.jetbrains.jet.plugin.completion.handlers.buildLambdaPresentation
|
||||
import org.jetbrains.jet.plugin.completion.suppressAutoInsertion
|
||||
@@ -38,7 +38,7 @@ object LambdaItems {
|
||||
.withInsertHandler(ArtificialElementInsertHandler("{ ", " }", false))
|
||||
.suppressAutoInsertion()
|
||||
.addTailAndNameSimilarity(functionExpectedInfos)
|
||||
lookupElement.putUserData(JetCompletionCharFilter.ACCEPT_OPENING_BRACE, true)
|
||||
lookupElement.putUserData(KotlinCompletionCharFilter.ACCEPT_OPENING_BRACE, true)
|
||||
collection.add(lookupElement)
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ object LambdaItems {
|
||||
})
|
||||
.suppressAutoInsertion()
|
||||
.addTailAndNameSimilarity(functionExpectedInfos.filter { it.type == functionType })
|
||||
lookupElement.putUserData(JetCompletionCharFilter.ACCEPT_OPENING_BRACE, true)
|
||||
lookupElement.putUserData(KotlinCompletionCharFilter.ACCEPT_OPENING_BRACE, true)
|
||||
collection.add(lookupElement)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ class TypeInstantiationItems(val resolveSession: ResolveSessionForBodies, val vi
|
||||
(if (visibleConstructors.size == 0)
|
||||
JetFunctionInsertHandler.NO_PARAMETERS_HANDLER
|
||||
else if (visibleConstructors.size == 1)
|
||||
DescriptorLookupConverter.getDefaultInsertHandler(visibleConstructors.single())
|
||||
KotlinLookupElementFactory.getDefaultInsertHandler(visibleConstructors.single())
|
||||
else
|
||||
JetFunctionInsertHandler.WITH_PARAMETERS_HANDLER) as JetFunctionInsertHandler
|
||||
insertHandler = object : InsertHandler<LookupElement> {
|
||||
@@ -113,7 +113,7 @@ class TypeInstantiationItems(val resolveSession: ResolveSessionForBodies, val vi
|
||||
lookupElement = lookupElement.keepOldArgumentListOnTab()
|
||||
}
|
||||
if (baseInsertHandler.lambdaInfo != null) {
|
||||
lookupElement.putUserData(JetCompletionCharFilter.ACCEPT_OPENING_BRACE, true)
|
||||
lookupElement.putUserData(KotlinCompletionCharFilter.ACCEPT_OPENING_BRACE, true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ fun functionType(function: FunctionDescriptor): JetType? {
|
||||
}
|
||||
|
||||
fun createLookupElement(descriptor: DeclarationDescriptor, resolveSession: ResolveSessionForBodies): LookupElement {
|
||||
val element = DescriptorLookupConverter.createLookupElement(resolveSession, descriptor)
|
||||
val element = KotlinLookupElementFactory.createLookupElement(resolveSession, descriptor)
|
||||
return if (descriptor is FunctionDescriptor && descriptor.getValueParameters().isNotEmpty()) element.keepOldArgumentListOnTab() else element
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user