Promoting a Local Variable to be a Property on the Current Class
When editing a JADE method, you can promote a local variable to a property on the class in which the method is defined.
To promote a local variable to a property on the class
-
From the editor pane, select the local variable reference in the method (in the logic or in the vars section).
-
Select the Promote to Class Property command from the Refactor submenu of the Edit menu.
If the caret is positioned in a local variable, the Define Attribute or Define Reference dialog is displayed, depending on the type of the local variable. The name of the property in the dialog is set to the local variable name and the dialog property type is set to the type of the local variable.
-
Set any attributes that you require and then click the OK button.
The property is then added to the class and the local variable definition is removed from the method.
If the line containing the variable definition will then be empty, the entire line is removed. If there is any other text on the line (including comments), only the relevant variable definition portion is removed.
To undo the text change in the method, press Ctrl+Z (the property definition will remain).