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.
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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With