Surrounding Blocks of Code with Language Constructs
On this page:
Applicable contexts
The Surround with feature allows you easily put expressions or statements within blocks or language constructs. This feature in IntelliJ IDEA applies to:
Context | Surround with | Example |
---|---|---|
Java statements |
![]() | |
Java expressions |
![]() | |
XML/HTML /JSP/JSPX tags |
|
![]() |
JavaScript statements |
![]() | |
ActionScript statements |
![]() | |
PHP statements |
![]() | |
Custom folding region comments | Any fragment of code, where Surround With is applicable | ![]() |
Surrounding blocks of code
To surround a block of code
- Select the desired code fragment.
- Do one of the following:
A pop-up window displays the list of enclosing statements according to the context.
- Select the desired surround statement from the list. To do that, use the mouse cursor, up and down arrow keys, or a shortcut key displayed next to each element of the list.
See Also
Last modified: 23 November 2016