Skip to content

Understanding Auto Complete

rpgtoolkit edited this page Nov 23, 2012 · 4 revisions

RPGCode Express's auto-complete menu is perhaps the most powerful feature the editor has to offer, it contains all of RPGCode's methods, your custom methods, and any variables you have declared. This is extremely useful in cases where you can't remember the name of a particular method, you want to know what the method does, or simply you don't want to have to keep typing it out manually. The auto-complete menu is similar to Visual Studio's IntelliSense menu, as a result it offers a very wide and advanced set of features.

Inserting RPGCode Methods

The auto-complete menu is populated with all of RPGCode's defined methods by default, the moment you start typing it will begin suggesting the best possible match. You can navigate through the matches using the up and down arrow keys, once you have selected an item it can be inserted using either the Tab or Enter key(s). You can also access the method's parameter list and description by left clicking it using the mouse, this will display a tool-tip containing all of the reference information for the selected method.

Adding Your Own Items

The auto-complete list isn't simply limited to RPGCode's predefined methods in fact you can dynamically add your own classes, methods, and variables to the auto-complete list with no extra effort. For example the following code would add the class “TemplarKnight” to the auto-complete menu as a class auto-complete item:

	class TemplarKnight { }

Autocomplete Demo

Now when I hit “t” in the code editor I will see “TemplarKnight” in the auto-complete list, you can add methods in a similar way:

	method swingSword() { }
	method TemplarKnight::swingSword() { }

Methods in Autocomplete

Variable declarations are treated a little differently, you MUST explicitly declare your variables for them to be registered in the auto-complete list, meaning you need to use global, local, or var depending on the variables scope and context:

	//Will register
	global(x);
	local(y);
	var z;
	//Will not
	a = 10;

Including Items

Another way to add items to the auto-complete list is through “included files”. In RPGCode you can “include” any number of program files in another program allowing you to access all of the public classes, methods, and variables contained within it:

	//Recognised by RPGCode Express
	#includetest1.prg;
	include(test2.prg);
	//Not recognised by RPGCode Express
	test1.someMethod();

The data contained within these files is reflected in the auto-complete list in the following way: All classes contained within the included files are added to the auto-complete list. Any methods (public or private) are also added. Variables declared using the key words var (public or private) or global are also added. The only thing that isn't added through included files is local variables because they are local to the included programs.

NOTE: If any of the included files have been updated after inclusion the file which contains the “include” statement may need to be saved in order for these changes (if any) to be reflected in the auto-complete list.

Clone this wiki locally