PsiLanguageInjectionHost (final @NotNull String text) { try { var policy = getPolicy(); // CDATAOnAnyEncodedPolicy is a default policy for XML elements. // We should not do any special CDATA encoding by default in `updateText`, // so let's revert to DefaultXmlPsiPolicy in such case. // HTML and other elements however, should use their respective policies as // it affects XmlText parsing and injections can be wrongly parsed. if (policy instanceof CDATAOnAnyEncodedPolicy) { policy = new DefaultXmlPsiPolicy(); } doSetValue(text, policy); } catch (IncorrectOperationException e) { LOG.error(e); } return this; }