Skip to main content

Quick Fix in ColdFusion Builder

Quick Fix is another interesting feature introduced in ColdFusion Builder 2.0. The CFML Editor now provides corrections to the problems found in the file that you are editing. The Editor tries to resolve the CFCs specified at various places i.e. in createObject function, the new operator or the ones specified in the tags cfinvoke\cfobject. The Editor also tries to resolve the functions using CFC introspection. Now if you have declared a CFC or a function which doesn't exist, then the CFML Editor instead of showing an error in document provides Quick Fix suggestions.

Quick fix suggestions for components:

As shown in picture above, the CFML Editor was not able to resolve the component 'Component1' and instead of showing an error, the Editor has shown a yellow marker indicating that a quick fix suggestion is available. On clicking the yellow marker, a list containing suggestions are shown.
On selecting the first suggestion, the component will be created in the same directory as the cfm file. The user need not invoke the New CFC wizard. Instead, the IDE will create the component on users' behalf. 
On selecting the second option, the component would be created right under the webroot of the associated server. If the server is not associated with the project, then this suggestion would not be shown.
The third option would create the component in a directory location specified by the user.

Similarly quick fix suggestions would be shown for the tags cfinvoke and cfobject. Quick fix suggestions are also shown if the Editor is not able to resolve the components mentioned as attribute values to extends or implements in a cfcomponent tag.

Quick fix suggestions for functions:

Quick fix suggestions are also provided for functions which are not defined. Taking the above example, once the component is created and when you try to invoke a function which doesn't exist, then the quick fix will suggest you to create a function. 

On accepting the suggestion, the function would be created in Component1. 

If one invokes a function with arguments, then the cffunction with arguments would be created. Say if I invoke a function with two arguments 'arg1' and 'arg2' which are of type numeric and string respectively, then a cffunction would be created with two arguments and the type of those arguments will be numeric and string.   That is, arguments will be of the same type as the parameters passed to the function.
How cool is that... 

If you are writing a script style code, then the component or the function would be created in script style syntax.


  1. It doesn't look like QuickFix can find a function defined in a file that is extended by the Application.cfc (extends a framework.cfc)

  2. Can you explain with an example? Do you mean if a function in Application.cfc say onRequest invokes a function in the parent cfc, the editor shows quick fix for that?

  3. It sounds like Anonymous has run into one of the bugs I logged:

    Essentially, it only works if the text-case you use in your Extends attribute exactly matches the case you find in CFB's Services browser (and the physical file system)

    So if the extends attribute is: extends="my.framework" but the file system is my/Framework.cfc, then QuickFix doesn't recognize the match. If you change your extends attribute to my.Framework, then it works as expected.

    Vote for the bug! ;)

  4. Personally, I find this feature pretty useless and, therefore, I keep it disabled when loading a lib file using dynamic path, e.g. 'cfinclude template="#p_cf_tags#/cf_lib.cfm"'

  5. @Edy,

    Dynamic path is not supported since the IDE cannot know the value of it.

  6. @Sagar,

    Indeed, that's the reason that forces me to disable the Quick Fix.


Post a Comment

Popular posts from this blog

Custom validation messages for HTML5 Input elements using the constraint validation API


De-obfuscating javascript code in Chrome Developer Tools


What is Minification?


Adding beforeRender and afterRender functions to a Backbone View
