In my last blog entry, I talked about how you can use ColdFusion Builder to perform code refactoring - essentially - supporting the updating of your APIs through the rest of your code base. You change some method from doX to performX, and ColdFusion Builder can help you update any scripts that make use of that code. Today I'm going to talk about the obvious related feature to this - references.
In order to perform any refactoring, ColdFusionBuilder first has to actually find the stuff that needs updating. There are a few ways you can make use of this feature. First - you can right click on a file in your Navigator view. Unfortunately you can only do this for CFM and CFCs, and not JavaScript or CSS files. In my first test, I simply ran a references report on my layout custom tag for BlogCFC:
Is this isemail test?
CFBuilder wasn't fooled by this. Nice! Now the next thing impressed me even more. I changed my template to this:
Is this isemail test?
no test case #ISEMAIL()# dude
Once again, CFBuilder didn't find the call. Can you guess why? No cfoutput! As soon as I wrapped the line in cfoutput tags, CFBuilder found it. On the flip side, when I tried this template:
Is this isemail test?
no test case #ISEMAIL()# dude
<cfset foo = isEmaiL()>
CFBuilder still found it. All in all, pretty impressive. While refactoring makes me nervous (warranted or not), I can see using the references feature quite a bit!
Archived Comments
I didn't even know this was possible with cfBuilder. I"ll have to give it a try. I'm a big believer in giving variables and functions meaningful names. This would help a lot in doing that both for new code and old.
It doesn't work on method calls by cfinvoke
I just stumbled upon this article and was happily surprised to discover the reason behind that "References" menu item on the CFB context menu. I had never bothered to click on it in all the years I've been using ColdFusion Builder.
In my CFB 2.0, I decided to try it out. I right clicked the first file I saw in my clients project, chose project (vs. workspace), and....it ran. and ran. and ran. and then it killed ColdFusion Builder.
First time I've ever seen CFB die like that.
I re-started CFB, chose a different file, and this time it gave me an error with the message "An internal error occurred during: "Finding references ...".
java.lang.NullPointerException".
I am rather dissapointed.
Randy, best I can recommend is a) ensuring you are on the latest (which I think is 2.0.1?) and filing a bug report for what you saw. I don't use CFB myself anymore.
Ray, thanks. It looks like I am on the latest:
Version: 2.0.1
Build: 283931
but I will check for updates anyway.
What are you using for an IDE these days for ColdFusion?
RLS
Sublime Text 2 with the CFML plugin.