AnyLogic supports intelli-sense mechanism. This significantly simplifies typing code since you do not need to type the whole names of functions, variables, and parameters. You can use the intelli-sense wizard to insert a variable name or a call of a function.
The wizard looks as a list, containing variables, parameters, and functions. You can simply select the name in the list, and it will be inserted in the expression automatically.
To insert a name using the code completion master
- Move cursor at the position where you want to place the element's name.
Press Ctrl + Space (macOS: Option + Space). The wizard listing all model variables and predefined functions appears.
- Scroll to the name you want to add, or type the first letters of the name until it becomes visible in the list.
- Select the name by clicking. The wizard displays the detailed description of the selected object in the popup text box.
- Double-click the name to insert it into the equation expression.
Some tips for using code completion
- You can use the mouse or the keyboard (Up Arrow, Down Arrow, Page Up, Page Down, Home, End, Enter) to navigate and select lines in the list.
- If you select a line in the content assist list, you can view Javadoc description for that line in the window opened to the right.
- Clicking or pressing Enter on a selected line in the list inserts the selection into the editor.
- You can access specialized content assist features inside Javadoc comments.
Model item does not appear in the code completion list
- Code completion uses information from model’s source files generated when the model is built. By default model sources are generated automatically on every structural model change (when you add a new element to the graphical editor, rename / delete / ignore element, etc.), and the code completion information is always up-to-date. However, if you turn off the Build model sources automatically advanced preference to avoid impact of frequent code compilations on the development process, you will need to compile your model by using the Build model (F7) toolbar button to bring your code completion to the up-to-date state.
Code completion master is not shown
- Code completion is not shown for the Name property. There, you can just specify a name for a model item, but not refer to other model items, so the code completion master is useless here.
- Code completion is not supported in the New Experiment wizard (namely, in the tables shown when you create a Compare runs, Monte Carlo, Sensitivity analysis, or Calibration experiment).
How can we improve this article?