User-Defined Snippets

Hi,

Within ARC, you have snippets which are pre-built blocks of code which can be inserted into our TI processes. Is there a way to define our own snippets so that they appear in the list? I thought I had seen that, and the splash page for ARC does talk about “user-defined snippets”, but for the life of me I can’t figure out how to do it. Am I missing a button, or a file behind the scenes?

Thanks,
Jeff

Hi @jeffrey.williamson,

To create your own snippets create a folder called snippets in the Arc folder and then create a file processes.json.

The snippets file needs to be in JSON format, the value is what you see in auto complete and snippet is the content inserted. The placeholders are used to update blocks of code, example: ${1:condition}. If you want code to be updated in multiple locations use the same placeholder number.

[
  {
      "value": "SNIPPET: If ElseIf Else",
      "snippet": "If(${1:condition});\n\t${2:consequent}\nElseIf(${3:condition});\n\t${4:consequent}\nElse;\n\t${5:alternative}\nEndIf;\n"
  },
  {
      "value": "SNIPPET: If...Else",
      "snippet": "If(${1:condition});\n\t\nElse;\n\t\nEndIf;\n"
  }
]

If somebody wants to create a snippet with complex code or lots of special characters, I just used this site to convert the desired code to a “escaped” string for json:

https://www.freeformatter.com/json-escape.html

1 Like

Hi @jpaulo,

V1.7.0 will make this a lot easier, we are including a format called hjson that allows normal line breaks for snippets and templates.

1 Like