Outlining

PHP Editor allows you to collapse content of functions, classes, namespaces and PHPDoc to make better overview of your code.

PHP code outlining

Moreover when PHP Editor finds a syntax error or a logical error, corresponding expression is underlined with red wave and the error detail is listed in Visual Studio Error List tool window.

Default Shortcuts

  • Ctrl+M, O
  • Ctrl+M, P
  • Ctrl+M, M
  • Ctrl+M, L

Collapsible Regions

Following list describes all the code fragments supporting outlining:

  • Class body
  • Namespace content
  • Function body
  • Lambda functions
  • PHPDoc comment block
  • Multi-line comments
  • Group of single-line comments
  • PHP script tags containing more than one line of code
  • PHP content between #region/#endregion or //region///endregion
  • Code blocks enclosed in { ... } (since version 1.18)
  • Content of switch, case and default (since version 1.18)
  • Code enclosed within for, foreach, if, else, elseif (since version 1.18)

Outlining behaviour can be modified in PHP language options. To disable automatic outlining of newly opened file, or to change additional outlining options, go to Tools | Options | Text Editor | PHP | Advanced.

#region Outlining

Outlining of #region sections

Single line comments starting with region keyword are treated as start of collapsible region, and are matched with following endregion comment. Regions can be nested. Optionally user can specify the region name after the region keyword.