I have been using cfeclipse now for a couple of months, in case you dont know what CFEclipse is you should check out http://cfeclipse.tigris.org/, it is basically a plugin to Eclipse (java editor extraordinaire) that allows you and helps you in most wonderful ways to do your ColdFusion coding! I have switched to it and sometimes even try to contribute to its development a little and now find it really hard to go back to Homesite, CFStudio or Dreamweaver (Textpad will always be there like my lucky pair of underpants tho!). I thought I would add some hints and tips on how to get using it even more efficiently Snippets WE all have snippets in different environments, these are bits of code we re-use, such as creating a 2 column table or the header of an html file for example. CFEclipse has snippets on steroids. They are the real killer addition to this IDE. I shall use an example that I use every day to show how powerful they are, that is of adding fusedocs to my documents. Switch on the Snip Tree View (Window-> Show View -> Snip Tree View) and add a new snippet by clicking on the blue cross. You will be prompted with a dialog, enter the following:
- Snippet Name: fusedoc
- Trigger text: fusedoc
- Snippet Description: This snippet inserts a skeleton fusedoc
- Snippet Starting Block:
<fusedoc fuse="_____">
<responsibilities></responsibilities>
<properties>
<history type="____" date="____" author="_____">
</properties>
</fusedoc> - Snippet Closing lock: (leave this blank)
Now click OK. you have made your first snippet! well done!
To insert this snippet into your code you can either double click it from the snip tree view or could (my favourite!) type fusedoc folowed by the CTRL+i command
Thats good, but all is not over yet! this is all fine and dandy but in the fuse="" I usually insert the filename, which is a drag to type it all the time by going back to the code that I inserted, so what you can do is to edit the snippet by right clicking on it and editing it so it says the following:
Now save it and try adding the snippet again, you should get a dialog where you can enter your fuse name! Great isnt it? but wait! there is more! Change the \(\{fuse}</strong> to <strong>$\{fuse:myfuse}</strong> and you should have "myfuse" already entered in the dialog box as default, fantastic! I could do that for my name... or... I could enter a dynamic variable. Try adding the following: <strong>\){fuse:$${CURRENTFILE}}, this will make the dialog box default to the current filename! In the same manner you can add other variables as shown below:
<responsibilities>$$\{responsibilities}</responsibilities>
<properties>
<history type="$$\{action:create}" date="$$\{date:$$\{DAYOFMONTH} $$\{MONTHNUMBER} $$\{YEAR}}" author="$$\{author:$$\{USERNAME}}" />
</properties>
</fusedoc>
The other variables that you can use are:
$$\{DATE}
$$\{MONTH}
$$\{TIME}
$$\{DATETIME}
$$\{DAYOFWEEK}
$$\{CURRENTFILE} - Current file name (just the file)
$$\{CURRENTFOLDER} - Current folder (The path to the containing folder)
$$\{CURRENTPATH} - Current path (full file name)
$$\{CURRENTPRJPATH} - Just the folder
$$\{USERNAME} - Current user
$$\{MONTHNUMBER} - Month as a number
$$\{DAYOFMONTH} - Day of month as a number
$$\{DAYOFWEEKNUMBER} - Day of week (the week starts on Sunday)
$$\{DATETIME24} - DateTime24 - a 24 hour clock version of datetime.
$$\{YEAR} - Current year.
$$\{YEAR2DIGIT} - Current two digit year.
I have found myself using a lot more snippets and if you change the Key combination to Ctrl+ space it is consistent with the rest of the code highlight and completion in the IDE (to do this go to Window-> Prefrences -> Workbench -> Keys and select Command Category:CFML Editor, Name:Insert Snippet, then under Key Sequence Name: click Ctrl+space and click add) If you are using CFEclipse, let me know and send me any other tips that you would like to share!
Tweet
comments powered by Disqus