From bdfc4808cc236e923d55475a2d852f65d18d0cfa Mon Sep 17 00:00:00 2001 From: Amit Goldenberg Date: Sat, 7 Nov 2020 10:21:23 +0200 Subject: [PATCH] added typescript script snippet --- snippets/svelte.json | 894 ++++++++++++++++++++----------------------- 1 file changed, 417 insertions(+), 477 deletions(-) diff --git a/snippets/svelte.json b/snippets/svelte.json index 4c58b5a..34bd0c4 100644 --- a/snippets/svelte.json +++ b/snippets/svelte.json @@ -1,478 +1,418 @@ { - "svelte-component-format": { - "prefix": "s-component-format", - "body": [ - "", - "", - "", - "", - "${3:}" - ], - "description": "add a script to your svelte file" - }, - "svelte-script-tag": { - "prefix": "s-script", - "body": [ - "" - ], - "description": "add a script to your svelte file" - }, - "svelte-script-context": { - "prefix": "s-script-context", - "body": [ - "" - ], - "description": "add a script with context=\"module\" to your svelte file" - }, - "svelte-style-tag": { - "prefix": "s-style", - "body": [ - "" - ], - "description": "add styles to your svelte file" - }, - "svelte-expression": { - "prefix": "s-expression", - "body": [ - "{${1:expression}}" - ], - "description": "basic expression" - }, - "svelte-expression-html": { - "prefix": "s-expression-html", - "body": [ - "{@html ${1:expression}}" - ], - "description": "html content expression" - }, - "svelte-expression-debug": { - "prefix": "s-expression-debug", - "body": [ - "{@debug ${1:var1}${2:,var2}}" - ], - "description": "html content expression" - }, - "svelte-if-block": { - "prefix": "s-if-block", - "body": [ - "{#if ${1:condition}}", - "\t${2: }", - "{/if}" - ], - "description": "if block" - }, - "svelte-if-else-block": { - "prefix": "s-if-else-block", - "body": [ - "{#if ${1:condition}}", - "\t${2: }", - "{:else}", - "\t${3: }", - "{/if}" - ], - "description": "if else block" - }, - "svelte-else-block": { - "prefix": "s-else-block", - "body": [ - "{:else}", - "\t${1: }" - ], - "description": "else block" - }, - "svelte-if-else-if-block": { - "prefix": "s-if-else-if-block", - "body": [ - "{#if ${1:condition}}", - "\t${2: }", - "{:else if ${3: otherCondition}}", - "\t${4: }", - "{:else}", - "\t${5: }", - "{/if}" - ], - "description": "if else if block" - }, - "svelte-else-if-block": { - "prefix": "s-else-if-block", - "body": [ - "{:else if ${1: otherCondition}}", - "\t${2: }" - ], - "description": "else if block" - }, - "svelte-each-block": { - "prefix": "s-each-block", - "body": [ - "{#each ${1:items} as ${2:item}}", - "\t${3: }", - "{/each}" - ], - "description": "each block" - }, - "svelte-each-else-block": { - "prefix": "s-each-else-block", - "body": [ - "{#each ${1:items} as ${2:item}}", - "\t${3: }", - "{:else}", - "\t${4: }", - "{/each}" - ], - "description": "each else block" - }, - "svelte-each-index-block": { - "prefix": "s-each-index-block", - "body": [ - "{#each ${1:items} as ${2:item},${3:i}}", - "\t${4: }", - "{/each}" - ], - "description": "each index block" - }, - "svelte-each-key-block": { - "prefix": "s-each-key-block", - "body": [ - "{#each ${1:items} as ${2:item},(${3:key})}", - "\t${4: }", - "{/each}" - ], - "description": "each index block" - }, - "svelte-each-index-key-block": { - "prefix": "s-each-index-key-block", - "body": [ - "{#each ${1:items} as ${2:item},i (${3:key})}", - "\t${4: }", - "{/each}" - ], - "description": "each index key block" - }, - "svelte-await-then-block": { - "prefix": "s-await-then-block", - "body": [ - "{#await ${1:promise}}", - "\t", - "{:then ${2:value}}", - "\t", - "{/await}" - ], - "description": "await then block" - }, - "svelte-then-block": { - "prefix": "s-then-block", - "body": [ - "{:then ${1:value}}", - "\t" - ], - "description": "then block" - }, - "svelte-await-short-block": { - "prefix": "s-await-short-block", - "body": [ - "{#await ${1:promise} then ${2:value}}", - "\t", - "{/await}" - ], - "description": "await short block" - }, - "svelte-await-catch-block": { - "prefix": "s-await-catch-block", - "body": [ - "{#await ${1:promise}}", - "\t", - "{:then ${value}}", - "\t", - "{:catch error}", - "\t", - "{/await}" - ], - "description": "await catch block" - }, - "svelte-catch-block": { - "prefix": "s-catch-block", - "body": [ - "{:catch error}", - "\t" - ], - "description": "catch block" - }, - "svelte-on-event": { - "prefix": "s-on-event", - "body": [ - "on:${1:eventname}={${2:handler}}" - ], - "description": "on event" - }, - "svelte-on-event-forward": { - "prefix": "s-on-event-foward", - "body": [ - "on:${1:eventname}" - ], - "description": "on event foward" - }, - "svelte-on-event-modifiers": { - "prefix": "s-on-event-modifiers", - "body": [ - "on:${1:eventname}|${2|preventDefault,stopPropagation,passive,capture,once|}={${3:handler}}" - ], - "description": "on event w/ modifiers" - }, - "svelte-on-event-inline": { - "prefix": "s-on-event-inline", - "body": [ - "on:${1:click}=\"{() => ${2:count += 1}}\"" - ], - "description": "on event inline" - }, - "svelte-modifiers": { - "prefix": "s-modifier", - "body": [ - "|${1|preventDefault,stopPropagation,passive,capture,once|}" - ], - "description": "modifier" - }, - "svelte-bind": { - "prefix": "s-bind", - "body": [ - "bind:${1:property}" - ], - "description": "bind property" - }, - "svelte-bind-property": { - "prefix": "s-bind-property", - "body": [ - "bind:${1:property}={${2:variable}}" - ], - "description": "bind property" - }, - "svelte-bind-video": { - "prefix": "s-bind-video", - "body": [ - "" - ], - "description": "bind property" - }, - "svelte-bind-audio": { - "prefix": "s-bind-audio", - "body": [ - "" - ], - "description": "bind property" - }, - "svelte-bind-media-elements": { - "prefix": "s-bind-media-elements", - "body": [ - "bind:${1|duration,buffered,played,seekable,seeking,ended,currentTime,playbackRate,paused,volume,muted,videoWidth,videoHeight|}" - ], - "description": "bind property" - }, - "svelte-bind-block-level": { - "prefix": "s-bind-block-level", - "body": [ - "bind:${1|clientWidth,clientHeight,offsetWidth,offsetHeight|}={${2:variable}}" - ], - "description": "bind property" - }, - "svelte-bind-group": { - "prefix": "s-bind-group", - "body": [ - "bind:group={${1:variable}}" - ], - "description": "bind group" - }, - "svelte-bind-this": { - "prefix": "s-bind-this", - "body": [ - "bind:this={${1:dom_node}}" - ], - "description": "bind this" - }, - "svelte-class": { - "prefix": "s-class", - "body": [ - "class:${1:name}={${2:condition}}" - ], - "description": "class" - }, - "svelte-class-short": { - "prefix": "s-class-short", - "body": [ - "class:${1:name}}" - ], - "description": "class shorthand" - }, - "svelte-use": { - "prefix": "s-use", - "body": [ - "use:action" - ], - "description": "use action" - }, - "svelte-use-parameters": { - "prefix": "s-use-parameters", - "body": [ - "use:action={${1:parameters}}" - ], - "description": "use action w/ parameters" - }, - "svelte-transition": { - "prefix": "s-transition", - "body": [ - "${1|transition,in,out|}:${2:name}" - ], - "description": "transition" - }, - "svelte-transition-params": { - "prefix": "s-transition-params", - "body": [ - "${1|transition,in,out|}:${2:name}={${3:params}}" - ], - "description": "transition-params" - }, - "svelte-transition-events": { - "prefix": "s-transition-events", - "body": [ - "on:${1|introstart,introend,outrostart,outroend|}=\"{() => status = '${1|introstart,introend,outrostart,outroend|}'}\"" - ], - "description": "transition-events" - }, - "svelte-transition-local": { - "prefix": "s-transition-local", - "body": [ - "${1|transition,in,out|}:${2:name}|${3:local}" - ], - "description": "transition local" - }, - "svelte-transition-all": { - "prefix": "s-transition-all", - "body": [ - "${1|transition,in,out|}:${2:name}|${3:local}={${4:params}}" - ], - "description": "transition" - }, - "svelte-animate": { - "prefix": "s-animate", - "body": [ - "animate:${1:name}={${2:params}}" - ], - "description": "animate" - }, - "svelte-slot": { - "prefix": "s-slot", - "body": [ - "${1:}" - ], - "description": "slot" - }, - "svelte-slot-name": { - "prefix": "s-slot-name", - "body": [ - "${2:}" - ], - "description": "slot w/ name" - }, - "svelte-slot-prop": { - "prefix": "s-slot-prop", - "body": [ - "${3:}" - ], - "description": "slot w/ prop" - }, - "svelte-self": { - "prefix": "s-self", - "body": [ - "" - ], - "description": "svelte:self" - }, - "svelte-self-prop": { - "prefix": "s-self-prop", - "body": [ - "" - ], - "description": "svelte:self" - }, - "svelte-component": { - "prefix": "s-component", - "body": [ - "" - ], - "description": "svelte:component" - }, - "svelte-window": { - "prefix": "s-window", - "body": [ - "" - ], - "description": "svelte:window" - }, - "svelte-window-bind": { - "prefix": "s-window-bind", - "body": [ - "bind:${1|innerWidth,innerHeight,outerWidth,outerHeight,scrollX,scrollY,online|}={${2:variable}}" - ], - "description": "svelte:window bind properties" - }, - "svelte-body": { - "prefix": "s-body", - "body": [ - "" - ], - "description": "svelte:body" - }, - "svelte-head": { - "prefix": "s-head", - "body": [ - "", - "\t${1:}", - "" - ], - "description": "svelte:head" - }, - "svelte-options": { - "prefix": "s-options", - "body": [ - "" - ], - "description": "svelte:options" - } -} \ No newline at end of file + "svelte-component-format": { + "prefix": "s-component-format", + "body": [ + "", + "", + "", + "", + "${3:}" + ], + "description": "add a script to your svelte file" + }, + "svelte-script-tag": { + "prefix": "s-script", + "body": [""], + "description": "add a script to your svelte file" + }, + "svelte-typescript-script-tag": { + "prefix": "s-ts-script", + "body": [ + "" + ], + "description": "add a typescript script to your svelte file" + }, + "svelte-script-context": { + "prefix": "s-script-context", + "body": [ + "" + ], + "description": "add a script with context=\"module\" to your svelte file" + }, + "svelte-style-tag": { + "prefix": "s-style", + "body": [""], + "description": "add styles to your svelte file" + }, + "svelte-expression": { + "prefix": "s-expression", + "body": ["{${1:expression}}"], + "description": "basic expression" + }, + "svelte-expression-html": { + "prefix": "s-expression-html", + "body": ["{@html ${1:expression}}"], + "description": "html content expression" + }, + "svelte-expression-debug": { + "prefix": "s-expression-debug", + "body": ["{@debug ${1:var1}${2:,var2}}"], + "description": "html content expression" + }, + "svelte-if-block": { + "prefix": "s-if-block", + "body": [ + "{#if ${1:condition}}", + "\t${2: }", + "{/if}" + ], + "description": "if block" + }, + "svelte-if-else-block": { + "prefix": "s-if-else-block", + "body": [ + "{#if ${1:condition}}", + "\t${2: }", + "{:else}", + "\t${3: }", + "{/if}" + ], + "description": "if else block" + }, + "svelte-else-block": { + "prefix": "s-else-block", + "body": ["{:else}", "\t${1: }"], + "description": "else block" + }, + "svelte-if-else-if-block": { + "prefix": "s-if-else-if-block", + "body": [ + "{#if ${1:condition}}", + "\t${2: }", + "{:else if ${3: otherCondition}}", + "\t${4: }", + "{:else}", + "\t${5: }", + "{/if}" + ], + "description": "if else if block" + }, + "svelte-else-if-block": { + "prefix": "s-else-if-block", + "body": [ + "{:else if ${1: otherCondition}}", + "\t${2: }" + ], + "description": "else if block" + }, + "svelte-each-block": { + "prefix": "s-each-block", + "body": [ + "{#each ${1:items} as ${2:item}}", + "\t${3: }", + "{/each}" + ], + "description": "each block" + }, + "svelte-each-else-block": { + "prefix": "s-each-else-block", + "body": [ + "{#each ${1:items} as ${2:item}}", + "\t${3: }", + "{:else}", + "\t${4: }", + "{/each}" + ], + "description": "each else block" + }, + "svelte-each-index-block": { + "prefix": "s-each-index-block", + "body": [ + "{#each ${1:items} as ${2:item},${3:i}}", + "\t${4: }", + "{/each}" + ], + "description": "each index block" + }, + "svelte-each-key-block": { + "prefix": "s-each-key-block", + "body": [ + "{#each ${1:items} as ${2:item},(${3:key})}", + "\t${4: }", + "{/each}" + ], + "description": "each index block" + }, + "svelte-each-index-key-block": { + "prefix": "s-each-index-key-block", + "body": [ + "{#each ${1:items} as ${2:item},i (${3:key})}", + "\t${4: }", + "{/each}" + ], + "description": "each index key block" + }, + "svelte-await-then-block": { + "prefix": "s-await-then-block", + "body": [ + "{#await ${1:promise}}", + "\t", + "{:then ${2:value}}", + "\t", + "{/await}" + ], + "description": "await then block" + }, + "svelte-then-block": { + "prefix": "s-then-block", + "body": ["{:then ${1:value}}", "\t"], + "description": "then block" + }, + "svelte-await-short-block": { + "prefix": "s-await-short-block", + "body": [ + "{#await ${1:promise} then ${2:value}}", + "\t", + "{/await}" + ], + "description": "await short block" + }, + "svelte-await-catch-block": { + "prefix": "s-await-catch-block", + "body": [ + "{#await ${1:promise}}", + "\t", + "{:then ${value}}", + "\t", + "{:catch error}", + "\t", + "{/await}" + ], + "description": "await catch block" + }, + "svelte-catch-block": { + "prefix": "s-catch-block", + "body": ["{:catch error}", "\t"], + "description": "catch block" + }, + "svelte-on-event": { + "prefix": "s-on-event", + "body": ["on:${1:eventname}={${2:handler}}"], + "description": "on event" + }, + "svelte-on-event-forward": { + "prefix": "s-on-event-foward", + "body": ["on:${1:eventname}"], + "description": "on event foward" + }, + "svelte-on-event-modifiers": { + "prefix": "s-on-event-modifiers", + "body": [ + "on:${1:eventname}|${2|preventDefault,stopPropagation,passive,capture,once|}={${3:handler}}" + ], + "description": "on event w/ modifiers" + }, + "svelte-on-event-inline": { + "prefix": "s-on-event-inline", + "body": ["on:${1:click}=\"{() => ${2:count += 1}}\""], + "description": "on event inline" + }, + "svelte-modifiers": { + "prefix": "s-modifier", + "body": ["|${1|preventDefault,stopPropagation,passive,capture,once|}"], + "description": "modifier" + }, + "svelte-bind": { + "prefix": "s-bind", + "body": ["bind:${1:property}"], + "description": "bind property" + }, + "svelte-bind-property": { + "prefix": "s-bind-property", + "body": ["bind:${1:property}={${2:variable}}"], + "description": "bind property" + }, + "svelte-bind-video": { + "prefix": "s-bind-video", + "body": [ + "" + ], + "description": "bind property" + }, + "svelte-bind-audio": { + "prefix": "s-bind-audio", + "body": [ + "" + ], + "description": "bind property" + }, + "svelte-bind-media-elements": { + "prefix": "s-bind-media-elements", + "body": [ + "bind:${1|duration,buffered,played,seekable,seeking,ended,currentTime,playbackRate,paused,volume,muted,videoWidth,videoHeight|}" + ], + "description": "bind property" + }, + "svelte-bind-block-level": { + "prefix": "s-bind-block-level", + "body": [ + "bind:${1|clientWidth,clientHeight,offsetWidth,offsetHeight|}={${2:variable}}" + ], + "description": "bind property" + }, + "svelte-bind-group": { + "prefix": "s-bind-group", + "body": ["bind:group={${1:variable}}"], + "description": "bind group" + }, + "svelte-bind-this": { + "prefix": "s-bind-this", + "body": ["bind:this={${1:dom_node}}"], + "description": "bind this" + }, + "svelte-class": { + "prefix": "s-class", + "body": ["class:${1:name}={${2:condition}}"], + "description": "class" + }, + "svelte-class-short": { + "prefix": "s-class-short", + "body": ["class:${1:name}}"], + "description": "class shorthand" + }, + "svelte-use": { + "prefix": "s-use", + "body": ["use:action"], + "description": "use action" + }, + "svelte-use-parameters": { + "prefix": "s-use-parameters", + "body": ["use:action={${1:parameters}}"], + "description": "use action w/ parameters" + }, + "svelte-transition": { + "prefix": "s-transition", + "body": ["${1|transition,in,out|}:${2:name}"], + "description": "transition" + }, + "svelte-transition-params": { + "prefix": "s-transition-params", + "body": ["${1|transition,in,out|}:${2:name}={${3:params}}"], + "description": "transition-params" + }, + "svelte-transition-events": { + "prefix": "s-transition-events", + "body": [ + "on:${1|introstart,introend,outrostart,outroend|}=\"{() => status = '${1|introstart,introend,outrostart,outroend|}'}\"" + ], + "description": "transition-events" + }, + "svelte-transition-local": { + "prefix": "s-transition-local", + "body": ["${1|transition,in,out|}:${2:name}|${3:local}"], + "description": "transition local" + }, + "svelte-transition-all": { + "prefix": "s-transition-all", + "body": ["${1|transition,in,out|}:${2:name}|${3:local}={${4:params}}"], + "description": "transition" + }, + "svelte-animate": { + "prefix": "s-animate", + "body": ["animate:${1:name}={${2:params}}"], + "description": "animate" + }, + "svelte-slot": { + "prefix": "s-slot", + "body": ["${1:}"], + "description": "slot" + }, + "svelte-slot-name": { + "prefix": "s-slot-name", + "body": [ + "${2:}" + ], + "description": "slot w/ name" + }, + "svelte-slot-prop": { + "prefix": "s-slot-prop", + "body": [ + "${3:}" + ], + "description": "slot w/ prop" + }, + "svelte-self": { + "prefix": "s-self", + "body": [""], + "description": "svelte:self" + }, + "svelte-self-prop": { + "prefix": "s-self-prop", + "body": [""], + "description": "svelte:self" + }, + "svelte-component": { + "prefix": "s-component", + "body": [""], + "description": "svelte:component" + }, + "svelte-window": { + "prefix": "s-window", + "body": [""], + "description": "svelte:window" + }, + "svelte-window-bind": { + "prefix": "s-window-bind", + "body": [ + "bind:${1|innerWidth,innerHeight,outerWidth,outerHeight,scrollX,scrollY,online|}={${2:variable}}" + ], + "description": "svelte:window bind properties" + }, + "svelte-body": { + "prefix": "s-body", + "body": [""], + "description": "svelte:body" + }, + "svelte-head": { + "prefix": "s-head", + "body": [ + "", + "\t${1:}", + "" + ], + "description": "svelte:head" + }, + "svelte-options": { + "prefix": "s-options", + "body": [ + "" + ], + "description": "svelte:options" + } +}