How to handle Rename Refactoring of type A+B?
Answered
I have created a plugin for handling XML attributes. Assuming that Tag A's attribute is A1, Tag B's attribute is B1, and Tag C's attribute C1 consists of A1+B1, Attribute C has already created psiReference, which points to A and B respectively. By using Ctrl+B, different contents in C1 can be switched to corresponding A1 or B1. However, if B1 is changed to B2 through Alt+F6, the associated content of C1 can be queried. After the actual modification, only B1 becomes B2, and B1 in C1 remains unchanged. How to handle it so that the content of the response part in C1 can be synchronously modified?
Please sign in to leave a comment.
Hi,
What is your implementation? Is the C1 found when you search for B1's references?
Sorry,Press Shift+F6,not Alt+F6
1、Create two PsiReference on the attribute values of C1, pointing to A1 and B1 respectively.
2、Yes, the C1 found when searching for B1's references
I have already resolved this issue。
My PsiReference is extended from PsiReferenceBase.Immediate<PsiElement>, customize the handleElementRename procedure:
return ElementManipulators.getManipulator(this.myElement).handleContentChange(this.myElement,this.myTextRange,newElementName);