-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e6c6ddc
Showing
10 changed files
with
282 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Set default behavior to automatically normalize line endings. | ||
* text=auto | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
*.vsix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// A launch configuration that launches the extension inside a new window | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Extension", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.vscode/** | ||
.vscode-test/** | ||
.gitignore | ||
vsc-extension-quickstart.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Change Log | ||
|
||
All notable changes to the "sveltekit-snippets" extension will be documented in this file. | ||
|
||
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. | ||
|
||
## [Unreleased] | ||
|
||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# sveltekit-snippets | ||
|
||
The extension provides snippets for common patterns in SvelteKit & Vanilla Svelte including... | ||
|
||
- Components | ||
- Logic Blocks | ||
- Endpoints | ||
- Load Functions | ||
|
||
## Issues | ||
|
||
Issues are welcome and encouraged! Please describe the issue as thuroughly as you can – Contribution guidelines are forthcoming. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "sveltekit-snippets", | ||
"displayName": "sveltekit-snippets", | ||
"description": "Snippets for SvelteKit", | ||
"version": "0.0.1", | ||
"publisher": "stordahl", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/stordahl/sveltekit-snippets.git" | ||
}, | ||
"engines": { | ||
"vscode": "^1.60.0" | ||
}, | ||
"categories": [ | ||
"Snippets" | ||
], | ||
"contributes": { | ||
"snippets": [ | ||
{ | ||
"language": "javascript", | ||
"path": "./snippets/snippets.code-snippets" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
{ | ||
"Svelte Component": { | ||
"prefix": "kitComp", | ||
"scope": "svelte", | ||
"description": "Scaffold a Svelte component", | ||
"body": [ | ||
"<script>", | ||
"$0", | ||
"</script>", | ||
"", | ||
"<style>", | ||
"", | ||
"</style>" | ||
] | ||
}, | ||
"Svelte TypeScript Component": { | ||
"prefix": "kitCompTs", | ||
"scope": "svelte", | ||
"description": "Scaffold a TypeScript Svelte component", | ||
"body": [ | ||
"<script lang=ts>", | ||
"\t $0", | ||
"</script>", | ||
"", | ||
"<style>", | ||
"", | ||
"</style>" | ||
] | ||
}, | ||
"SvelteKit Module Component": { | ||
"prefix": "kitModule", | ||
"scope": "svelte", | ||
"description": "Scaffold a SvelteKit module component for a page", | ||
"body": [ | ||
"<script context=module>", | ||
"\t $0", | ||
"</script>", | ||
"<script>", | ||
"", | ||
"</script>", | ||
"", | ||
"<style>", | ||
"", | ||
"</style>" | ||
] | ||
}, | ||
"SvelteKit TypeScript Module Component": { | ||
"prefix": "kitModuleTs", | ||
"scope": "svelte", | ||
"description": "Scaffold a SvelteKit module component for a page", | ||
"body": [ | ||
"<script lang=ts context=module>", | ||
"\t $0", | ||
"</script>", | ||
"<script>", | ||
"", | ||
"</script", | ||
"", | ||
"<style>", | ||
"", | ||
"</style>" | ||
] | ||
}, | ||
"SvelteKit Layout Component": { | ||
"prefix": "kitLayout", | ||
"scope": "svelte", | ||
"description": "Scaffold a SvelteKit layout component", | ||
"body": [ | ||
"<script>", | ||
"\t $0", | ||
"</script>", | ||
"", | ||
"<main>", | ||
" <slot/>", | ||
"</main", | ||
"", | ||
"<style>", | ||
"", | ||
"</style>" | ||
] | ||
}, | ||
"Svelte Prefetch": { | ||
"prefix": "kitPrefetch", | ||
"scope": "svelte, html", | ||
"description": "Create sveltekit:prefetch anchor tag", | ||
"body": ["<a sveltekit:prefetch href='${1:url}'>${2:text}</a>"] | ||
}, | ||
"Svelte Each Block": { | ||
"prefix": "kitEach", | ||
"scope": "svelte", | ||
"description": "Create a Svelte #each block", | ||
"body": [ | ||
"{#each ${1:array} as ${2:element} }", | ||
"\t", | ||
"{/each}" | ||
] | ||
}, | ||
"Svelte If Block": { | ||
"prefix": "kitIf", | ||
"scope": "svelte", | ||
"description": "Create a Svelte #if block", | ||
"body": [ | ||
"{#if ${1:condition} }", | ||
"\t", | ||
"{/if}" | ||
] | ||
}, | ||
"Svelte Await Block": { | ||
"prefix": "kitAwait", | ||
"scope": "svelte", | ||
"description": "Create a Svelte #await block", | ||
"body": [ | ||
"{#await ${1:expression} }", | ||
"\t", | ||
"{:then ${2:name} }", | ||
"\t", | ||
"{:catch ${3:name} }", | ||
"\t", | ||
"{/await}" | ||
] | ||
}, | ||
"Svelte Key Block": { | ||
"prefix": "kitKey", | ||
"scope": "svelte", | ||
"description": "Create a Svelte #key block", | ||
"body": [ | ||
"{#key ${1:expression} }", | ||
"\t", | ||
"{/key}" | ||
] | ||
}, | ||
"Svelte Page Title": { | ||
"prefix": "kitTitle", | ||
"scope": "svelte", | ||
"description": "Create a title element in the document head", | ||
"body": [ | ||
"<svelte:head>", | ||
"\t<title>${TM_FILENAME_BASE}</title>", | ||
"</svelte:head>" | ||
] | ||
}, | ||
"SvelteKit Load Function": { | ||
"prefix": "kitLoad", | ||
"scope": "javascript", | ||
"description": "Create a SvelteKit Load function", | ||
"body": [ | ||
"/**", | ||
" * @type {import('@sveltejs/kit').Load}", | ||
" */", | ||
"export async function load({ page, fetch, session, context }) {", | ||
" const url = `${1:api}`;", | ||
" const res = await fetch(url);", | ||
"", | ||
"if (res.ok) {", | ||
" return {", | ||
" props: {", | ||
" ${2:propName}: await res.json()", | ||
" }", | ||
" };", | ||
"}", | ||
"", | ||
"return {", | ||
" status: res.status,", | ||
" error: new Error(`Could not load ${url}`)", | ||
" };", | ||
"}" | ||
] | ||
}, | ||
"SvelteKit Endpoint": { | ||
"prefix": "kitEndpoint", | ||
"scope": "javascript", | ||
"description": "Create a SvelteKit Endpoint", | ||
"body": [ | ||
"/**", | ||
"* @type {import('@sveltejs/kit').RequestHandler}", | ||
"*/", | ||
"export const ${1:method} = async ({ params }) => {", | ||
" const { ${TM_FILENAME_BASE} } = params;", | ||
"", | ||
" const res = await ${2:something};", | ||
"", | ||
" if (res) {", | ||
" return {", | ||
" body: {", | ||
" res", | ||
" }", | ||
" };", | ||
" }", | ||
"}" | ||
] | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|