How to Format Code in the DVT Eclipse IDE
Overview
This video shows you how to format the source code using DVT.
Explore the design and verification tools: https://www.dvteclipse.com
Or request a license: https://www.dvteclipse.com/request-license
Details
Formatting Code using Format Source
With DVT, you can easily format your code using Format Source command. You can also use the Shift-Ctrl-F
keyboard shortcut. To format the whole file, right-click in the editor and pick Source > Format Source. You can format just a part of the file by selecting the lines you want to format and then Format Source.
Customizing Formatting Preferences
The formatting can be customized using several preferences. Open the preferences dialog using Window > Preferences. Go to General > Editors > Text Editors and change the number of spaces used for indentation and choose to use spaces instead of tabs. Format the file again, and three spaces will be used for indentation.
To further customize the formatting preferences, open the Preferences dialog, go to DVT, select the language you want to customize the formatting for and choose Formatting. In this page, you can change the preferences and instantly preview the changes on a sample code. Let's take, for example, the Compact Whitespaces Groups preference. Selecting this button will reflect the change in the preview. Explore and customize other preferences to achieve the code formatting style you want.