PhpStorm 2023.2 Help

Wrapping a tag. Example of applying surround live templates

As an example of applying a surround template, let's wrap a piece of XML code with tags.

To surround a code fragment

  1. Open the desired file for editing.

  2. Select a code fragment.

    Surround xml1
  3. Press invocation shortcut Control+Alt+J. PhpStorm suggests the following surround templates:

    Surround xml2
  4. Select the tag template from the suggestion list. The code fragment is surrounded with empty tags:

    Surround xml3
  5. The caret rests within the opening one. On typing the tag name in the opening tag, the name is automatically reproduced in the closing tag:

    Surround xml4
Last modified: 30 October 2023