How to get the parent psi element outside of a language injection Follow
Answered
Hello fellows,
I'm in the middle of a plugin development and now I have some struggles with the language injection.
I want to add auto completions for a specific code position, but I need some information of the previous elements, which are an another language. I can't add them to my language.
Example:
name="someContent"
"someContent" is my language.
"name" is the information, which I need. This is the other language.
I hope you could help me. :)
Kind regards,
Fabian
Please sign in to leave a comment.
Invoking psi.getContext in a loop (orPsiTreeUtil.getContextOfType) will eventually switch from injected to host PSI.
Hi Peter,
thank you very much! The following code worked for me. :)
PsiTreeUtil.getContextOfType(
completionParameters.getPosition(), XmlAttributeValue.class
);
Kind regards,
Fabian