Language injections

Last modified: 11 October 2024

Language injections let you work with pieces of code in a programming language different from the main language of your file.

WebStorm provides comprehensive language assistance for editing HTML, CSS, XML, JSON, RegExp, and other code fragments inside string and template literals as well as inside tags and attributes in XML-like languages.

A language fragment may be combined with a prefix and a suffix that act together as a wrapper, turning the fragment into a syntactically complete language unit. When editing your code, you can see prefixes and suffixes only in the fragment editor. They are not shown in the main editor.

The prefix and the suffix can be included in the injection comment as follows:

https://resources.jetbrains.com/help/img/idea/2024.3/ws_lang_injection_annotate_prefix.png
Gif