I am currently injecting a custom language into an XmlAttribute, and providing RefactoringSupport for introduce variable.
When introduce variable is triggered, I update the Dom within the same PsiFile to add a new property, and I also update the injected language to point to this new value.
My implementation is working great, however the LanguageInjection behaves oddly within my unit tests
For instance when I call invoke on my RefactoringActionHandler, psiFile.findElementAt does not return my language PsiElement - but instead an XmlAttribute.
This is somewhat confusing, as if I call InjectedLanguageUtil.findInjectedPsiNoCommit(myFixture.getFile(), editor.getSelectionModel().getSelectionStart()); - then this correctly shows my injected language file!
Unfortunately I can't make use of the findInjectedPsiNoCommit language file either, as I still need to perform the Dom manipulation
I would love to get some tests up and running for this, so any help is definitely much appreciated :)