Format and indent with the code beautifier tool
The source code beautifier tool can be used to reformat .4gl source modules to produce readable source code using consistent indentation and specified layout rules across modules.
The code beautifier tool is provided as part of the fglcomp compilation tool. Genero Studio provides an interface to the compilation tool through the use of menu options and preference settings. In order to gain a thorough understanding of the code beautifier tool, it is recommended that you review the topics in the Source code beautifier section of the Genero Business Development Language User Guide.
Set the code beautifier rules
In the preferences for Code Editor, you can set rules for using the code beautifier tool with Genero Studio.
- Select . (or, if you are on a Mac, )
- Select .
- In the Language field, select Genero BDL.
- Click the Code Beautifier tab. Note that the items on the tab are disabled.
- Select the Use custom settings check box. The items on the tab are now enabled.
- Set the column limit. This sets the source line width limit by providing the value for the --fo-column-limit compiler option.
- Set the indent width. This sets the number of columns used for indentation by providing the value for the --fo-indent-width compiler option.
- Set the continuation indent width. This sets the indent width for line continuations by providing the value for the --fo-continuation-indent-width compiler option.
- Select to indent instruction clauses. This boolean option identifies whether to indent instruction clauses by providing the value for the --fo-label-indent compiler option. A value of 1 indents instruction clauses.
- Select to pack. This boolean option identifies whether to try and put as much as possible onto the same line by providing the value for the --fo-pack compiler option. A value of 0 uses one line for each item.
- Indent on save. This boolean option specifies whether to automatically apply the formatter when saving Genero source (.4gl) files.
When in Code Editor
When editing a file in Code Editor, select
. The open document is formatted and indented.From the File Browser
- Select one or more files. To select multiple files, hold the CTRL key.
- Right-click to open the context menu.
- Select .
The selected files are formatted and indented. For files currently open in Code Editor, it updates the opened files. For files that are not opened, it updates the files on disk.
From Project Manager
- Select one or more files and/or groups.
- Right-click to open the context menu.
- Select .
- A warning appears. Answer Yes to format and indent all files.
The selected files are formatted and indented. For files currently open in Code Editor, it updates the opened files. For files that are not opened, it updates the files on disk.