Using Code Snippets
The Code Snippets feature offers a quick way to store and re-use code. In the Snippets pane of the Resources tab in ColdFusion Studio, you can create and store snippets for your own use, and share code snippets with other developers.
The first procedure creates a code snippet that helps you quickly enclose ColdFusion variables or other parameters in pound signs.
To create and use code snippets:
- Open the Snippets pane of Resource tab, right-click and choose Create Folder.
- Provide a name for the snippets folder, for example, MySnippets.
- Right-click in the Snippets pane and choose Add Snippet. The Snippet dialog box appears, with windows for you to enter Start Text and End Text.
- Enter a name for the code snippet, for example, PoundSigns.
Note that snippet names cannot contain characters that are illegal in file names,
such as slashes, special characters, double quotes, etc.
- In the Start Text window, enter the beginning of your snippet, for example, #.
- In the End Text window, enter the ending text, for example, #. Click OK
- Select a variable or expression in your CFML code and double-check the Pound Signs snippet to enclose the selected text in pound signs.
Right-click on a snippet to edit or delete it.
Shared Snippets
You can share code snippets with other developers on your network.
To create shared snippets:
- Choose Options > Settings or press F8 to open the Settings dialog box.
- In the File Locations pane, choose a folder for Shared Snippets.
- Use the Browse button to navigate to your ColdFusion Studio installation,
\UserData\Snippets
folder and choose a Snippets folder to share.
- In the Snippets pane of the Resource tab, right-click and choose Create Shared Folder. The folder icon changes color to show it's shared.
AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.