IntelliJ plugin development Kotlin auto-complete

I have tried using my own weigher and that did not work. I am using the priority and proximity and I am not able to make my completions the highest likely match. It works great in Java and Python. But, Kotlin is giving me issues. I always end up at the top or bottom and the highest likely match is in the middle.

Any help would be appreciated! Thanks!

lookupElement = PrioritizedLookupElement.withGrouping(lookupElement, 79);
lookupElement = PrioritizedLookupElement.withPriority(lookupElement, 1000);
lookupElement = PrioritizedLookupElement.withExplicitProximity(lookupElement, 1);

result.addElement(lookupElement);

Probably, you wrote val, instead of var. The difference is here.

If you want to update your variable multiple times, I can advice the following options:

var lookupElement = ...

lookupElement = PrioritizedLookupElement.withGrouping(lookupElement, 79);
lookupElement = PrioritizedLookupElement.withPriority(lookupElement, 1000);
lookupElement = PrioritizedLookupElement.withExplicitProximity(lookupElement, 1);

result.addElement(lookupElement);

or

var lookupElement = ...

val updatedElement = lookupElement.let {
    PrioritizedLookupElement.withGrouping(it, 79);
}.let {
    PrioritizedLookupElement.withPriority(it, 1000);
}.let {
    PrioritizedLookupElement.withExplicitProximity(it, 1);
}

result.addElement(updatedElement);

Both options generates the same bytecode (with minor differences, however calling sequence and functions calls are the same)