17. Formatting for improved readability

<< Previous Table of Contents   |   Detailed Index Next >>
1. Crystal C/C++ Formatter

-   Crystal Flow's formatter is parser-based. It does a lot more than a formatter that uses lexical analysis only.

-   Alignment of type specifiers, declarators among consecutive declarations

-   Alignment of assignment operators among consecutive assignment statements

-   Formatting of long expressions that take up more than one line - based on precedence of operators

-   Proper formatting of macro definitions that contain many statements

-   Maintains a comment-field to the right for easy readability

2. Formatting files in Crystal C/C++

When Crystal C/C++ opens a file for the first time:

-   It uses the current format settings to format the file and saves the format settings on a per file basis.

-   When you open the file again, the saved format settings are used for that file.

3. To modify Format settings

Click Tools → Options → Environment → File Window → Format Settings

-   Set the Indent and Tab Size, etc

-   Change the Code Formatting Style

-   Change the Comment Formatting Style

-   Selectively disable formatting of code or comments.

4. To apply the modified format setting

To apply the new settings to a file that is currently open:

-   Click File → Refresh Current File.

(Until you Refresh the file, your changes will not be applied to the current file)


To apply the new settings to all files in the project

-   Click Project→Reparse Project → FilesAll

(Until you Reparse the project, your changes will not be applied to the whole project)

5. To disable automatic formatting

Click Tools → Options → Environment → File Window → Format Settings

-   In the Format Mode, select None.

-   Apply the modified settings to the files as described above.

<< Previous Table of Contents   |   Detailed Index Next >>