Search code examples
javascriptphpcode-snippetsace-editor

Ace snippet codecomplation use square bracket


My question is: is anyone know how to add ACE snippet file row which contain square brackets? I add it as a normal syntax but unfortunately the code completation can not find that row(s) which contain square brackets.

Example:

VARIABLE['KEY_ONE']['KEY_TWO']

If user start to wirte in snipet editor on webpage and write: VAR... I would like offer some selectable values like the example above.

Can anybody help to solve this problem? I already tried to protect square brackets:

VARIABLE\['KEY_ONE'\]\['KEY_TQO'\]

...or duplicate brackets:

VARIABLE[['KEY_ONE']][['KEY_TQO']]

...but both of that do not work :(


Solution

  • ace uses textmate snippet format, so [ doesn't have any special meaning. if you add:

    snippet VAR
        VARIABLE['KEY_ONE']['KEY_TWO']
    

    that is snippet VAR\n\tVARIABLE['KEY_ONE']['KEY_TWO'] it should work.