ReplaceWith on function with lambda outside parentheses

I’m trying to add a ReplaceWith on a function that has the last argument outside of parentheses because it’s a lambda.

So I have this method

    message = "use extension function from kotlinx",
    replaceWith = ReplaceWith("observe(owner, observer)", "androidx.lifecycle.observe")
inline fun <T> LiveData<T>.observe(owner: LifecycleOwner, crossinline observer: (t: T?) -> Unit) {
    observe(owner, Observer {

Problem 1
It puts the lambda back into the parentheses, making me have to do another alt + enter. Also, it adds the type, which isn’t needed because it can be deduced.

import com.package.extensions.observe

foo.observe(this) {

After alt + enter:

import androidx.lifecycle.observe    
import com.package.extensions.observe

foo.observe<String?>(this, {

Problem 2: it now has both the old and new import, so the compiler doesn’t know which one to choose. This could be solved if the old import would be removed on alt + enter.

How can I solve these problems?

You should open a feature request.
In general replacing a function with another one with same name in another package might just not work (for ex if there are a few use cases and you replace just some of those, of if there’s an overload which doesn’t get replaced).