Why PrefixMatcher cannot be triggered only by kotlin completions?


Hi all,

Recently discovered that code does not work correctly when users write in kotlin.All other languages execute normally, except when writing kotlin code.

class ChineseCompletionContributor : CompletionContributor() {

override fun fillCompletionVariants(parameters: CompletionParameters, result: CompletionResultSet) {
val prefix = result.prefixMatcher.prefix.toLowerCase()
val resultSet = result
resultSet.runRemainingContributors(parameters, { r ->
// No access here.
}, false)

class ChinesePrefixMatcher(prefix: String) : PlainPrefixMatcher(prefix) {
override fun prefixMatches(name: String): Boolean {
return if (Pinyin.hasChinese(name)) {
for (s in toPinyin(name, Pinyin.LOW_CASE)) {
if (countContainsSomeChar(s, prefix) >= prefix.length) {
return true
return false
} else super.prefixMatches(name)

override fun cloneWithPrefix(prefix: String) = if (prefix == this.prefix) this else ChinesePrefixMatcher(prefix)

ChinesePrefixMatcher working properly,but it doesn't have the value I want to pass to it.The values here are non-ascil.

This is my plugin.xml,and I tried changing the order attribute to either "first" or "last" without triggering correctly.

<extensions defaultExtensionNs="com.intellij">
<completion.contributor language="any"


1 comment
Comment actions Permalink

There might be other CompletionContributors which register themselves as "first" and maybe change the result/ordering of all triggered EPs.


Please sign in to leave a comment.