Partial code cleanup: can be private and some others applied
This commit is contained in:
@@ -290,15 +290,13 @@ object KeywordCompletion {
|
||||
return buildFilterWithReducedContext("", null, position)
|
||||
}
|
||||
|
||||
fun computeKeywordApplications(prefixText: String, keyword: KtKeywordToken): Sequence<String> {
|
||||
return when (keyword) {
|
||||
SUSPEND_KEYWORD -> sequenceOf("suspend () -> Unit>", "suspend X")
|
||||
else -> {
|
||||
if (prefixText.endsWith("@"))
|
||||
sequenceOf(keyword.value + ":X Y.Z")
|
||||
else
|
||||
sequenceOf(keyword.value + " X")
|
||||
}
|
||||
private fun computeKeywordApplications(prefixText: String, keyword: KtKeywordToken): Sequence<String> = when (keyword) {
|
||||
SUSPEND_KEYWORD -> sequenceOf("suspend () -> Unit>", "suspend X")
|
||||
else -> {
|
||||
if (prefixText.endsWith("@"))
|
||||
sequenceOf(keyword.value + ":X Y.Z")
|
||||
else
|
||||
sequenceOf(keyword.value + " X")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.util.OperatorNameConventions.SET
|
||||
|
||||
object OperatorNameCompletion {
|
||||
|
||||
val additionalOperatorPresentation = mapOf(
|
||||
private val additionalOperatorPresentation = mapOf(
|
||||
SET to "[...] = ...",
|
||||
GET to "[...]",
|
||||
CONTAINS to "in !in",
|
||||
|
||||
+2
-2
@@ -153,7 +153,7 @@ class ReferenceVariantsCollector(
|
||||
return ReferenceVariants(filterConfiguration.filterVariants(basicVariants).toHashSet(), emptyList())
|
||||
}
|
||||
|
||||
fun doCollectExtensionVariants(filterConfiguration: FilterConfiguration, basicVariants: ReferenceVariants): ReferenceVariants {
|
||||
private fun doCollectExtensionVariants(filterConfiguration: FilterConfiguration, basicVariants: ReferenceVariants): ReferenceVariants {
|
||||
val (_, additionalPropertyNameFilter, shadowedDeclarationsFilter, completeExtensionsFromIndices) = filterConfiguration
|
||||
|
||||
if (completeExtensionsFromIndices) {
|
||||
@@ -184,7 +184,7 @@ class ReferenceVariantsCollector(
|
||||
return ReferenceVariants(emptyList(), emptyList())
|
||||
}
|
||||
|
||||
fun <TDescriptor : DeclarationDescriptor> FilterConfiguration.filterVariants(_variants: Collection<TDescriptor>): Collection<TDescriptor> {
|
||||
private fun <TDescriptor : DeclarationDescriptor> FilterConfiguration.filterVariants(_variants: Collection<TDescriptor>): Collection<TDescriptor> {
|
||||
var variants = _variants
|
||||
|
||||
if (shadowedDeclarationsFilter != null)
|
||||
|
||||
+8
-12
@@ -56,20 +56,16 @@ class ToFromOriginalFileMapper private constructor(
|
||||
shift = syntheticLength - originalLength
|
||||
}
|
||||
|
||||
fun toOriginalFile(offset: Int): Int? {
|
||||
return when {
|
||||
offset <= completionOffset -> offset
|
||||
offset >= syntheticLength - tailLength -> offset - shift
|
||||
else -> null
|
||||
}
|
||||
private fun toOriginalFile(offset: Int): Int? = when {
|
||||
offset <= completionOffset -> offset
|
||||
offset >= syntheticLength - tailLength -> offset - shift
|
||||
else -> null
|
||||
}
|
||||
|
||||
fun toSyntheticFile(offset: Int): Int? {
|
||||
return when {
|
||||
offset <= completionOffset -> offset
|
||||
offset >= originalLength - tailLength -> offset + shift
|
||||
else -> null
|
||||
}
|
||||
private fun toSyntheticFile(offset: Int): Int? = when {
|
||||
offset <= completionOffset -> offset
|
||||
offset >= originalLength - tailLength -> offset + shift
|
||||
else -> null
|
||||
}
|
||||
|
||||
fun <TElement : PsiElement> toOriginalFile(element: TElement): TElement? {
|
||||
|
||||
@@ -45,7 +45,10 @@ import org.jetbrains.kotlin.util.descriptorsEqualWithSubstitution
|
||||
import java.util.*
|
||||
|
||||
class ArtificialElementInsertHandler(
|
||||
val textBeforeCaret: String, val textAfterCaret: String, val shortenRefs: Boolean) : InsertHandler<LookupElement>{
|
||||
private val textBeforeCaret: String,
|
||||
private val textAfterCaret: String,
|
||||
private val shortenRefs: Boolean
|
||||
) : InsertHandler<LookupElement>{
|
||||
override fun handleInsert(context: InsertionContext, item: LookupElement) {
|
||||
val offset = context.editor.caretModel.offset
|
||||
val startOffset = offset - item.lookupString.length
|
||||
|
||||
Reference in New Issue
Block a user