Editor Quick Action: Extract to Section

Note: Applies to native COBOL only.

An editor quick action is available for moving selected lines of code in the editor to a new section. Use this to refactor your code, make it more readable and to create more entry points that you can use for unit testing.

To select lines of code and move them to a new section:

  1. Select the lines of code you want to move.
  2. Click the light bulb icon (light bulb) to see the suggested fixes:

  3. Click Extract to Section in the drop-down list.

    Executing this command replaces the selection a perform new-section statement. It also adds a new section called new-section.

    The name of the new section is highlighted in the editor and the IDE displays the Rename: new-section widget enabling you to change the name of the section right away.

  4. Enter a new name for the section in the editor.

    The name is automatically updated in the two places where it is referenced.