LF Fortran 95

Go To Definition/Declaration

Go To Declaration

Go To Declaration is a feature that allows you to jump to the declaration of a variable or procedure. This can be done by placing the mouse over the name you want to see the declaration for, right clicking and selecting "Go To Declaration" from the floating menu:




The edit cursor will then jump to the line that contains the declaration for the name:




If the declaration appears in a different source file within the project, that file is opened in the editor, and the cursor is moved. In order for Go To Declaration to work properly, the code must be free of errors.

If a name is not a variable or procedure, if a variable is implicitly defined, or if there is no source available for the declaration, the cursor will not be moved.

Go To Definition

Go To Definition is similar to Go To Declaration in that it allows you to jump to the definition of a variable or procedure. This is done by placing the mouse over the name you want to see the definition for, right clicking and selecting "Go To Definition" from the floating menu:




The edit cursor will then jump to the line that contains the definition for the name:




If the definition appears in a different source file within the project, that file is opened in the editor, and the cursor is moved. In order for Go To Definition to work properly, the code must be free of errors.

Differences between Go To Definition and Go To Declaration

In many cases, the behavior of Go To Definition and Go To Declaration is the same. This is true for intrinsically typed variables and subroutines. In the case of derived type variables and functions, the behavior is different, however. If Go To Declaration is selected for a function or derived type, the cursor will move to the declaration of the derived type or function. If the function is implicitly typed, then the cursor will jump to the function implementation. If Go To Definition is selected for a function or derived type, the cursor will move to the derived type definition or the implementation of the function.

If a name is not a variable or procedure, if a variable is implicitly defined, or if there is no source available for the declaration, the cursor will not be moved.

Returning to the previous place in code

To move from the definition or declaration back to the name reference, use the "Navigate Backwards" toolbutton: