Create Your Own Snippets

Create Your Own Snippets

Create Your Own Snippets

Arc's built-in snippet library is just the starting point. You can create your own snippets in .hjson format and they will appear in the auto-complete panel alongside the built-in ones.


Snippet File Location

Custom snippets are stored in the Arc/snippets/ folder:

Arc/snippets/ process/ default.hjson ← Built-in process snippets (do not edit) my-snippets.hjson ← Your custom snippets rules/ default.hjson ← Built-in rules snippets

Step 1: Create Your Snippet File

Create a new .hjson file in the appropriate folder (e.g. Arc/snippets/process/my-snippets.hjson). You can copy a snippet from default.hjson as a template:

[ { value: @My Custom Snippet snippet: ''' # My custom code here If(vMyCondition = 1); # Do something EndIf; ''' } ]

Fields:

  • value — What you see in the auto-complete list (prefix with @ for easy filtering)

  • snippet — The code that gets inserted


Step 2: Refresh Arc

After saving your file, refresh the browser (SHIFT+F5 to clear the cache). Your new snippets will appear in the auto-complete list — type @my to filter to your custom ones.


Using Placeholders

Placeholders allow users to tab through editable positions in the inserted code:

{ value: @My If Block snippet: ''' If(${1:condition}); ${2:# code here} EndIf; ''' }
  • ${1:condition} — First tab stop, with default text "condition"

  • ${2:# code here} — Second tab stop

Linked placeholders: Use the same number for placeholders that should stay in sync:

{ value: @My Hierarchy Create or Unwind snippet: ''' If(HierarchyExists(${1:sDim}, ${2:sHierarchy}) = 0); HierarchyCreate(${1:sDim}, ${2:sHierarchy}); Else; ExecuteProcess('}bedrock.hier.unwind', 'pDim', ${1:sDim}, 'pHier', ${2:sHierarchy}); EndIf; ''' }

Here, all ${1:sDim} placeholders update simultaneously when you tab to the first position.


Tips

  • Snippet files support comments — prefix a line with // in hjson.

  • The .hjson format is more readable than JSON — you can paste multi-line code without escaping newlines.

  • You don't need to restart Arc — just save the file and refresh the browser.


Related Pages