From 958b754665b41b1b80fee98d2c2a7e3a1cfbe81d Mon Sep 17 00:00:00 2001 From: bobbyrahmanda13 Date: Sat, 20 Jan 2024 23:57:41 +0700 Subject: [PATCH] feat: added vue snippet for nuxt and took typescript javascript snippet for vue update fix #385: add terraform snippets to package.json snprintf() snippet incorrectly inserts sprintf() body (c.json) improve function snips Make former `fund` (-> `fun`) more universal Also, make the prefixes more logical (c.json) Add _GNU_SOURCE snippet Snippet to enable GNU functions (c.json) Update GNU_SOURCE description Update the description to be more specific for newbies to C Fixed for range loop in gdscript add blade snippets (#374) * add blade snippets * fix json formatting Add rfv for React, compatible with Vite (#384) feat(global): Add UUID snippet (#386) remove extra spaces in deployment and pod snippets (#390) Reorder html5 document template (#393) The encoding ` **Warning**: If you're using LuaSnip make sure to use +> [!WARNING] +> If you're using LuaSnip make sure to use > `require("luasnip.loaders.from_vscode").lazy_load()`, and add > `friendly-snippets` as a dependency for LuaSnip, otherwise snippets might not > be detected. If you don't use `lazy_load()` you might notice a slower @@ -58,7 +59,8 @@ loading vscode snippets. Like for example: ## Add snippets from a framework to a filetype. -> **Note**: This is handled by your snippet engine and has nothing to do with this snippets collection +> [!NOTE] +> This is handled by your snippet engine and has nothing to do with this snippets collection There's extra snippets included in this repo but they are not added by default, since it would be irrelevant for people not using those frameworks. See @@ -80,7 +82,8 @@ let g:vsnip_filetypes.ruby = ['rails'] ## Excluding snippets -> **Note**: This is handled by your snippet engine and has nothing to do with this snippets collection +> [!NOTE] +> This is handled by your snippet engine and has nothing to do with this snippets collection With LuaSnip, see `help luasnip-loaders` diff --git a/package.json b/package.json index f6d92f9f..2256de40 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,10 @@ "language": "csharpdoc", "path": "./snippets/csharp/csharpdoc.json" }, + { + "language": "editorconfig", + "path": "./snippets/editorconfig.json" + }, { "language": ["gitcommit", "NeogitCommitMessage"], "path": "./snippets/gitcommit.json" @@ -224,7 +228,8 @@ "eruby", "javascriptreact", "htmldjango", - "astro" + "astro", + "blade" ], "path": "./snippets/html.json" }, @@ -276,6 +281,10 @@ "language": ["javascriptreact", "typescriptreact"], "path": "./snippets/javascript/react-es7.json" }, + { + "language": "terraform", + "path": "./snippets/terraform.json" + }, { "language": "svelte", "path": "./snippets/svelte.json" @@ -286,20 +295,24 @@ }, { "language": "vue", - "path": "./snippets/frameworks/vue/nuxt_html.json" + "path": "./snippets/frameworks/vue/nuxt-html.json" }, { "language": "vue", - "path": "./snippets/frameworks/vue/nuxt_js_ts.json" + "path": "./snippets/frameworks/vue/nuxt-script.json" }, { "language": "vue", - "path": "./snippets/frameworks/vue/javascript.json" + "path": "./snippets/frameworks/vue/script.json" }, { "language": "vue", "path": "./snippets/frameworks/vue/vue.json" }, + { + "language": "vue", + "path": "./snippets/frameworks/vue/style.json" + }, { "language": "angular", "path": "./snippets/frameworks/angular/html.json" @@ -417,9 +430,25 @@ "path": "./snippets/latex/bibtex.json" }, { - "language": "twig", + "language": "twig", "path": "./snippets/frameworks/twig.json" }, + { + "language": "blade", + "path": "./snippets/frameworks/blade/blade.json" + }, + { + "language": "blade", + "path": "./snippets/frameworks/blade/helpers.json" + }, + { + "language": "blade", + "path": "./snippets/frameworks/blade/livewire.json" + }, + { + "language": "blade", + "path": "./snippets/frameworks/blade/snippets.json" + }, { "language": ["r", "rmd"], "path": "./snippets/r.json" @@ -522,7 +551,20 @@ { "language": "dune", "path": "./snippets/ocaml/dune.json" + }, + { + "language": "purescript", + "path": "./snippets/purescript.json" + }, + { + "language": "gleam", + "path": "./snippets/gleam.json" + }, + { + "language": "asciidoc", + "path": "./snippets/asciidoc.json" } ] } } + diff --git a/snippets/asciidoc.json b/snippets/asciidoc.json new file mode 100644 index 00000000..6ba94bda --- /dev/null +++ b/snippets/asciidoc.json @@ -0,0 +1,676 @@ +{ + "document header": { + "prefix": "header", + "body": [ + "= ${1:${TM_FILENAME_BASE:Document Title}}", + "${2:Author} <${3:author@email.com}>", + "${4:version}, ${5:${CURRENT_YEAR:year}-${CURRENT_MONTH:month}-${CURRENT_DATE:day}}${6:: remark}", + "${7::attributes:}", + "", + "$0" + ], + "description": "Insert document header" + }, + "document title": { + "prefix": ["h1", "document title"], + "body": ["= ${1:${TM_FILENAME_BASE:Document Title}}", "$0"], + "description": "Insert header level 1" + }, + "document title 2": { + "prefix": ["h1", "document title+"], + "body": ["= ${1:${TM_FILENAME_BASE:Document Title}}: ${2:subtitle}", "$0"], + "description": "Insert header level 1 with subtitle" + }, + + "document attributes": { + "prefix": "document attributes", + "body": ["${1:author} <${2:email}>", "{localdatetime}", ":toc:", "$0"], + "description": "Insert document attributes" + }, + "document attributes 2": { + "prefix": "document attributes+", + "body": [ + "${1:author} <${2:email}>; ${3:author} <${4:email}>", + "{localdatetime}", + ":doctype: ${5:article}", + ":toc:", + ":toclevels: ${6:3}", + ":sectnums:", + ":xrefstyle: ${7:full}", + ":icons: font", + ":source-highlighter: ${8:highlight.js}", + ":experimental:", + ":imagesdir: ${9:images}", + "$0" + ], + "description": "Insert document attributes" + }, + + "section 1": { + "prefix": ["h2", "section 1"], + "body": ["== ${1:title}", "$0"], + "description": "Insert section level 1 (h2)" + }, + "section 2": { + "prefix": ["h3", "section 2"], + "body": ["=== ${1:title}", "$0"], + "description": "Insert section level 2 (h3)" + }, + "section 3": { + "prefix": ["h4", "section 3"], + "body": ["==== ${1:title}", "$0"], + "description": "Insert section level 3 (h4)" + }, + "section 4": { + "prefix": ["h5", "section 4"], + "body": ["===== ${1:title}", "$0"], + "description": "Insert section level 4 (h5)" + }, + "section 5": { + "prefix": ["h6", "section 5"], + "body": ["====== ${1:title}", "$0"], + "description": "Insert section level 5 (h6)" + }, + + "custom id": { + "prefix": ["custom id"], + "body": "[#${1:id}]$0", + "description": "Insert custom id" + }, + "custom id 2": { + "prefix": ["custom id"], + "body": "[#${1:id},reftext=${2:text}]$0", + "description": "Insert custom id with reference text" + }, + + "thematic break": { + "prefix": ["thematic break", "horizontal rule"], + "body": ["'''", "$0"], + "description": "Insert thematic break (horizontal rule)" + }, + "thematic break 2": { + "prefix": ["thematic break", "horizontal rule"], + "body": ["---", "$0"], + "description": "Insert thematic break (horizontal rule) in Markdown style" + }, + "page break": { + "prefix": "page break", + "body": ["<<<", "$0"], + "description": "Insert page break" + }, + + "bold text": { + "prefix": ["bold", "b"], + "body": "*${1}* $0", + "description": "Insert bold text" + }, + "italic text": { + "prefix": ["italic", "i"], + "body": "_${1}_ $0", + "description": "Insert italic text" + }, + "monospace text": { + "prefix": ["monospace", "code"], + "body": "`${1}` $0", + "description": "Insert monospace text" + }, + "bold and italic text": { + "prefix": ["bold and italic", "bi"], + "body": "*_${1}_* $0", + "description": "Insert bold and italic text" + }, + "marked text": { + "prefix": ["mark"], + "body": "#${1}# $0", + "description": "Insert marked text" + }, + "strikethrough text": { + "prefix": "strikethrough", + "body": "[.line-through]#${1}# $0", + "description": "Insert strikethrough text" + }, + "underline text": { + "prefix": "underline", + "body": "[.underline]#${1}# $0", + "description": "Insert underline text" + }, + "overline text": { + "prefix": "overline", + "body": "[.overline]#${1}# $0", + "description": "Insert overline text" + }, + "small text": { + "prefix": "small", + "body": "[.small]#${1}# $0", + "description": "Insert small text" + }, + "big text": { + "prefix": "big", + "body": "[.big]#${1}# $0", + "description": "Insert big text" + }, + "superscript text": { + "prefix": "superscript", + "body": "^${1}^$0", + "description": "Insert superscript text" + }, + "subscript text": { + "prefix": "subscript", + "body": "~${1}~$0", + "description": "Insert subscript text" + }, + + "unordered list": { + "prefix": "unordered list", + "body": ["* ${1:first}", "* ${2:second}", "* ${3:third}", "$0"], + "description": "Insert unordered list" + }, + "ordered list": { + "prefix": "ordered list", + "body": [". ${1:first}", ". ${2:second}", ". ${3:third}", "$0"], + "description": "Insert ordered list" + }, + "check list": { + "prefix": "check list", + "body": [ + "* [${1: }] ${2:first}", + "* [${3: }] ${4:second}", + "* [${5: }] ${6:third}", + "$0" + ], + "description": "Insert check list" + }, + "description list": { + "prefix": "description list", + "body": [ + "${1:term}:: ${2:description}", + "${3:term}:: ${4:description}", + "${5:term}:: ${6:description}", + "$0" + ], + "description": "Insert description list" + }, + + "link simple": { + "prefix": "link", + "body": "${1:${TM_SELECTED_TEXT:link}}[${2:alt}]$0", + "description": "Insert simple link" + }, + "link macro": { + "prefix": "link", + "body": ["${1:${TM_SELECTED_TEXT:link}}[${2:alt}] $0"], + "description": "Insert link macro with text" + }, + "mailto link": { + "prefix": "mailto", + "body": "mailto:${1:${TM_SELECTED_TEXT:link}}[${2:alt}]$0", + "description": "Insert mailto link" + }, + + "cross reference": { + "prefix": ["<<", "cross reference"], + "body": ["<<${1:anchor}>> $0"], + "description": "cross reference" + }, + "cross reference 2": { + "prefix": ["<<", "cross reference"], + "body": ["<<${1:anchor},${2:label}>> $0"], + "description": "cross reference with label" + }, + "cross reference macro": { + "prefix": ["<<", "cross reference"], + "body": ["xref:${1:anchor}[${2:label}] $0"], + "description": "cross reference macro with label" + }, + + "footnote macro": { + "prefix": "footnote macro", + "body": ["footnote:[${1:text}] $0"], + "description": "Insert footnote macro" + }, + "footnote macro 2": { + "prefix": "footnote macro", + "body": ["footnote:${1:id}[${2:text}] $0"], + "description": "Insert footnote macro with id" + }, + + "image inline": { + "prefix": "image", + "body": "image:${1:filepath}[${2:alt}]", + "description": "Insert image inline" + }, + "image block macro": { + "prefix": "image", + "body": ["image::${1:filepath}[\"${2:alt}\"]", "$0"], + "description": "Insert image block macro" + }, + "image block macro 2": { + "prefix": "image+", + "body": [".${1:title}", "image::${2:filepath}[\"${3:alt}\"]", "$0"], + "description": "Insert image block macro with title" + }, + + "audio block": { + "prefix": "audio macro", + "body": ["audio::${1:filepath}[]", "$0"], + "description": "Include audio block" + }, + "video block": { + "prefix": "video macro", + "body": ["video::${1:filepath}[]", "$0"], + "description": "Include video block" + }, + + "icon macro": { + "prefix": "icon macro", + "body": "icon:${1:icon}[] $0", + "description": "Insert icon" + }, + "keyboard macro": { + "prefix": "keyboard macro", + "body": "kbd:[${1:key}] $0", + "description": "Insert keyboard key" + }, + "keyboard macro 2": { + "prefix": "keyboard macro", + "body": "kbd:[${1:key}+${2:key}] $0", + "description": "Insert keyboard key sequence" + }, + "button macro": { + "prefix": "button macro", + "body": "btn:[${1:text}] $0", + "description": "Insert button" + }, + "menu macro": { + "prefix": "menu macro", + "body": "menu:${1:menu}[${2:item}] $0", + "description": "Insert menu with item" + }, + "menu macro 2": { + "prefix": "menu macro", + "body": "menu:${1:menu}[${2:item} > ${3:subitem}] $0", + "description": "Insert menu with subitem" + }, + "menu macro 3": { + "prefix": "menu macro", + "body": "menu:${1:menu}[${2:item} > ${3:subitem} > ${4:subsubitem}] $0", + "description": "Insert menu with subsubitem" + }, + + "note paragraph": { + "prefix": ["note"], + "body": ["NOTE: ${1:text}", "$0"], + "description": "Insert NOTE admonition block as paragraph" + }, + "note block": { + "prefix": ["note"], + "body": ["[NOTE]", "====", "${1:text}", "====", "$0"], + "description": "Insert NOTE block" + }, + "note block 2": { + "prefix": ["note+"], + "body": ["[NOTE]", ".${1:title}", "====", "${2:text}", "====", "$0"], + "description": "Insert NOTE block" + }, + "tip paragraph": { + "prefix": ["tip"], + "body": ["TIP: ${1:text}", "$0"], + "description": "Insert TIP admonition block as paragraph" + }, + "tip block": { + "prefix": ["tip"], + "body": ["[TIP]", "====", "${1:text}", "====", "$0"], + "description": "Insert TIP block" + }, + "tip block 2": { + "prefix": ["tip+"], + "body": ["[TIP]", ".${1:title}", "====", "${2:text}", "====", "$0"], + "description": "Insert TIP block" + }, + "important paragraph": { + "prefix": ["important"], + "body": ["IMPORTANT: ${1:text}", "$0"], + "description": "Insert IMPORTANT admonition block as paragraph" + }, + "important block": { + "prefix": ["important"], + "body": ["[IMPORTANT]", "====", "${1:text}", "====", "$0"], + "description": "Insert IMPORTANT block" + }, + "important block 2": { + "prefix": ["important+"], + "body": ["[IMPORTANT]", ".${1:title}", "====", "${2:text}", "====", "$0"], + "description": "Insert IMPORTANT block" + }, + "caution paragraph": { + "prefix": ["caution"], + "body": ["CAUTION: ${1:text}", "$0"], + "description": "Insert CAUTION admonition block as paragraph" + }, + "caution block": { + "prefix": ["caution"], + "body": ["[CAUTION]", "====", "${1:text}", "====", "$0"], + "description": "Insert CAUTION block" + }, + "caution block 2": { + "prefix": ["caution+"], + "body": ["[CAUTION]", ".${1:title}", "====", "${2:text}", "====", "$0"], + "description": "Insert CAUTION block" + }, + "warning paragraph": { + "prefix": ["warning"], + "body": ["WARNING: ${1:text}", "$0"], + "description": "Insert WARNING admonition block as paragraph" + }, + "warning block": { + "prefix": ["warning"], + "body": ["[WARNING]", "====", "${1:text}", "====", "$0"], + "description": "Insert WARNING block" + }, + "warning block 2": { + "prefix": ["warning+"], + "body": ["[WARNING]", ".${1:title}", "====", "${2:text}", "====", "$0"], + "description": "Insert WARNING block" + }, + + "sidebar paragraph": { + "prefix": "sidebar paragraph", + "body": ["[sidebar]", "$1", "$0"], + "description": "Insert sidebar block as paragraph" + }, + "sidebar paragraph 2": { + "prefix": "sidebar paragraph+", + "body": [".${1:title}", "[sidebar]", "21", "$0"], + "description": "Insert sidebar block as paragraph with title" + }, + "sidebar block": { + "prefix": "sidebar", + "body": ["****", "$1", "****", "$0"], + "description": "Insert sidebar block" + }, + "sidebar block 2": { + "prefix": "sidebar+", + "body": [".${1:title}", "****", "$2", "****", "$0"], + "description": "Insert sidebar block with title" + }, + + "example paragraph": { + "prefix": "example paragraph", + "body": ["[example]", "$1", "$0"], + "description": "Insert example block as paragraph" + }, + "example paragraph 2": { + "prefix": "example paragraph+", + "body": [".${1:title}", "[example]", "21", "$0"], + "description": "Insert example block as paragraph with title" + }, + "example block": { + "prefix": "example block", + "body": ["====", "$1", "====", "$0"], + "description": "Insert example block" + }, + "example block 2": { + "prefix": "example block+", + "body": [".${1:title}", "====", "$2", "====", "$0"], + "description": "Insert example block with title" + }, + + "quote paragraph": { + "prefix": "quote paragraph", + "body": [ + "[quote, ${2:attribution}, \"${3:citation title and information}\"]", + "$1", + "$0" + ], + "description": "Insert quote block as paragraph" + }, + "quote paragraph 2": { + "prefix": "quote paragraph+", + "body": [ + ".${1:title}", + "[quote, ${3:attribution}, \"${4:citation title and information}\"]", + "$2", + "$0" + ], + "description": "Insert quote block as paragraph with title" + }, + "quote paragraph 3": { + "prefix": "quote paragraph", + "body": [ + "\"${1:quote}\"", + "-- ${2:attribution}, ${3:citation title and information}", + "$0" + ], + "description": "Insert quote block as paragraph" + }, + "quote block": { + "prefix": "quote block", + "body": [ + "[quote, ${2:attribution}, \"${3:citation title and information}\"]", + "----", + "$1", + "----", + "$0" + ], + "description": "Insert quote block" + }, + "quote block 2": { + "prefix": "quote block+", + "body": [ + ".${1:title}", + "[quote, ${3:attribution}, \"${4:citation title and information}\"]", + "----", + "$2", + "----", + "$0" + ], + "description": "Insert quote block with title" + }, + + "verse paragraph": { + "prefix": "verse paragraph", + "body": [ + "[verse, ${2:attribution}, \"${3:citation title and information}\"]", + "$1", + "$0" + ], + "description": "Insert verse block as paragraph" + }, + "verse block": { + "prefix": "verse block", + "body": [ + "[verse, ${2:attribution}, \"${3:citation title and information}\"]", + "____", + "$1", + "____", + "$0" + ], + "description": "Insert verse block" + }, + + "source code block": { + "prefix": "source code block", + "body": ["[source,${1:language}]", "----", "$2", "----", "$0"], + "description": "Insert source code block" + }, + "source code block 2": { + "prefix": "source code block+", + "body": [ + ".${1:title}", + "[source,${2:language}]", + "----", + "$3", + "----", + "$0" + ], + "description": "Insert source code block with title" + }, + "source code block 3": { + "prefix": "source code block+", + "body": [ + ".${1:title}", + "[source,${2:language}]", + "----", + "include::${3:filepath}[]", + "----", + "$0" + ], + "description": "Insert source code block with title via include" + }, + + "listing paragraph": { + "prefix": "listing paragraph", + "body": ["[listing]", "$1", "$0"], + "description": "Insert listing block as paragraph" + }, + "listing block": { + "prefix": "listing block", + "body": ["----", "$1", "----", "$0"], + "description": "Insert listing block" + }, + + "literal paragraph": { + "prefix": "literal paragraph", + "body": ["[literal]", "$1", "$0"], + "description": "Insert literal block as paragraph" + }, + "literal block": { + "prefix": "literal block", + "body": ["....", "$1", "....", "$0"], + "description": "Insert literal block" + }, + + "table": { + "prefix": "table", + "body": [ + ".${1:title}", + "[cols=\"1,1,1\"]", + "|===", + "| ${2:column1} | ${3:column2} | ${4:column3}", + "", + "| ${5:cell1.1} | ${6:cell1.2} | ${7:cell1.3}", + "| ${8:cell2.1} | ${9:cell2.2} | ${10:cell2.3}", + "| ${11:cell3.1} | ${12:cell3.2} | ${13:cell3.3}", + "|===", + "$0" + ], + "description": "Insert 4x3 table with header" + }, + "table 2": { + "prefix": "table", + "body": [ + ".${1:title}", + "[%autowidth%header,cols=\"1,1,1\"]", + "|===", + "| ${2:column1} | ${3:column2} | ${4:column3}", + "", + "| ${5:cell1.1}", + "| ${6:cell1.2}", + "| ${7:cell1.3}", + "", + "| ${8:cell2.1}", + "| ${9:cell2.2}", + "| ${10:cell2.3}", + "", + "| ${11:cell3.1}", + "| ${12:cell3.2}", + "| ${13:cell3.3}", + "|===", + "$0" + ], + "description": "Insert 4x3 table with autowidth and header" + }, + + "open block": { + "prefix": "open block", + "body": ["--", "$1", "--", "$0"], + "description": "Insert open block" + }, + + "collapsible paragraph": { + "prefix": "collapsible paragraph", + "body": ["[example%collapsible]", "$1", "$0"], + "description": "Insert collapsible block as paragraph" + }, + "collapsible block": { + "prefix": "collapsible block", + "body": ["[%collapsible]", "====", "$1", "====", "$0"], + "description": "Insert collapsible block" + }, + "collapsible block 2": { + "prefix": "collapsible block+", + "body": [".${1:title}", "[%collapsible]", "====", "$2", "====", "$0"], + "description": "Insert collapsible block with title" + }, + "collapsible block 3": { + "prefix": "collapsible block in block+", + "body": [ + ".${1:title}", + "[%collapsible]", + "====", + "=====", + "$2", + "=====", + "====", + "$0" + ], + "description": "Insert collapsible block with title and inner block" + }, + "collapsible block 4": { + "prefix": "collapsible code in block+", + "body": [ + ".${1:title}", + "[%collapsible]", + "====", + "[source,${2:language}]", + "----", + "$3", + "----", + "====", + "$0" + ], + "description": "Insert collapsible block with title and inner code block" + }, + + "comment": { + "prefix": ["/", "comment"], + "body": "// $0", + "description": "Insert comment" + }, + "comment block": { + "prefix": ["/", "comment block"], + "body": ["////", "$1", "////", "$0"], + "description": "Insert comment" + }, + + "include directive": { + "prefix": "include directive", + "body": ["include::${1:filepath}[]", "$0"], + "description": "Include content from file or URL" + }, + + "diagram plantuml": { + "prefix": "diagram plantuml", + "body": [ + ".${1:title}", + "[plantuml, \"${2:file}\", svg]", + "....", + "$3", + "....", + "$0" + ], + "description": "Insert diagram with plantuml" + }, + "diagram plantuml 2": { + "prefix": "diagram plantuml", + "body": [ + ".${1:title}", + "[plantuml, \"${2:file}\", svg]", + "....", + "include::${3:filepath}[]", + "....", + "$0" + ], + "description": "Insert diagram with plantuml via include" + } +} diff --git a/snippets/c/c.json b/snippets/c/c.json index 92d8b1af..c9b95dfb 100644 --- a/snippets/c/c.json +++ b/snippets/c/c.json @@ -73,6 +73,11 @@ "body": ["#define ${1:MACRO}($2) ($3)"], "description": "Function-like macro snippet" }, + "_GNU_SOURCE": { + "prefix": "#gnu", + "body": ["#define _GNU_SOURCE"], + "description": "Enable GNU extensions (functions)" + }, "#if": { "prefix": "#if", "body": ["#if ${1:0}", "$0", "#endif /* if $1 */"], @@ -214,13 +219,13 @@ "body": ["for (int ${1:i} = ${2:1}; $1 < argc; $1++) {$0", "}"], "description": "'for' loop for cmdline arguments" }, - "Function declaration": { - "prefix": "fund", - "body": ["${2:void} ${1:fun}(${3:void});"], - "description": "Declare a function" + "Function ...": { + "prefix": "fun", + "body": ["${2:void} ${1:fun}(${3:void})$0"], + "description": "Make a function declaration/definition/pointer" }, "Function definition": { - "prefix": "fun", + "prefix": "func", "body": ["${2:void} ${1:fun}(${3:void})", "{$0", "}"], "description": "Define a function" }, @@ -296,7 +301,7 @@ }, "snprintf": { "prefix": "snprintf", - "body": ["sprintf(${1:buf}, ${2:max}, \"${3:%s}\\n\"$3)$0"], + "body": ["snprintf(${1:buf}, ${2:max}, \"${3:%s}\\n\"$3)$0"], "description": "snprintf() snippet" }, "scanf": { diff --git a/snippets/editorconfig.json b/snippets/editorconfig.json new file mode 100644 index 00000000..37a9148a --- /dev/null +++ b/snippets/editorconfig.json @@ -0,0 +1,47 @@ +{ + "root": { + "prefix": "root", + "body": "# EditorConfig is awesome: https://EditorConfig.org\n\n# top-most EditorConfig file\nroot = true\n\n# Unix-style newlines with a newline ending every file\n[*]\nend_of_line = lf\ninsert_final_newline = true\n\n# Matches multiple files with brace expansion notation\n# Set default charset\n[*.{js,py}]\ncharset = utf-8\n\n# 4 space indentation\n[*.py]\nindent_style = space\nindent_size = 4\n\n# Tab indentation (no size specified)\n[Makefile]\nindent_style = tab\n\n# Indentation override for all JS under lib directory\n[lib/**.js]\nindent_style = space\nindent_size = 2\n\n# Matches the exact files either package.json or .travis.yml\n[{package.json,.travis.yml}]\nindent_style = space\nindent_size = 2", + "description": "Editorconfig root configuration" + }, + "indent_style": { + "prefix": "istyle", + "body": "indent_style = space", + "description": "Indentation Style (tab or space)" + }, + "indent_size": { + "prefix": "isize", + "body": "indent_size = 2", + "description": "Indentation Size (integer or 'tab')" + }, + "tab_width": { + "prefix": "tw", + "body": "tab_width = 4", + "description": "Width of a single tabstop character" + }, + "end_of_line": { + "prefix": "eol", + "body": "end_of_line = lf", + "description": "Line ending file format (lf, crlf, or cr)" + }, + "charset": { + "prefix": "char", + "body": "charset = utf-8", + "description": "File character encoding (latin1, utf-8, utf-16be, utf-16le, utf-8-bom)" + }, + "trim_trailing_space": { + "prefix": "tts", + "body": "trim_trailing_whitespace = true", + "description": "Denotes whether whitespace is removed from the end of lines" + }, + "insert_final_newline": { + "prefix": "ifn", + "body": "insert_final_newline = true", + "description": "Denotes whether file should end with a newline" + }, + "max_line_length": { + "prefix": "mll", + "body": "max_line_length = 80", + "description": "Forces hard line wrapping after the amount of characters specified. 'off' to turn off this feature." + } +} diff --git a/snippets/frameworks/blade/blade.json b/snippets/frameworks/blade/blade.json new file mode 100644 index 00000000..68414307 --- /dev/null +++ b/snippets/frameworks/blade/blade.json @@ -0,0 +1,49 @@ +{ + "Blade-component": { + "prefix": "Blade::component", + "body": "Blade::component('${1:package-name}', ${2:PackageNameComponent}::class);", + "description": "Registering Package Components (AppServiceProvider boot method)" + }, + "Blade-include": { + "prefix": "Blade::include", + "body": "Blade::include('${1:includes.input}', '${2:input}');", + "description": "Aliasing Includes (AppServiceProvider boot method)" + }, + "Blade-if": { + "prefix": "Blade::if", + "body": [ + "Blade::if('${1:env}', function ($${2:environment}) {", + " ${3:return app()->environment($$environment);}", + "});" + ], + "description": "Custom If Statements (AppServiceProvider boot method)" + }, + "Blade-directive": { + "prefix": "Blade::directive", + "body": [ + "Blade::directive('${1:datetime}', function ($${2:expression}) {", + " ${3:return \"format('m/d/Y H:i'); ?>\";}", + "});" + ], + "description": "Custom directive (AppServiceProvider boot method)" + }, + "Blade-stringable": { + "prefix": "Blade::stringable", + "body": [ + "Blade::stringable(function (${1:Money} $${2:money}) {", + " ${3:return $$money->formatTo('en_GB');}", + "});" + ], + "description": "Custom echo handlers (AppServiceProvider boot method)" + }, + "Blade-render": { + "prefix": "Blade::render", + "body": "Blade::render(${1:'Blade template string'}, ${2:\\$data});", + "description": "Transform a raw Blade template string into valid HTML (Laravel 9.x)" + }, + "Blade-renderComponent": { + "prefix": "Blade::renderComponent", + "body": "Blade::renderComponent(new ${1:HelloComponent}(${2:\\$params}));", + "description": "Render a given class component by passing the component instance to the method (Laravel 9.x)" + } +} diff --git a/snippets/frameworks/blade/helpers.json b/snippets/frameworks/blade/helpers.json new file mode 100644 index 00000000..e78db01d --- /dev/null +++ b/snippets/frameworks/blade/helpers.json @@ -0,0 +1,57 @@ +{ + "Path-elixir": { + "prefix": "lv:elixir", + "body": "{{ elixir('${1:file}') }}", + "description": "(deprecated) elixir path" + }, + "Path-mix": { + "prefix": "lv:mix", + "body": "{{ mix('${1:file}') }}", + "description": "mix path" + }, + "String-trans": { + "prefix": "lv:trans", + "body": "{{ trans('$1') }}", + "description": "trans" + }, + "URL-action": { + "prefix": "lv:action", + "body": "{{ action('${1:ControllerName}', [${2:'id'=>1}]) }}", + "description": "URL-action" + }, + "URL-secure-asset": { + "prefix": "lv:secure-asset", + "body": "{{ secure_asset('$1', ${2:\\$title}, ${3:\\$attributes=[]}) }}", + "description": "URL-secure-asset" + }, + "URL-url": { + "prefix": "lv:url", + "body": "{{ url('${1:url}', [$2]) }}", + "description": "URL-url" + }, + "URL-asset": { + "prefix": "lv:asset", + "body": "{{ asset('$1') }}", + "description": "URL-asset" + }, + "URL-route": { + "prefix": "lv:route", + "body": "{{ route('${1:routeName}', [${2:'id'=>1}]) }}", + "description": "URL-route" + }, + "Form-csrf-field": { + "prefix": "lv:csrf-field", + "body": "{{ csrf_field() }}", + "description": "CSRF hidden field" + }, + "csrf-token": { + "prefix": "lv:csrf-token", + "body": "{{ csrf_token() }}", + "description": "CSRF token" + }, + "Paginate-links": { + "prefix": "lv:pagination-links", + "body": "{{ \\$${1:collection}->links() }}", + "description": "pagination links" + } +} diff --git a/snippets/frameworks/blade/livewire.json b/snippets/frameworks/blade/livewire.json new file mode 100644 index 00000000..7dc66c92 --- /dev/null +++ b/snippets/frameworks/blade/livewire.json @@ -0,0 +1,17 @@ +{ + "livewireStyles": { + "prefix": "livewire:styles", + "body": "@livewireStyles", + "description": "Livewire Styles directive" + }, + "livewireScripts": { + "prefix": "livewire:scripts", + "body": "@livewireScripts", + "description": "Livewire Scripts directive" + }, + "livewire-component": { + "prefix": "livewire:component", + "body": "@livewire('${1:component}', ['${2:user}' => \\$${3:user}]${4:, key(\\$$3->id)})", + "description": "Livewire nesting components" + } +} diff --git a/snippets/frameworks/blade/snippets.json b/snippets/frameworks/blade/snippets.json new file mode 100644 index 00000000..06ee98c4 --- /dev/null +++ b/snippets/frameworks/blade/snippets.json @@ -0,0 +1,488 @@ +{ + "Extend layout": { + "prefix": "b:extends", + "body": "@extends('${1:name}')", + "description": "extends view layout" + }, + "Yield content": { + "prefix": "b:yield", + "body": "@yield('${1:name}')", + "description": "yield content section" + }, + "Content Section": { + "prefix": "b:section", + "body": [ + "@section('${1:name}')", + " $2", + "@endsection" + ], + "description": "content section" + }, + "Content Section Show": { + "prefix": "b:section-show", + "body": [ + "@section('$1')", + " $2", + "@show" + ], + "description": "content section show" + }, + "Include view": { + "prefix": "b:include", + "body": "@include('${1:name}')", + "description": "include view" + }, + "If-block": { + "prefix": "b:if", + "body": [ + "@if ($1)", + " $2", + "@endif" + ], + "description": "@if block" + }, + "If-else-block": { + "prefix": "b:if-else", + "body": [ + "@if ($1)", + " $2", + "@else", + " $3", + "@endif" + ], + "description": "if-else block" + }, + "Has Section": { + "prefix": "b:has-section", + "body": [ + "@hasSection ('${1:name}')", + " $2", + "@else", + " $3", + "@endif" + ], + "description": "@hasSection condition" + }, + "Unless-block": { + "prefix": "b:unless", + "body": [ + "@unless ($1)", + " $2", + "@endunless" + ], + "description": "@unless block" + }, + "For-block": { + "prefix": "b:for", + "body": [ + "@for (\\$i = ${1:0}; \\$i < ${2:\\$count}; \\$i++)", + " $3", + "@endfor" + ], + "description": "@for block" + }, + "Foreach-block": { + "prefix": "b:foreach", + "body": [ + "@foreach (${1:\\$collection} as ${2:\\$item})", + " $3", + "@endforeach" + ], + "description": "@foreach block" + }, + "forelse-block": { + "prefix": "b:forelse", + "body": [ + "@forelse (${1:\\$collection} as ${2:\\$item})", + " $3", + "@empty", + " $4", + "@endforelse" + ], + "description": "@forelse block" + }, + "while-block": { + "prefix": "b:while", + "body": [ + "@while ($1)", + " $2", + "@endwhile" + ], + "description": "@while block" + }, + "each loop": { + "prefix": "b:each", + "body": "@each('${1:view.name}', ${2:\\$collection}, '${3:variable}', '${4:view.empty}')", + "description": "@each loop" + }, + "blade comment": { + "prefix": "b:comment", + "body": "{{-- ${1:comment} --}}", + "description": "comment block" + }, + "blade echo-data": { + "prefix": "b:echo", + "body": "{{ ${1:\\$data} }}", + "description": "echo data" + }, + "blade echo-unescaped-data": { + "prefix": "b:echo-html", + "body": "{!! ${1:\\$html_data} !!}", + "description": "echo unescaped data (allow html outputs)" + }, + "blade echo-untouch": { + "prefix": "b:echo-raw", + "body": "@{{ ${1:variable} }}", + "description": "echo untouched data (allow javascript expression)" + }, + "blade verbatim": { + "prefix": "b:verbatim", + "body": [ + "@verbatim", + "{{ ${1:variable} }}", + "@endverbatim" + ], + "description": "displaying JavaScript variables in a large portion of your template" + }, + "Push stack": { + "prefix": "b:push", + "body": [ + "@push('${1:name}')", + " $2", + "@endpush" + ], + "description": "@push stack" + }, + "Stack": { + "prefix": "b:stack", + "body": "@stack('${1:name}')", + "description": "@stack" + }, + "inject service": { + "prefix": "b:inject", + "body": "@inject('${1:name}', '${2:class}')", + "description": "@inject Service" + }, + "can": { + "prefix": "b:can", + "body": [ + "@can('${1:update}', ${2:\\$post})", + " $3", + "@endcan" + ], + "description": "display a portion of the page only if the user is authorized to perform a given action." + }, + "can-elsecan": { + "prefix": "b:can-elsecan", + "body": [ + "@can('${1:update}', ${2:\\$post})", + " $3", + "@elsecan('create', App\\Models\\\\${4:Post}::class)", + " $5", + "@endcan" + ], + "description": "display a portion of the page only if the user is authorized to perform a given action." + }, + "canany": { + "prefix": "b:canany", + "body": [ + "@canany(['update', 'view', 'delete'], ${1:\\$post})", + " $2", + "@endcanany" + ], + "description": "display a portion of the page only if the user is authorized to perform a given action." + }, + "canany-elsecanany": { + "prefix": "b:canany-elsecanany", + "body": [ + "@canany(['update', 'view', 'delete'], ${1:\\$post})", + " $2", + "@elsecanany(['create'], App\\Models\\\\${3:Post}::class)", + " $4", + "@endcanany" + ], + "description": "display a portion of the page only if the user is authorized to perform a given action." + }, + "cannot": { + "prefix": "b:cannot", + "body": [ + "@cannot('${1:update}', ${2:\\$post})", + " $3", + "@endcannot" + ], + "description": "display a portion of the page only if the user is authorized to perform a given action." + }, + "cannot-elsecannot": { + "prefix": "b:cannot-elsecannot", + "body": [ + "@cannot('${1:update}', ${2:\\$post})", + " $3", + "@elsecannot('create', App\\Models\\\\${5:Post}::class)", + " $6", + "@endcannot" + ], + "description": "display a portion of the page only if the user is authorized to perform a given action." + }, + "loop": { + "prefix": "b:loop", + "body": [ + "\\$loop->${1:first}" + ], + "description": "$loop->(index|remaining|count|first|last|depth|parent)" + }, + "loop first": { + "prefix": "b:loop-first", + "body": [ + "@if (\\$loop->first)", + " ${1:{{-- This is the first iteration --\\}\\}}", + "@endif" + ], + "description": "$loop->first" + }, + "loop last": { + "prefix": "b:loop-last", + "body": [ + "@if (\\$loop->last)", + " ${1:{{-- This is the last iteration --\\}\\}}", + "@endif" + ], + "description": "$loop->last" + }, + "php": { + "prefix": "b:php", + "body": [ + "@php", + " $1", + "@endphp" + ], + "description": "@php block code in view" + }, + "includeIf": { + "prefix": "b:includeIf", + "body": "@includeIf('${1:view.name}'${2:, ['some' => 'data']})", + "description": "include a view that may or may not be present, you should use the @includeIf directive" + }, + "component": { + "prefix": "b:component", + "body": [ + "@component('$1')", + " $2", + "@endcomponent" + ], + "description": "component" + }, + "slot": { + "prefix": "b:slot", + "body": [ + "@slot('$1')", + " $2", + "@endslot" + ], + "description": "slot" + }, + "isset": { + "prefix": "b:isset", + "body": [ + "@isset(${1:\\$record})", + " $2", + "@endisset" + ], + "description": "isset" + }, + "empty": { + "prefix": "b:empty", + "body": [ + "@empty(${1:\\$record})", + " $2", + "@endempty" + ], + "description": "empty" + }, + "error": { + "prefix": "b:error", + "body": [ + "@error('${1:record}')", + " $2", + "@enderror" + ], + "description": "error" + }, + "includeWhen": { + "prefix": "b:includeWhen", + "body": "@includeWhen(${1:\\$boolean}, '${2:view.name}', [${3:'some' => 'data'}])", + "description": "includeWhen" + }, + "auth": { + "prefix": "b:auth", + "body": [ + "@auth", + " $1", + "@endauth" + ], + "description": "auth" + }, + "guest": { + "prefix": "b:guest", + "body": [ + "@guest", + " $1", + "@endguest" + ], + "description": "guest" + }, + "switch": { + "prefix": "b:switch", + "body": [ + "@switch(${1:\\$type})", + " @case(${2:1})", + " $3", + " @break", + " @case(${4:2})", + " $5", + " @break", + " @default", + " $6", + "@endswitch" + ], + "description": "switch" + }, + "includeFirst": { + "prefix": "b:includeFirst", + "body": "@includeFirst(['${1:view.name}', '${2:variable}'], [${3:'some' => 'data'}])", + "description": "includeFirst" + }, + "csrf": { + "prefix": "b:csrf", + "body": "@csrf", + "description": "form csrf field" + }, + "method": { + "prefix": "b:method", + "body": "@method($1)", + "description": "form method field" + }, + "dump": { + "prefix": "b:dump", + "body": "@dump($1)", + "description": "dump" + }, + "dd": { + "prefix": "b:dd", + "body": "@dd($1)", + "description": "dump and die" + }, + "lang": { + "prefix": "b:lang", + "body": "@lang('${1:messages.welcome}')", + "description": "lang" + }, + "includeUnless": { + "prefix": "b:includeUnless", + "body": "@includeUnless(${1:\\$boolean}, '${2:view.name}', [${3:'some' => 'data'}])", + "description": "includeUnless" + }, + "props": { + "prefix": "b:props", + "body": "@props(['${1:propName}'])", + "description": "Blade component data properties" + }, + "env": { + "prefix": "b:env", + "body": [ + "@env('${1:staging}')", + " $2", + "@endenv" + ], + "description": "env" + }, + "production": { + "prefix": "b:production", + "body": [ + "@production", + " $1", + "@endproduction" + ], + "description": "production" + }, + "once": { + "prefix": "b:once", + "body": [ + "@once", + " $1", + "@endonce" + ], + "description": "define a portion of template that will only be evaluated once per rendering cycle" + }, + "aware": { + "prefix": "b:aware", + "body": "@aware(['${1:propName}'])", + "description": "Accessing data from a parent component (Laravel 8.64)" + }, + "js": { + "prefix": "b:js", + "body": "@js(${1:\\$data})", + "description": "This directive is useful to properly escape JSON within HTML quotes" + }, + "class": { + "prefix": "b:class", + "body": "@class(['${1:p-4}', ${2:'font-bold' => true}])", + "description": "conditionally compiles a CSS class string. (Laravel 8.51)" + }, + "checked": { + "prefix": "b:checked", + "body": "@checked(${1:true})", + "description": "This directive will echo checked if the provided condition evaluates to true (Laravel 9.x)" + }, + "selected": { + "prefix": "b:selected", + "body": "@selected(${1:true})", + "description": "The @selected directive may be used to indicate if a given select option should be \"selected\" (Laravel 9.x)" + }, + "disabled": { + "prefix": "b:disabled", + "body": "@disabled(${1:true})", + "description": "The @disabled directive may be used to indicate if a given element should be \"disabled\" (Laravel 9.x)" + }, + "style": { + "prefix": "b:style", + "body": "@style($1)", + "description": "The @style directive may be used to conditionally add inline CSS styles to an HTML element (Laravel 9.x)" + }, + "readonly": { + "prefix": "b:readonly", + "body": "@readonly(${1:true})", + "description": "The @readonly directive may be used to indicate if a given element should be \"readonly\" (Laravel 9.x)" + }, + "required": { + "prefix": "b:required", + "body": "@required(${1:true})", + "description": "The @required directive may be used to indicate if a given element should be \"required\" (Laravel 9.x)" + }, + "pushOnce": { + "prefix": "b:pushOnce", + "body": [ + "@pushOnce('${1:scripts}')", + " $2", + "@endPushOnce" + ], + "description": "Combine @once and @push for convenience (Laravel 9.x)" + }, + "prepend": { + "prefix": "b:prepend", + "body": [ + "@prepend('${1:scripts}')", + " $2", + "@prepend" + ], + "description": "prepend content to a stack" + }, + "prependOnce": { + "prefix": "b:prependOnce", + "body": [ + "@prependOnce('${1:scripts}')", + " $2", + "@endPrependOnce" + ], + "description": "Combine @once and @prepend for convenience (Laravel 9.x)" + } +} diff --git a/snippets/frameworks/vue/html.json b/snippets/frameworks/vue/html.json index 79a221a3..fdce2051 100644 --- a/snippets/frameworks/vue/html.json +++ b/snippets/frameworks/vue/html.json @@ -1,285 +1,337 @@ { - "template": { - "prefix": "template", - "body": [ - "" - ], - "description": "template element" - }, - "v-text": { - "prefix": "vText", - "body": ["v-text=\"${1:msg}\""], - "description": "Expects: string. Updates the element’s textContent." - }, - "v-html": { - "prefix": "vHtml", - "body": ["v-html=\"${1:html}\""], - "description": "Expects: string. Updates the element’s innerHTML." - }, - "v-show": { - "prefix": "vShow", - "body": ["v-show=\"${1:condition}\""], - "description": "Expects: any" - }, - "v-if": { - "prefix": "vIf", - "body": ["v-if=\"${1:condition}\""], - "description": "Expects: any" - }, - "v-else": { - "prefix": "vElse", - "body": ["v-else"], - "description": "Does not expect expression. previous sibling element must have v-if or v-else-if." - }, - "v-else-if": { - "prefix": "vElseIf", - "body": ["v-else-if=\"${1:condition}\""], - "description": "Expects: any. previous sibling element must have v-if or v-else-if." - }, - "v-for-without-key": { - "prefix": "vForWithoutKey", - "body": ["v-for=\"${1:item} in ${2:items}\""], - "description": "Expects: Array | Object | number | string" - }, - "v-for": { - "prefix": "vFor", - "body": [ - "v-for=\"(${1:item}, ${2:index}) in ${3:items}\" :key=\"${4:index}\"" - ], - "description": "Expects: Array | Object | number | string" - }, - "v-on": { - "prefix": "vOn", - "body": ["v-on:${1:event}=\"${2:handle}\""], - "description": "Expects: Function | Inline Statement" - }, - "v-on-shortcut": { - "prefix": "@", - "body": ["@${1:event}=\"${2:handle}\""], - "description": "v-on shortcut from vue 3" - }, - "v-bind": { - "prefix": "vBind", - "body": ["v-bind$1=\"${2}\""], - "description": "Expects: any (with argument) | Object (without argument)" - }, - "v-model": { - "prefix": "vModel", - "body": ["v-model=\"${1:something}\""], - "description": "Expects: varies based on value of form inputs element or output of components" - }, - "v-slot": { - "prefix": "vSlot", - "body": ["v-slot$1=\"${2}\""], - "description": "Expects: JavaScript expression that is valid in a function argument position (supports destructuring in supported environments). Optional - only needed if expecting props to be passed to the slot." - }, - "v-pre": { - "prefix": "vPre", - "body": ["v-pre"], - "description": "Does not expect expression" - }, - "v-cloak": { - "prefix": "vCloak", - "body": ["v-cloak"], - "description": "Does not expect expression" - }, - "v-once": { - "prefix": "vOnce", - "body": ["v-once"], - "description": "Does not expect expression" - }, - "key": { - "prefix": "key", - "body": [":key=\"${1:key}\""], - "description": "Expects: string. Children of the same common parent must have unique keys. Duplicate keys will cause render errors." - }, - "ref": { - "prefix": "ref", - "body": ["ref=\"${1:reference}\"$0"], - "description": "Expects: string. ref is used to register a reference to an element or a child component. The reference will be registered under the parent component’s $refs object. If used on a plain DOM element, the reference will be that element; if used on a child component, the reference will be component instance." - }, - "slotA": { - "prefix": "slotA", - "body": ["slot=\"$1\"$0"], - "description": "slot=''. Expects: string. Used on content inserted into child components to indicate which named slot the content belongs to." - }, - "slotE": { - "prefix": "slotE", - "body": ["$2$0"], - "description": ". Expects: string. Used on content inserted into child components to indicate which named slot the content belongs to." - }, - "slotScope": { - "prefix": "slotScope", - "body": ["slot-scope=\"$1\"$0"], - "description": "Used to denote an element or component as a scoped slot. The attribute’s value should be a valid JavaScript expression that can appear in the argument position of a function signature. This means in supported environments you can also use ES2015 destructuring in the expression. Serves as a replacement for scope in 2.5.0+." - }, - "scope": { - "prefix": "scope", - "body": ["scope=\"${1:this api replaced by slot-scope in 2.5.0+}\"$0"], - "description": "Used to denote a