Main

Editor Archives

July 16, 2009

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.

<cfscript>
myObj = new "myCFC"();
myObj.method1();
</cfscript>

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,

---test.cfc---
component

{
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.

July 19, 2009

Example on content assist w.r.t Application.cfc

Here's an example on how scoped variables declared in onApplicationStart method will be available in content assist. Note the scoped variables set in Application.cfc (Application.obj1/obj2/obj4/obj7/qVar/Counter1 in this example) and try getting content assist on them in any file in the application (as shown in test.cfm in this example). Another thing to note here is the various types of CFC variables created. Yes, we have tried to cover some such common variable assignment scenarios. Do try them out and let us know if they work as desired.

--- Application.cfc ---
<cfcomponent>

<cfset This.name = "TestApplication">
<cfset This.Sessionmanagement=true>
<cfset This.Sessiontimeout="#createtimespan(0,0,10,0)#">
<cfset This.applicationtimeout="#createtimespan(5,0,0,0)#">

<cffunction name="onApplicationStart">
<cfset Application.obj7 = new component_testing.cfcomponent.component_01()>
<cfset cfcNames.firstName = "component_testing.cfcomponent.component_01">
<cfset Application.obj1 = createObject("component", cfcNames.firstName)>
<cfscript>
cfcNameVar = "component_testing.cfcomponent.component_02";
Application.obj2 = createobject("component", #cfcNamevar#);
foo = createObject("component", "com.adobe.coldfusion.mail");
Application.obj4 = foo;
</cfscript>
<cftry>
<cfquery name="testDB" dataSource="cfdocexamples" maxrows="2">
SELECT Emp_ID FROM employee
</cfquery>
<cfset Application.qVar = "testDB">
<cfcatch type="database">
<cfdump var="#cfcatch#">
</cfcatch>
</cftry>
<cflog file="#This.Name#" type="Information" text="Application Started">
<cfscript>
Application.availableResources=0;
Application.counter1=1;
Application.sessions=0;
</cfscript>
</cffunction>

</cfcomponent>


--- test.cfm ---

<cfset Application.availableResources>
<cfset Application.counter1>
<cfset Application.qVar>
<cfset Application.obj1.method_01()>
<cfset Application.obj2.method_11()>
<cfset Application.obj4.addParam()>
<cfset Application.obj7.method_02()>

July 21, 2009

Code hyperlinking

Have you tried this out? This is a handy thing indeed and is one of my favorites. Code hyperlinking works on CFCs, UDF calls in local and included files, and CFC methods. Just doing a Ctrl+Click on the CFC or method name takes you to the CFC or the method code respectively. It also works on the template file in <cfinclude> tag. As for CFCs, it works within createObject(), <cfobject>, <cfinvoke>, new operator, and in 'extends' and 'implements' attributes of cfcomponent. Hyperlinking works with method calls in <cfdump> as well. In addition to these, if you have variables mapping for CFCs in your project, Ctrl+Click-ing on variable_name.CFC_method_name takes you to the method code.

July 22, 2009

Colorization of more than 500 columns in CFBuilder

Some people reported bugs saying CFBuilder does not seem to colorize more than 500 columns. This issue is majorly hit upon by people who have or write single line tag code spanning over many columns. This is not a bug. There is a setting in Preferences to get around this problem.

Go to Window->Preferences->HTML->Editors->Advanced tab->Set 'Maximum no. of columns to colorize' as per your requirement. Hope this helps.

July 23, 2009

Setting Background color for comments

Many of you are used to Dreamweaver style color coding.
Check out a nice blog post by my colleague Sandeep Paliwal on setting back ground color for comments here.

August 1, 2009

Set your preferences

Set your preference to suit your typing needs:

You can turn off auto activation of code assist through Window-Preferences-ColdFusion-Editor Profiles-Editor-Code Assist. This means that code assist will not be invoked automatically. However, you can invoke it by pressing CTRL+SPACE (or appropriate key combination on Mac) whenever you want. Code assist is an expensive operation and you may choose editor not to do it automatically unless invoked.

You can disable auto-insertion of closing tags.
Window-Preferences-ColdFusion-Editor Profile-Editor-Code Assist- "Automatically Insert a Closing Tag". Because looking for the matching end tag on typing '>' for the start tag is also an expensive operation. However, if you type </ and invoke code assist manually (by pressing CTRL+SPACE), it is inserted for you, so you don't have to type closing tag.

Set your preference to reduce CFBuilder launch time:

You may choose to disable building server settings through
Window-Preferences-ColdFusion-Server Settings-Uncheck 'Build Server Settings'. Since ColdFusion Builder uses server settings to provide code assist (for displaying datasources, resolving CFC names etc), you may choose not to initiate build while it starts. Window-Preferences-Server Settings-Check 'Build Server Settings' and Uncheck 'Initiate Build When ColdFusion Builder Started'. You may choose to intiate building server settings when server is started, added or refreshed.


Enable word wrap

CFBuilder does not have a context sensitive word wrap functionality as of now. To have soft word wrap working for cfml and html files, there's an eclipse plugin available.

1. Help > Software Updates > Available Software tab -> Add Site
2. Enter the url - http://ahtik.com/eclipse-update/
3. Install
4. Restart CFBuilder
5. Open a cfm or html file.
6. On right-click, you'll see a context sensitive menu 'Virtual Word Wrap'.

Hope this helps.

October 19, 2009

SQL colorization

Did you know that you can colorize your SQL inside <cfquery> now? You can colorize SQL keywords, comments, and text within the cfquery tag. And yes, you can set your SQL colorization preferences through Window->Preferences->ColdFusion->Editor Profiles->Editor->Colors->Tokens->SQL. Hope this helps in resolving the issue of SQL code not standing out in your CFML code.

SQL Editor

With this release we give you a brand new SQL editor which is integrated into the CFML editor. The SQL Editor supports code assist and code colorization for the following types of SQL statements:


  • Select

  • Insert

  • Update

  • Delete


Also, note that for SQL statements within the cfquery tag, code assist is available in the CFML editor itself. You need not open the SQL Editor for code completion hints. In order to get code assist in the main editor or the SQL editor, you must have a server configured, running and associated with your project in ColdFusion Builder. The SQL editor does not support offline databases. I shall write more about the type of SQL code assist available in subsequent posts.

October 21, 2009

CFBuilder(CFB) performance

This is the key area we are trying to focus on for our next release. We had done considerable work on performance improvements for the previous Beta. But, we do understand that there is scope of improvement. We have gathered a mixed feedback from various forums, surveys, interaction in conferences, bugs reported etc, whereby we found that some users see the improvements whereas some still face serious issues with performance. For example, many of you reported issues with editor once you upgraded to Snow Leopard. There are many editor issues discussed like the ones on Snow Leopard, editing being slow even with small files, huge startup time, CFB becoming unusable, unstable build, system slowing down on using CFB etc, the repro cases for which are not straightforward. We do not hit upon them when we try out the reported cases here. The issues users face could be due to various reasons like improper installation, jvm.config tuning, server settings collection, system environment etc. So, we need more help and specific inputs from you in order to know what exactly is going wrong when user is trying to do a particular operation in CFB.

If you have been facing any of the issues mentioned above or something even remotely similar to them, please take the stack trace using the handy tool at
http://www.adaptj.com/main/download

All you need to do is to select the CFBuilder process id from the current list of processes and get the thread dump.

The tool is free if you use Java Web Start to download it. And works on MAC, Linux & Windows.

I urge each one of you who are facing or have already reported any of these issues to please use the tool and send us the thread dump as soon as you hit upon them. You can email it to me directly at dsarkar@adobe.com with a crisp description of the issue. Users on Snow Leopard who have reported that they find CFB unstable on this platform, please send us the details as and when you face them using this tool. This will help us to resolve your painpoints.

For free evaluation license, Go to Help->License, pick up the System Id from there. Then register yourself and provide the System ID. You will get an evaluation license with expiry date through email.

October 26, 2009

SQL editor & SQL code assist

Open SQL Editor:

You can right-click in the CFML editor, and select SQL Editor.

Or, you can use the keyboard shortcut Ctrl+Alt+S (Windows) or Command_Alt+S (Mac OS).

Using SQL Editor to write and edit SQL statements:

In the SQL Editor, select a server from the Server drop-down list and a database from the Datasources drop-down list.

Enter the SQL statement and click OK. The SQL statement is inserted in the CFML editor at the current caret position.

You can also copy SQL code blocks from the SQL Editor directly into the CFML editor by selecting the code block and pressing Shift+Enter.

To edit a SQL code block in the CFML editor, select the code block, right-click, and select SQL Editor. The selected code block appears in the SQL Editor.

Code Assist for SQL statements:

Code Assist is available only for database table names and field names in the SQL statement.

For code hints to appear, begin entering the SQL statement in the SQL editor, and press Ctrl+<Space> to display the database table names or field names.

Navigate through the list of table names or field names using the Up Arrow and Down Arrow keys.

Select a table name or field name and press Enter. The selected table or field is added to the SQL statement.

About Editor

This page contains an archive of all entries posted to CFBuilder in the Editor category. They are listed from oldest to newest.

Extensions is the next category.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 4.261