Skip to main content

Finding Declarations

CODESYS provides the capability of searching the entire project for the definition location of a variable or function. The block that includes the definition opens in the editor with the marked declaration.

Finding the declaration of a variable

Requirement: An POU is open in the editor.

  1. Set the cursor at an identifier in the implementation part.

  2. Click Edit → Browse → Go to Definition.

    The POU with the declaration opens in the editor with the variable definition marked. If the definition is located in a "compiled" library, then the respective block opens in the Library Manager.

Tip

You can execute this command in online and offline modes.

Example 25. Examples

The following block includes a function block definition (fbinst), a program call (prog_y()), and a function block call (fbinst.out):

VAR
 fbinst:fb1;
 ivar:INT;
END_VAR

prog_y();
ivar:=prog_y.y;
res1:=fbinst.out;

If the cursor is located at prog_y, then the command opens the program prog_y in the editor.

If the cursor is located at fbinst, then this command focuses in the declaration part at line fbinst:fb1;

If you set the cursor at out, then this command opens the function block fb1 in its editor.