Code Snippets

siegi44 edited this page May 18, 2012 · 1 revision

All snippet markup is enclosed by ${ and }. You can use the following list of markup in Code Snippets:

  • ${name} is a simple element. The text "name" is inserted at any marked location with the same name. At first insertion point the text can be edited by the user. All other locations where the element is referenced are synchronized.
  • ${type=int} is an element with the name "type" and the text "int". The text is inserted at all marked locations. The name is used to identify the locations.
  • ${Caret} moves the caret to the specified location, after snippet insertion is completed. If ${Caret} is not specified in the snippet, the caret is moved to the end of the snippet.
  • ${Selection} inserts the previously selected text at the specified location. It behaves the same as ${Caret} if nothing was selected. If ${Caret} and ${Selection} the latter has higher priority.
  • ${ClassName} inserts the name of the surrounding class.
  • ${function(argument)} inserts the result of a function. Text or the name of another snippet element can be passed to the function as argument. Currently the following functions are supported:
    • toUpper
    • toLower
    • toFieldName
    • toPropertyName
    • toParameterName (The last three return the text language-specific.)
  • It is also possible to insert pre-defined variables and texts such as:
    • DATE
    • TIME
    • USER
    • GUID (inserts a new GUID)
    • PRODUCTNAME
    • VERSION

For more information see StringParser.cs, line 141ff.