ColdFusion Builder: CF Variable Mappings, code assist, and linked folders

I was poking around ColdFusion Builder today, trying to get objects from my common library to display the code assist (aka code hints) popup. As described in various blogs (I read this one and this one) as well as in the CFB help files, you simply go into your project’s Properties > ColdFusion Variable Mappings section, add the variable name alias and the “fully qualified” cf dot-notated path to the object.

Well darn it all, it doesn’t always work, does it?  It turns out that “fully qualified” really means relative-to-your-project, not the webroot. So because my common folder resides in the filesystem outside of my TestProject folder, CFB can’t find it and won’t display code hints.

After posting a comment to this effect one one of the above blogs, I remembered folder linking from Flex, and lo and behold, it works lovely for ColdFusion variable mappings! So here’s how to do it.

Step 1: create a new folder in your project

Step 2: Click the advanced button, and check “Link to folder in the file system”

Step 3: See that variables button? Click it

Variables? It turns out Eclipse supports path variables, which can be used as shortcuts in path names. A prime opportunity to map the web root to a variable since it’ll be used a lot: here you see I am mapping my J2EE webroot folder to “www”:

Click OK a couple times to get back to the new folder window from step 2.

Step 4: create your linked folder

Now you want to enter the path to your external code directory (using the path variable you just created), and optionally modify the folder name:

Click finish and voila! You have a linked directory inside your project:

The linked directory is now available for CFB to use when resolving ColdFusion Variable Mappings settings. Remember that first screenshot where I created the udf variable mapping? Let’s test it out now:

Excellent!! Just what the doctor ordered. Happy coding!

This entry was posted in ColdFusion, ColdFusion Builder and tagged , , . Bookmark the permalink.

3 Responses to ColdFusion Builder: CF Variable Mappings, code assist, and linked folders

  1. Brad Wood says:

    Thanks for the post. Do you know if CFB uses your ColdFusion’s server mappings to resolve the paths? I kind of figured it would since I’m running a local server and have it added to Builder’s “Servers” tab, but apparently it isn’t that smart…

    • darrentcook says:

      Hi Brad. Just seeing this…I’ve been neglecting my blog it seems. That would make sense, and perhaps that will come in a new version of CFB (maybe you can file that as a requested enhancement?). But I haven’t noticed that it works in 1.0 either. Honestly I haven’t tried to figure out if it could…. the current projects I’m on are written in a style where code hinting isn’t very useful so I haven’t had time or necessity to play with this idea. If you ever figure something out do be kind enough to post a follow up here (if you remember)!

  2. Brad Wood says:

    @Darren: Right now I’ve been getting along pretty good with the solution you showed of creating a linked folder in the root of my project. I think the issue is that CFB assumes that the root of my project is also the root of my website, but that is not the case for me since I have three different sites and a collection of shared “common” folders in my project root. The only issue with the linked folder approach that I have found is when I hover over a variable that represents a CFC instance, and control-click it to open that file, I get a “select workspace file” popup that asks me which file I want because there two paths that lead to it. Builder doesn’t realize it’s the same file. Does that make sense?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s