Extend RenameHandler to handle specific strings Follow
Answered
Consider the following simple example in the Mathematica plugin
The resolving of myFunction works like a charm and therefore, in place renaming does also. What I like to do is to extend the renaming to myFunction in the string. The important part is, that I want to ensure that I only replace it in ::usage definitions. Therefore, I cannot simply replace all myFunction in all strings. I need to visit all elements that are going to be renamed anyway and when one of them is a ::usage definition, I want to rename the attached string.
What is the simplest method to do this? Is there any way I can still leave the dirty work to the default RenameHandler and process all elements afterward?
Please sign in to leave a comment.
Hi Patrick,
I think that the easiest way would be to provide reference inside string literal to the myFunction, then rename would work the same way it works now and you get additional navigation and find usages results.
com.intellij.psi.PsiReferenceContributor is the extension point where you can start with additional references.
Anna
Hey Anna,
sorry for the confusion. Great answer.