Add a Code Snippet

Overview

Use code snippets to extend functionality in Forms. Sequence provides pre-configured snippets.

When you create a snippet file, you can create on file for each snippet, or a file that contains multiple snippets.

Sequence snippets support the following languages:

  • HTML
  • JavaScript
  • CSS

Note: Sequence supports Visual Studio snippets.

Snippet Tokens

Sequence provides two built-in tokens.

  • $selected$: represents text selected in the document that is inserted into the snippet when invoked.
  • $end$: the cursor's location after you insert the code snippet.

Procedure

  1. Create a snippet file with a .sqsnippet extension.
    Example: alert.sqsnippet
  2. Copy the snippet file to ~/Shared Resources/Components/Forms/Snippets/SnippetLanguage.
    You can create an additional directory. This directory appears as a node in the tree in the snippets wizard.
  3. Recycle the Administration site Application Pool for the changes to be implemented.

Single Snippet Example

<CodeSnippet xmlns="http://schemas.pnmsoft.com/sequence/2014/10/codeeditor/snippets">
  <Title>do</Title>
  <Language>javascript</Language>
  <Author>PNMsoft</Author>
  <Description>Code snippet for a do...while loop</Description>
  <Shortcut>do</Shortcut>
  <Code>
    <![CDATA[do {
    $selected$$end$
} while ($expression$);]]>
  </Code>
</CodeSnippet>

Multiple Snippets Example

<CodeSnippets xmlns="http://schemas.pnmsoft.com/sequence/2014/10/codeeditor/snippets">
<CodeSnippet>
…
    </CodeSnippet>
    </CodeSnippets>


About this Article
  • Created: 05/07/2017 2:30 pm EDT
  • Last updated: 05/15/2017 9:28 am EDT
In This Article