Documentation of the GMS-Editor

Overview


Comments, regions and code folding

There are 4 ways to mark a text as a comment:

- $ontext marks the beginning of a comment passage, $offtext the end.

- a first place comment, typically an asterix '*'

- an end of line comment, which must be activated manually, typically a double exclamation mark '!!'

- an in line comment, which must be activated manually, typically a '/*' in the beginning and a '*/' in the end.

 

In the classical GAMS-IDE, these comments don't influence the text coloring. For example, if you type '//' in the classical IDE, the following text will be marked in grey, but normally it is not treated as an end of line comment by the compiler.

 

But the GMS-Manager allows you to define the activated comments, their coloring and the characters you want to use.

You can simply click on one of the fields '!!', '/*' or '*/' to activate or deactivate the end of line or in line comments.

If you click on the "Comments"-Label, a drop down menu opens. Here you can define the characters you want to use for first place comments, end of line comments and in line comments.

If you close the menu or activate/ deactivate a comment type, you will be asked if the selected comments should be activated in the base file. If you click "yes", then the necessary changes are automatically made in the header of your current base file, so that the compiler will recognize the characters as beginning / ending of a comment.

You can also define the words, defining where regions start and end. The defaults are "*Region" and "*EndRegion".

On the right side we define a region "declarations". The code can be folded by clicking on the "-" on the left hand.

$Ontext-statements can also be folded.


Search in current file only (ctrl+F). If you search two words only lines will be shown in which both words appear

Search in base file and all files associated with the base file (ctrl+shift+F)

Search for gms files in current project folder and sub-folders

Button up: ignore case / Button down: case sensitive

Button up: Searches also inside words / Button down: search for whole words only

Activate / deactivate automatic code folding for search patterns

Opens or closes the "Replace" option

Search previous appearance

Search next appearance


Symbol search and the search result box

The symbol search is performed if you press "ctrl" and click on a symbol in your text or double click on a symbol in the symbol table on the left side of the window.

The search results are listed in the result box in the lower part of the window. They are based on the reference file.

If you perform the symbol search, the cursor is moved to the place of the symbol declaration. In the reference file, the positions do not always match the actual position of the symbol, so the symbol itself is highlighted in addition.


Automatic code folding for search patterns

Activate /deativate automatic code folding for search patterns

If automatic code folding for search patterns is activated, you can easily compare all parts of the program in which the search pattern is used. This can be also be used for the symbol search. In this case the places in the program, in which the symbol is declared, defined, referenced or assigned.


Compile mode

In the bottom-bar, you can adjust the "Compile Mode" which will influence the automatic error search, the updating of your symbol table, the auto complete functionality and the way GAMS treats $call-statements.

1. If you want to ignore $call-statements choose the first option. This is the default, but it is only available, if you use the GAMS-version 24.7.1 or above. If you use an older version, you can ignore $call-statements by adjusting your gams-code a bit.

You can simply add

$ifi not %GmsManagerCompileMode% == On $Call...

 

2. In case your program generates files using the $call-statements, which are later used by your program and then deleted in the end, the debug mode will produce errors, if you deactivate the $call-statements. In this case, you might want to execute the $call statements and you can do this by choosing the second option. You can still manually deactivate those $call statements, which you don't want to be executed during compilation by adding

$ifi not %GmsManagerCompileMode% == On $Call...

 

3. You can also completely deactivate fast compilation after typing with the third option. But by doing so, the errors and the symbol table won't be updated.

 

On the right side you can define if you want to disable the file change notifications during compilation. This is useful, because the files can be updated due to the compilation.

 

The gms-Manager produces .gdx, ..ref, .err and .fil - files in order to update the symbol information and errors. This can be deactivated, but as a result the symbol information or errors will not be updated automatically.

 


Formatting

Another tab in the bottom bar gives the option of "Formatting" the appearance of your .gms-files.

On the left side you see a list box, in which you can choose the "Letter Types", for example "System words".

 

The next three list boxes show the current settings of the chosen letter type.

If you have chosen the letter type "System words", you can change the font style in the second list box into "Bold" or "Italic". 

In the other two list boxes, you can select the "Fore Color" and the "Back Color".

The appearances of the gms-files will be updated automatically after changing a setting.


Working with the tree views folder structure / include structure

If you want to find errors, see the symbol table or run a file, which is included by the base file (for example Untitled4.gms).

Independent of the base-file transport.gms, you only need to define Untitled4.gms as a new base file (by right-clicking on the file name and selecting "declare file as new base file...").

The color of the new base-file Untitled1.gms is automatically selected, but can be changed as well. If you run the GAMS-Job Untitled1.gms now, it will be executed by itself, the error listing will only be shown for the errors inside this file and the symbol table will only be taken from Untitled1.gms as well.

 

Afterwards, you can associate the include file Untitled4.gms again with the base-file transport.gms by right-clicking on the file name and selecting "Associate with base file...", then choosing transport.gms as the base-file, which will thereby again be executed if you run your GAMS-Job from Untitled4.gms.


Key bindings

If you want to use a key combination to enter for example a symbol name by clicking the key combination, you can do this by selecting File - Options - Key bindings...

You will see the above form, in which you can enter a new key binding and its content and clicking on "Accept". To save the new bindings, click "OK".


Base file - handling

If we right click on a base file, another context menu appears. In this we can open the fist file or the log file of the base file and we can create or open a GamsChk file, which will be used by the compiler if GamsChk is activated.

Another option is to change the color of the base file.

 

If you click on "Remember current association for all sub nodes" then all the include files called by the base file will be associated with the base file, even if the $include statement is deleted. In this case you can still work with the include files, as if they belong to the base file.

 

You can also associate a base file with another base file. In this case the base file and its color will disappear and the association will appear at the new base file.

 

You can also remove the base file from the project tree, so it is not visible anymore and all associated files will be closed.

 

If you remove all associated files only files will disappear, which are not included in the base file.