Injected languages formatting

How to make injected language formatting?

Got composite element injected with other language.
This composite element wrapped in the leaf formatting block without subblocks.

Re-formatting does nothing with this block's content.


When child blocks are requested from the block wrapping the composite element in buildChildren() method, you may use InjectedLanguageBlockBuilder.addInjectedBlocks() to add child blocks for the injected language.


Hi Rustam Vishniakov may I ask for some clarification: so, this is about modifying FormattingModelBuilder for a _containing_ (outer) language, is it? In my case, custom language is injected into XML-based format, so I would want *contents* of a specific tag, that has CDATA, containing code in custom language, to be auto-formatted, when auto-format action is called on the containing (parent, outer, don't know what to call it) file


How would you advice to go about it, is there some extension point on an XML plugin I could extend? Or I would have to implement completely different formatter for this file type, but how to make IJ use it instead of built-in one (I would not want to abandon XML plugin completely)


turns out, it actually works straight out of the box! Jet Brains are genius people.. Thanks!


Please sign in to leave a comment.