ReplaceWith, change package

I have the case where I want to change the package structure from:

the function name (successUi(…)) and it parameters remain unchanged. Is there any way I can express this in ReplaceWith. What I’ve tried so far is the following:

ReplaceWith(“successUi(body)”, “nl.komponents.kovenant.ui”)

on the old/deprecated method name. This naturally leads to duplicate package imports and furthermore puts the body, which is a function, within the parenthesis.
Is there any way of doing this?

The only way I can think of is by using some two phase approach where I introduce some intermediate step with a different function name to led the imports be cleaned.

The actual code is found on GitHub

Message was edited by: Mark Platvoet, updated GitHub link with actual code

Mark, what version of plugin do you use? I see just duplicated imports after 'ReplaceWith' call, but all lambda reinserted without parenthesis.

Kotlin plugin version 0.12.1235.Idea141.1 Just reconfirmed.

Mark, it should be handled better in the recent builds of Kotlin plugin. You can try them or wait until M13 (expected to be released soon). Explicit imports of deprecated declarations being replaced should be removed when running Code Cleanup or running the replacement quickfix for the whole project.

Thanks, will try it in my test branch