From 6fc8a16dd5848262a0477a15569f61ac3d4a2e9b Mon Sep 17 00:00:00 2001 From: Natalia Ukhorskaya Date: Wed, 7 Oct 2015 13:25:15 +0300 Subject: [PATCH] Completion for codeFragments: do not show java getters/setters at first completion --- .../kotlin/idea/completion/CompletionSession.kt | 9 +++++++-- .../codeFragments/noDuplicatesForSyntheticProperties.kt | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/CompletionSession.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/CompletionSession.kt index 38dc529749a..19b7fd42f23 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/CompletionSession.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/CompletionSession.kt @@ -263,8 +263,13 @@ abstract class CompletionSession(protected val configuration: CompletionSessionC } protected fun getRuntimeReceiverTypeReferenceVariants(): Collection { - val restrictedKindFilter = descriptorKindFilter!!.restrictedToKinds(DescriptorKindFilter.FUNCTIONS_MASK or DescriptorKindFilter.VARIABLES_MASK) // optimization - val descriptors = referenceVariantsHelper.getReferenceVariants(nameExpression!!, restrictedKindFilter, descriptorNameFilter, useRuntimeReceiverType = true) + val descriptors = referenceVariantsHelper.getReferenceVariants( + nameExpression!!, + descriptorKindFilter!!, + descriptorNameFilter, + useRuntimeReceiverType = true, + filterOutJavaGettersAndSetters = configuration.filterOutJavaGettersAndSetters + ).excludeNonInitializedVariable(nameExpression) return descriptors.filter { descriptor -> referenceVariants.none { compareDescriptors(project, it, descriptor) } } diff --git a/idea/idea-completion/testData/basic/codeFragments/noDuplicatesForSyntheticProperties.kt b/idea/idea-completion/testData/basic/codeFragments/noDuplicatesForSyntheticProperties.kt index e72bc189d64..aab51c41687 100644 --- a/idea/idea-completion/testData/basic/codeFragments/noDuplicatesForSyntheticProperties.kt +++ b/idea/idea-completion/testData/basic/codeFragments/noDuplicatesForSyntheticProperties.kt @@ -7,7 +7,7 @@ fun main(args: Array) { class MyFile: File("") -// EXIST: absoluteFile, getAbsoluteFile +// EXIST: absoluteFile // NOTHING_ELSE // RUNTIME_TYPE: MyFile \ No newline at end of file