Injected language tags that sorounds base code

Hi,
I am trying to inject a language in comments that have matching start and end tags like similar to xml.

Example:

// &begin[*name*]
some code 
// &end[*name*]

Where begin and end matches if the name is the same and otherwise do not. Is it possible to do such a thing with injection?

Hi Johan,
Depending on your PSI, you can use one of the APIs described on IntelliJ Platform Plugin SDK Documentation: Language Injection.
If the comment content has a separate representation in PSI, then LanguageInjectionContributor should be enough.
If not, try LanguageInjectionPerformer.

1 Like

Thanks! we will try that! saw that the documentation on language injection had been updated a bit since I last looked as well :slight_smile: