Custom Comment Pragmas in the DVT Eclipse IDE
Description
Comment pragmas are sometimes used to delineate special regions of code, like // synthesis translate_on for example.
This video explains how you can define custom pragmas in DVT and specify the editor behavior for such regions of code: folding, background color and even a "read-only" indication when editing the enclosed code.
Explore the design and verification tools: https://www.dvteclipse.com
Or request a license: https://www.dvteclipse.com/request-license
Transcript
Introduction
DVT allows you to customize the behavior of the editor for regions of code enclosed in Comment Pragmas.
You can fold such regions of code, change the editor's background color and configure the tool to flash a notification whenever editing within a region.
Use Cases
Typical use cases include:
- generated sections of code which are not supposed to be changed by hand
- translation pragmas
Custom Pragmas Definition
Custom pragmas are defined per project and saved in the .dvt/custom_pragmas.xml
file. They can be shared using the DVT settings management system.
Right-click on a project in the Project Explorer view and go to Properties > DVT > Custom Pragmas.
Select an entry in the table to see its:
- start and end pragmas
- background color
- whether it defines a read-only region
- other details
Creating a New Custom Pragma
Now, let's create a new custom pragma. The customized regions will be delimited by start my pragma
and end my pragma
, with a green background and a read-only notification.
Whenever you add a pragma, a full build is required for all the comments that already contain it to be scanned.
However, changing the properties of a pragma takes effect immediately, for example the background color.