Ayfri
12/30/2021, 12:53 AMBart
12/30/2021, 9:35 AMval/var/fun
keyword, then substitute the identifier with a template variable and put the count filter on it like this:
<replaceConfiguration name="Unnamed" text="object $CLASS$ { var $FIELD$ fun $METHODS$() }" recursive="false" type="Kotlin" pattern_context="default" reformatAccordingToStyle="false" shortenFQN="false" replacement="class $CLASS$ { companion object { var $FIELD$ fun $METHODS$() } }">
<constraint name="__context__" within="" contains="" />
<constraint name="CLASS" within="" contains="" />
<constraint name="FIELD" minCount="0" maxCount="2147483647" within="" contains="" />
<constraint name="METHODS" minCount="0" maxCount="2147483647" within="" contains="" />
</replaceConfiguration>
Unfortunately, this still doesn't get you the desired behavior because when searching for object
declarations, companion objects are matched as well. This is planned to change in 2021.1 (see KTIJ-20631).Ayfri
12/30/2021, 9:50 AM