Occurrence Selection

Poor man’s manipulation to the rescue!

Where we go, we don’t need Find & Replace! 🛹⚡️

Using actions for occurrence selection is a powerful way to transform and manipulate all kinds of texts. We start by making a selection for our text. With every call to Add Selection for Next Occurrence we get another multicaret that can be moved around, insert and delete text, expand or shrink its individual selection, or toggle the casing of its text. This is exactly what we need if we have to fix only a couple of similar invocations or change the format of our data! 🎭📐

Remember to always use meaningful names! 🏷 Invoking Unselect Occurrence removes the previously added selection; Select All Occurrences scans the whole document for occurrences and selects them.

But remember: always give refactorings a try first! 🔧🤓

See Also


Related Resources

Use collection initializers
Update and initialize items in old collection declarations
Rename refactoring
Would a variable by any other name read as clearly?
Extract method refactoring
Split and Organize code into DRY, discrete units.