Monday 28 September 2009

Snippets in CFEclipse

Found this on Ray's site where Bob wrote it in his comments to one article, thanks Bob (article)

Snippets in CFEclipse

Set directory in Eclipse: Window > Preferences > CFEclipse > alter File Paths To Snippets Directory

To create a snippet in Eclipse, open Snip Tree View (Window > Show View > Snip Tree View). Click the + icon to add a new snippet. 'Insert' inserts the current snippet into your CF document.

Each snippet comprises one XML file, for example here's a basic CFQUERY for a SELECT:

<code>
<?xml version="1.0" encoding="utf-8"?>
<snippet>
<name>select</name>
<help>select</help>
<starttext><!--[CDATA[
SELECT
FROM
WHERE
</cfquery>]]--></starttext>
<endtext><!--[CDATA[]]--></endtext>
</snippet>
</code>

If you're working in a team environment, you could point everyone's snippet file path to the same network directory in order to share snippets.

PS: remove <code> </code> before pasting in Eclipse

No comments: