- How to?
- Indenting an existing code
- Configuring the automatic reindentation of a pasted code
When typing compound statements ("Switch", "For" and "While", for example), the code is automatically indented to highlight the structure of the loops used in the program.
As soon as the first statement is typed, the "END" keyword is automatically inserted and the cursor is positioned in the compound statement.
Automatic indentation also allows aligning by the '=' sign and the word 'is'.
Indenting an existing code
Several options can be used to indent an existing code or the code currently typed:
- To indent the current line of code to the left go to the "Code" tab, "Edit" group and click "Unindent".
- To indent the current line of code to the right go to the "Code" tab, "Edit" group and click "Indent".
- To automatically indent the entire code, on the "Code" tab, in the "Edit" group, click "Auto re-indent." (or press Ctrl + R).
To configure the automatic reindentation options:
- Position the cursor in the code editor (but not on a line that contains WLanguage code).
- On the "Code" tab, in the "Edit" group, expand "Auto re-indent." (or press Ctrl + R).
- A window allows you to configure the scope of automatic indent. The scope may correspond to:
- current code: only the process being edited (where the cursor is located) is reindented.
- current element: all the events associated with the current element in the code editor are reindented (for example, all the codes of the window, controls and menus associated with the window).
- the entire code displayed in the active code window: all the events or processes currently displayed in the code window will be reindented.
- all the WLanguage code of the project: all the events of all the project elements.
- The "Align by '=', 'is', '//'" option allows aligning all the text and code to the right of '=', 'is' or '//'.
This option will be automatically taken into account for all subsequent automatic reindentations with Ctrl + R.
Configuring the automatic reindentation of a pasted code
To automatically reindent the code during a copy/paste:
- Open the options of code editor: on the "Home" tab, in the "Environment" group, expand "Options" and select "Options of the code editor".
- In the "Code" tab, check "Indent (pasted code is edited and indented to fit layout)".
This page is also available for…