Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ColdFusion IDE equivalent to Visual Studio's "go to definition" and "find usages"

Do any of the ColdFusion IDEs/IDE plugins allow you to perform actions similar to Visual Studio's go to definition and find usages (some details of which are on this page)?

For example, in one .cfc file I might have:

<cfset variables.fooResult = CreateObject(
    "component",
    "Components.com.company.myClass").fooMethod()>

And in myClass.cfc I have:

<cffunction name="fooMethod" access="public">
    <!-- function body -->
</cffunction>

If I have my cursor set over .fooMethod in the first file, a go to definition action should place me on the declaration of that method in myClass.cfc.

At present I'm using the CFEclipse plugin for Eclipse to view some legacy ColdFusion.

like image 520
Richard Ev Avatar asked Sep 09 '13 15:09

Richard Ev


1 Answers

CFEclipse doesn't have this functionality, partly because CFML is a dynamic language with a fair bit of complexity parsing-wise.

You can use regex searching to get you most of the way there in most cases.

Function Definitions

To find a function definition, most times searching for...

(name="|ion )methodname

...is enough, and quicker than the more thorough form of:

(<cffunction\s+name\s*=\s*['"]|\bfunction\s+)methodname

Function Calls

To find a function call, against just do:

methodname\s*\(

Though against you might need to be more thorough, with:

['"]methodname['"]\s*\]\s*\(

...if bracket notation has been used.

You might also want to check for cfinvoke usage:

<cfinvoke[^>]+?method\s*=\s*['"]methodname

Of course, neither of these methods will find if you have code that is:

<cfset meth = "methodname" />
<cfinvoke ... method="#meth#" />

...nor any other form of dynamic method names.


If you really need to be thorough and find all instances, it's probably best to search for the method name alone (or wrapped as \bmethodname\b), and manually walk through the code for any variables using it.

like image 180
Peter Boughton Avatar answered Sep 22 '22 05:09

Peter Boughton