-
Notifications
You must be signed in to change notification settings - Fork 1
Snippets Markers
Snippet markers are those comments that are replaced by your snippet code.
They have this structure:
--@<snippet-name>{#<arg-name> = <arg-value>}
-- Example:
--@foo{#hi=1}You can type an @ to get a list of all your snippets next to a small floating comment in your editor script
The delimiter “#” is used to indicate that the text you are typing is a variable, it must be followed by an “=” next to a value.
--@foo{#hi=2}With multiple variables (separed by spaces):
--@foo{#hi=2 #bye=4}Snippets may or may not have arguments in their marker. The arguments of a snippets must be passed inside the {} of the marker, the space between the sarguments does not matter, they will not be taken into account, so you can do this:
--@foo{ #e = 3 #b = 'hi' }But it's not recommended, you should always do this:
--@foo{#e=3 #b='hi'}Marker arguments can handle any datatypes, you can use functions call, dicts, tables, strings, ect.
Example:
--@foo{#x={b=4,c=4} #emoji=🎶 #string='hi'}- Never use double quotes to set string arguments, use single quotes
--@foo{#x="hi"} -- BAD
--@foo{#x='hi'} -- GOOD- Don't add spaces between the snippet marker (only to separate arguments)
--@ foo { #x = 1 } -- BAD
--@foo{#x = 1} -- BAD
--@foo{#x=1} -- GOOD