How to Enable Code Snippets
Add .appclw and .APPCLW (no “*” in front of it) to the list in the Code Snippets setup. This tells the IDE to show snippets in the code completion list for the embed editor and the embeditor.
In my IDE I have this set of extensions for Clarion snippets:
1 |
.clw;.CLW;.appclw;.APPCLW |
Using Code Snippets
If you are in the “Embed Editor” then the Ctrl+J shortcut will bring up the snippets list. If you are in the Embeditor then Ctrl+J takes you to the “next filled embed” until you get to the last one and then Ctrl+J pops up the snippets.
The Clarion Binding in the IDE also includes an option to show the snippets, or not, in the normal Code Completion list:
Power User Hint
In my testing Ctrl+J for snippets works fine in the “Embed Editor” but when you are in the “Embeditor” (source view) Ctrl+J is assigned to “next filled embed”. However, snippets do appear in the standard code completion list ( Ctrl+Space ) and additionally, if you hit Ctrl+J enough times to get to the last “filled embed” then the snippets will popup after you get to the last one 😀
Of course you could use my KeyboardShortcuts addin to alter the assigned Ctrl+J keystroke on “next filled embed” which then allows Ctrl+J to popup the snippets list from the embeditor (the hardest part is finding an available shortcut to replace Ctrl+J) !
Additional Notes
One of the features in the EditorExtras addin is additional macros to popup a dialog so you can enter text that will be used in the snippet.
${PROMPT} – will popup a dialog and will be replaced with the entered value
${PROMPT_VALUE} – can be used within the same snippet multiple times and will be replaced with the value already entered.
Head on over to the product page for more details or dive straight into a short video demonstration!
Available Macros – Examples
Hint: Copy the example text below into a snippet and test it yourself!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
! ====================== ! Standard properties ! ====================== ! Using ResourceService (this means anything found via the ResourceService.GetString() class) ${res:MainWindow.Windows.TaskList} ! Date/Time ${DATE} ${TIME} ! ProductName ${ProductName} ! Guid ${GUID} ! User ${USER} ! Version ${Version} ! Platform ${Platform} ! Get an ADDIN Path (This can refer to any addin "identity" e.g. SharpDevelop) ${ADDINPATH:SharpDevelop} ! Using the ENV prefix (This will search for a match using System.Environment.GetEnvironmentVariable(string) e.g. WinDir) ${ENV:WinDir} ! Using the PROPERTY prefix (This can be used to find values in the properties file e.g. UILanguage) ${PROPERTY:CoreProperties.UILanguage} The following is the description from the #develop source: /// <summary> /// Allow special syntax to retrieve property values: /// ${property:PropertyName} /// ${property:PropertyName??DefaultValue} /// ${property:ContainerName/PropertyName} /// ${property:ContainerName/PropertyName??DefaultValue} /// A container is a Properties instance stored in the PropertyService. This is /// used by many AddIns to group all their properties into one container. /// </summary> ! ====================== ! Additional items provided by a built in custom "StringTagProvider" ! ====================== ! ItemPath ${ItemPath} ! ItemDir ${ItemDir} ! ItemFilename ${ItemFilename} ! ItemExt ${ItemExt} ! TargetPath ${TargetPath} ! TargetDir ${TargetDir} ! TargetName ${TargetName} ! TargetExt ${TargetExt} ! CurrentProjectName ${CurrentProjectName} ! ProjectDir ${ProjectDir} ! ProjectFilename ${ProjectFilename} ! CombineDir ${CombineDir} ! CombineFilename ${CombineFilename} ! Startuppath ${Startuppath} ! TaskService.Warnings ${TaskService.Warnings} ! TaskService.Errors ${TaskService.Errors} ! TaskService.Messages ${TaskService.Messages} |
Comments: 1