|Delphi Clinic||C++Builder Gate||Training & Consultancy||Delphi Notes Weblog||Dr.Bob's Webshop|
Code Insight consists of a number of new IDE code editor features that really support the programmer when writing Delphi code.
The first very helpful addition to the code editor is called Code Completion. This means that when you type the name of a class instance (such as Button1) followed by a dot, you get a list of all properties and methods that are part of this instance. This is very handy, as you no longer need to remember the name of that method or property, and only have to select the right one from the alphabetically sorted list:
You can also get this list of properties and methods on demand by typing Control+Space in the editor.
Another great help is called Code Parameters, where you no longer have to remember the order and type of parameters to methods and Windows API calls. Right after you've typed the name of the routine and the opening parenthesis, Delphi pops up a list of parameters, including their types. The current parameter is presented in bold, so you always know where you are in the list of parameters:
This feature also works for our own routines and methods that we define.
Delphi does all this by constantly parsing the source units and keeping a list of procedures/methods and their parameter list in memory.
This all works very fast in the background, and you've gotta admit it's a great help (especially with those methods with more than a few parameters to begin with).
To get the list of parameters on demand you only have to type Control+Shift+Space in the editor.
Tooltip Expression Evaluation
A third new feature called Tooltip Expression Evaluation is actually a great help when debugging. Using this feature, we no longer have to use the Expression Watch Window to see the value of classes and properties. Just set a breakpoint, and when you're inside the IDE Debugger, move the mouse over the class of property you want to see, and the value will appear in another hint window:
The final Code Insights feature is called Code Templates. Again, this features can save you lots of keystrokes as you only need to type in a few characters followed by Control+J and pick from a list of predefined code templates. There are already a few dozen code templates defined, such as for if-then-else statements, array declarations, procedures, function, case statements, etc. And you can add your own to this list as well. If you start to type "if" and then hit Control+J you only get the relevant code templates, of course:
Of course, all Code Insights features can be turned on and off, and even customised, such as the delay before the code insights hints appear and the list of code templates. We can write our own code templates or expand existing ones. This makes it really easy for example to make sure that each new function or procedure starts with a standard comment line (see screenshot below):
I can only conclude that Code Insights offer a welcome set of enhanced features that will support Delphi programmers when writing code. The productivity will increase as the code editor itself will help you and offer you suggestions what code to write (if anything, you'll need to type less with Delphi). Very helpful and I'm really looking forward to use it on a daily basis!