CFEclipse tips and tricks
- 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} to $\{fuse:myfuse} 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: $$\{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!