Issue
How can i exclude terms from intellij's structure search? (NOT text or regex seach!)
for example, using the annotated field template, let's say i want to add @Lazy
to all occurrences of @Autowired
for fields of type X?
@Autowired
private X x;
as well as
@Autowired
@Getter
Private X x;
but not
@Lazy
@Autowired
Private X x;
I understood from the manual how to match positively by adding conditional text=...
to the elements, but not how to add a negative.
Edit1: the reason a regex is not the answer (as suggested in a comment), is because the Structural search matches things like different annotations between the annotation i'm searching for and the field, also it matches any access prefix on the field, etc.
If I move from structured to regex/text search find/replace, then i will have many other problems.
Solution
Add a @$Lazy$
annotation to the search template with a text filter Lazy
and a count filter [0,0]
. This will only find elements that do not have the @Lazy
annotation.
Answered By - Bas Leijdekkers
Answer Checked By - David Marino (JavaFixing Volunteer)