Content Assist Tips

The advantage of code completion features is that you discover them as and when you type things out in the editor. One does not need to rely much on the documentation part of it. To start off, just thought of listing down couple of features from code assist inventory.
Did you notice…
1. Content assist on CFCs is available on ‘bind’ attributes of tags also? For example, <cfdiv>, <cfgrid>, <cfinput>, <cfselect>, <cfajaxproxy> etc
2. Content assist on variables, UDFs, queries and CFCs of an included file is available on the file including it.
3. Content assist on CFCs is available with ‘new’ operator also.
myObj = new “myCFC”();
4. Content assist also works on project level variables for CFCs. In project properties, there is a page for ColdFusion variable mappings where you can map variables to fully qualified CFC names. For example, Application.mycfc1 might map to com.adobe.mycfcs.mycfc1. You don’t
need to create objects of this CFCs to get content assist. Application.mycfc1. should give you the methods as Application.mycfc1.mymethod1.
5. Similar to the way file browser shows up in tag attribute values that take in file/dir, content assist shows file browser for relevant functions as well. For example, fileExists(), fileDelete(), fileRead() etc.
6. Content assist processes Application.cfm and Application.cfc. Application.cfm will be treated as included file and all variables and functions will be available for content assist. But in case of Application.cfc, only scoped variables declared in onApplicationStart will be available in content assist.
7. Content assist shows implicit getter and setter functions for properties of CFCs.
For example,
pageencoding “utf8″;
property name=”x” cacheregion=”” collectiontype=”array” cfc=””;
property string y;
param name=”x” pattern=”” default=””;
param y=10 max=””;
//x = new vam();
public void function foo(required x=”hi”)
return arguments.x;
Now try calling method of this component.
<cfset myObj = createObject(“component”, “test”)>
<cfset myObj. shows the methods foo(x), getx(), gety(), setx() and sety()
Try out these features and post your feedback on them. I will post examples on content assist w.r.t Application.cfc soon.

2 Responses to Content Assist Tips

  1. Henry Ho says:

    Does this work for CF8?

  2. George Schaffer says:

    I was able to use this on CF 8 via
    x = createobject(“component”,”user”);
    but so far only if the component is the same directory as the cfc being instantiated.