Smart completion: fixed items ordering issue

This commit is contained in:
Valentin Kipyatkov
2014-10-28 20:20:33 +03:00
parent caf44969a4
commit 2b33501471
52 changed files with 103 additions and 88 deletions
@@ -41,8 +41,7 @@ class StaticMembers(val bindingContext: BindingContext, val resolveSession: Reso
context: JetExpression,
enumEntriesToSkip: Set<DeclarationDescriptor>) {
val scope = bindingContext[BindingContext.RESOLUTION_SCOPE, context]
if (scope == null) return
val scope = bindingContext[BindingContext.RESOLUTION_SCOPE, context] ?: return
val expectedInfosByClass = expectedInfos.groupBy { TypeUtils.getClassDescriptor(it.type) }
for ((classDescriptor, expectedInfosForClass) in expectedInfosByClass) {
@@ -64,8 +63,7 @@ class StaticMembers(val bindingContext: BindingContext, val resolveSession: Reso
val classifier: (ExpectedInfo) -> ExpectedInfoClassification
if (descriptor is CallableDescriptor) {
val returnType = descriptor.getReturnType()
if (returnType == null) return
val returnType = descriptor.getReturnType() ?: return
classifier = {
expectedInfo ->
when {
@@ -109,12 +107,9 @@ class StaticMembers(val bindingContext: BindingContext, val resolveSession: Reso
private fun createLookupElement(memberDescriptor: DeclarationDescriptor, classDescriptor: ClassDescriptor): LookupElement {
val lookupElement = createLookupElement(memberDescriptor, resolveSession, bindingContext)
val qualifierPresentation = classDescriptor.getName().asString()
val lookupString = qualifierPresentation + "." + lookupElement.getLookupString()
val qualifierText = qualifiedNameForSourceCode(classDescriptor)
return object: LookupElementDecorator<LookupElement>(lookupElement) {
override fun getLookupString() = lookupString
override fun renderElement(presentation: LookupElementPresentation) {
getDelegate().renderElement(presentation)