Difference between revisions of "Snippets"
(Rework some of the docs to make it a bit more logical) |
Starbuck5250 (talk | contribs) (+description of snippets) |
||
Line 3: | Line 3: | ||
==SNIPPETS== | ==SNIPPETS== | ||
+ | A snippet is a sort of code template or skeleton that allows you to quickly set up a commonly used code fragment like a subprocedure definition (in ILE [[RPG]]). This differs from code [[template]]s because the code template is invoked by the code completion facility {{keypress|Ctrl|Space}}. Code completion with templates requires you to start keying the 'trigger' (in RPG, usually the operation code.) With snippets, you can have [[WDSC_LPEX|Lpex]] include anything at all, with no trigger needed aside from the double click on the selected snippet. | ||
Revision as of 15:16, 8 April 2008
Contents
SNIPPETS
A snippet is a sort of code template or skeleton that allows you to quickly set up a commonly used code fragment like a subprocedure definition (in ILE RPG). This differs from code templates because the code template is invoked by the code completion facility Ctrl+Space. Code completion with templates requires you to start keying the 'trigger' (in RPG, usually the operation code.) With snippets, you can have Lpex include anything at all, with no trigger needed aside from the double click on the selected snippet.
Snippets View
original post [1]
To open a snippets view:
- Window -> Show view -> Other -> Basic -> Snippets
Return to #TOP
Create a Snippets Category
original post [2]
- You only need to create a Category once, conceptually its like CRTSRCPF.
- Create as many Categories as you wish.
- -Right-click in the Snippets view and select Customize...
- -Click the New button and create a New Category
- -Click the New button and create a New Item
- -Click on the snippet and then click the New button that is adjacent to the Variables list
- -Enter your snippet and use the Insert Variable Placeholder button to add the variable
alternatively use the copy, right click process below, its easier.
Use snippets for RPGLE, CLLE, DSPF and PRTF source members.
Return to #TOP
Snippets RPG
original post [3]
You can use the snippets to insert stuff into your program.
To create your own RPG snippets,
- you can open the view in RSE or iSeries Editing perspective,
- select your source,
- and right click / Past in the snippets view, into your Previously created Category.
It will then create a new template.
To use the snippet;
- Open a source member for editing.
- Place the cursor where you want the code.
- Go to the Snippets view, to the Category where the snippet is.
- Double click on the snippet and it appears in the source
original post [4]
Another method is to create a Snippet.
- Open the Snippets view.
- Create a new 'Drawer' for your snippets.
- Copy some source.
- Right-click in your snippet drawer, paste.
- This will bring up the snippet creation wizard.
Return to #TOP
External links
The official WDSC web page [5]
The WDSC Developer blog [6]
WDSC tags on del.ici.ous [7]