java - Use IntelliJ structural search to replace field and its expression with new field -
i want use butterknife android. need annotate fields based on expressions elsewhere in code. have code this
private string myfield; ... public myclassconstructor() { ... myfield = res.getstring(r.string.my_string_id); ... }
i want this
@bindstring(r.string.my_string_id); string myfield; ... public myclassconstructor() { ... ... }
in result expression gone, , field annotated based on old expression.
is possible kind of search , replace in intellij's structural replace? seems not gracefully handle case when lines of interest not adjacent , in different locations structurally. tried basing on class template, , used $statement$ (0-unbounded occurrences) did not work me.
i realized relatively simple regular expressions, simpler getting intellij structural search play ball, learn tools, still know if possible.
while search structurally
somehow working , it's possible make search query, replace structuraly
kind of tools made "aliens" "predators". hope intellij team revisit feature , make more usable/understandable.
i trying myself make replace structurally
query, make search structurally
clause.
i have done mockito lib example.
one of key points here put $somestatement1$
, $somestatement2$
min , max count {0, unlimited}
and point i've tried come replacement clause messing out scope of method/fields declaration/class.
hope helps.
Comments
Post a Comment