Skip to content

Instantly share code, notes, and snippets.

@arusahni
Forked from lencioni/javascript.snippets
Last active October 2, 2015 20:36
Show Gist options
  • Select an option

  • Save arusahni/fd29be9aeaafe6a9e430 to your computer and use it in GitHub Desktop.

Select an option

Save arusahni/fd29be9aeaafe6a9e430 to your computer and use it in GitHub Desktop.

Revisions

  1. arusahni revised this gist Nov 22, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion javascript.snippets
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ def formatTag(argument):
    tags = [formatTag(argument.strip()) for argument in t[2].split(',') if argument]
    if tags:
    snip.rv = "/**{0} */ ".format("".join(tags))
    snip.rv = "/**{0} */".format("".join(tags))
    else:
    snip.rv = ''
    `${1}: function(${2}) {
  2. arusahni revised this gist Nov 22, 2014. 1 changed file with 3 additions and 9 deletions.
    12 changes: 3 additions & 9 deletions javascript.snippets
    Original file line number Diff line number Diff line change
    @@ -5,16 +5,10 @@ snippet fun "function with dynamic docblock" b
    def formatTag(argument):
    return " * @param {{}} {0}".format(argument)
    arguments = t[2].split(',')
    arguments = [argument.strip() for argument in arguments if argument]
    tags = [formatTag(argument.strip()) for argument in t[2].split(',') if argument]
    if len(arguments):
    tags = map(formatTag, arguments)
    snip.rv = "/**"
    for tag in tags:
    snip += tag
    snip += ' */'
    snip += ''
    if tags:
    snip.rv = "/**{0} */ ".format("".join(tags))
    else:
    snip.rv = ''
    `${1}: function(${2}) {
  3. @lencioni lencioni created this gist Nov 15, 2014.
    23 changes: 23 additions & 0 deletions javascript.snippets
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    snippet fun "function with dynamic docblock" b
    `!p
    # Currently Ultisnips does not support dynamic tabstops, so we cannot add
    # tabstops to the datatype for these param tags until that feature is added.
    def formatTag(argument):
    return " * @param {{}} {0}".format(argument)
    arguments = t[2].split(',')
    arguments = [argument.strip() for argument in arguments if argument]
    if len(arguments):
    tags = map(formatTag, arguments)
    snip.rv = "/**"
    for tag in tags:
    snip += tag
    snip += ' */'
    snip += ''
    else:
    snip.rv = ''
    `${1}: function(${2}) {
    ${0:${VISUAL}}
    },
    endsnippet