- Category: Build Compile options
Infotips, or code completion, is a facility for providing context sensitive help in the form of a popup menu or tooltip whilst you are typing in code. It is ideal for working on code where you have lots of functions or data structures but cannot remember exactly the syntax or format of a specific item. For example, the TCL language provides a number of functions which perform a generic action, but the specific task they perform is controlled by the first argument passed to the function.
For example, the [string] function takes a number of arguments to perform things like string matching, sub-string extraction etc. By typing in the function as in: [string] with the cursor placed after the string keyword, a popup will appear:
Types of Tips
When tips are enabled, then the tips will popup automatically as you are typing - you don’t need to remember any keyboard shortcuts. There are two types of tips - menu tips where a list of possible options are shown, and unambiguous function help tips, showing the prototype of the function or entity you are typing. Function tips are normally popped up as a result of typing open parenthesis or a comma
When typing a function call, CRiSP will popup a reminder tip as you type each function argument, highlighting the argument you are typing.
Menu tips are shown when there are more than one valid definition of the object (function or structure/class member). You can scroll through each one, and a popup function tip will show to the side of the menu popup (if one is available).
CRiSP will normally scan your own private tag database as part of your project to show you valid definitions. If no definitions are found then CRiSP will rely on its own built in database of tips. CRiSP comes with a variety of databases covering C, C++, Java, Perl, TCL, Cold Fusion, and SQL.
Infotips can be enabled on a per file extension basis. Visit OptionsLanguage Editing Modes where you can enable the tip for persistent settings.
The set tip command can be used to temporarily change code completion for the current buffer - either to enable or disable it. You can enable tips for the current buffer using the following Command:
prompt set command: set tip
You can disable tips by using the command: set notip
Normally, an infotip will popup as you are typing in. CRiSP detects the type of construct you are typing and based on internal databases or project tag files, will display a list of valid options. You can force CRiSP to evaluate the current construct and show a list of options by using the <Ctrl-Space> key. You can use this even if tips are turned off, or if you have just dismissed the popup window.
Examples of Tips
CRiSP supports a number of languages for info-tipping. Different languages have different specifications and the features provided by CRiSP vary for these languages. The following examples illustrate simple examples of invoking the tip feature.
CRiSP provides support for HTML files, prompting you with the valid element names after an opening angle bracket. To see this in action, edit a new HTML file, and type <. If tips are enabled then a popup menu will show the valid HTML elements available. To the right of this menu will be a comments window, showing a description of the element and the available attributes. (If tipping is not enabled, then press <Ctrl-Space> to get the popup). You can scroll through the list of valid elements and click on the attribute links for each element to get a short description of the features available.