mapstruct-idea icon indicating copy to clipboard operation
mapstruct-idea copied to clipboard

Find usages and renaming for constructor fields

Open filiphr opened this issue 5 years ago • 2 comments

I've been trying to make this work. However, there are some problems with the custom ConstructorParametersReferencesSearcher that I've implemented. Find usages works properly. However, that causes some other problems:

  • When I rename the constructor parameter in the constructor method then my element in the annotation is not renamed. This is tested by MapstructMethodUsagesSearcherTest.testRenameConstructorTargetReferenceMethod
  • When I rename the element in the annotation and the class is in the same file as my annotation there is an error happening. This is tested in RenameHandlerTest.testRenameConstructorTargetParameter. When I run the plugin in an IDE and the class is not in the same file as my annotation then the renaming is correct.

filiphr avatar Jun 01 '20 16:06 filiphr

Just a small idea: could it be related with referenceSearch? For now, this plugin only offers methodReferenceSearch and I think PsiParameter would not be tracked during the rename process.

KENNYSOFT avatar Apr 23 '23 18:04 KENNYSOFT

You are right @KENNYSOFT. It might be related to that. Perhaps we should indeed provide a custom referenceSearch. That might solve all problems.

filiphr avatar Apr 23 '23 18:04 filiphr