2.2.3. GNATbench Project File EditorΒΆ

GNATbench provides a simple syntax-oriented editor for GNAT Project Files. Although the GUI interface discussed elsewhere is likely more convenient initially, eventually you may want to edit the file directly.

The editor is associated with files having an extension of ”.gpr” (standing for “Gnat PRoject”) and is thus invoked by double-clicking on the project file within the various viewers, such as the GNAT Project Explorer. (If the default system editor is invoked, you can reassign the GNATbench editor by selecting “Open With -> GNAT Project File Editor” in the contextual menu.)

Note also that you can invoke the editor on a project file even when the file is not visible within one of the viewers. This could be the case when the project file is not resident in the project root, for example. In this case, the viewer’s contextual menu can be used, as shown below:

project file editor invocation menu entry

Project files are simply text files with an Ada-like syntax. The purpose of the editor is facilitate making syntactically correct changes to these files. To that end, the primary feature of the editor is syntax-driven entity coloring. The colors follow the selections made within the Ada editor for corresponding syntactic categories.

An example project file illustrating this coloring is shown in the figure below.

project file editor debug-release example

Additionally, the project file editor supports some of the same editor capabilities as the Ada source editor. Specifically, the comment toggle, text refill, smart indenting tab key, and construct closing commands are supported.

The Outline view is also supported for packages, variables, and types.

project file outline view