I want to write a visual studio extension to find all references of a certain symbol then perform a "customized Rename". For example, I have a struct like this
struct Foo
{
int index;
}
Now I want to replace the int index with a custom struct like this:
struct IndexContainer
{
int index;
}
struct Foo
{
IndexContainer indexContainer;
}
Then I want to replace all Foo.index
with Foo.indexContainer.index
(imagine there are tons of place where Foo.index
is used).
I want to write a helper tool to automate this work. From what I understand, if I am able to find all the references of this symbol, then I can just iterate all the references and change the text for that reference.
The reason why I cannot simply use Rename is because Rename might change another symbol that is not Foo.index
and it also can not make static array work(imagine IndexContainer indexContainer[5]
).
Would anyone tell me if there's a method to invoke "find all references" and grab its result?