├── .editorconfig ├── .github └── workflows │ └── format.yml ├── LICENSE ├── README.md ├── debug ├── lazy-nvim.lua └── packer-nvim.lua ├── package.json └── snippets ├── PowerShell.json ├── asciidoc.json ├── beancount.json ├── c ├── c.json └── cdoc.json ├── cmake.json ├── cobol ├── vscode_cobol-compound.json ├── vscode_cobol.json ├── vscode_cobol_dir.json └── vscode_cobol_jcl.json ├── cpp ├── cpp.json └── cppdoc.json ├── csharp ├── csharp.json └── csharpdoc.json ├── css.json ├── dart.json ├── docker ├── docker-compose.json └── docker_file.json ├── editorconfig.json ├── eelixir.json ├── elixir.json ├── erb.json ├── erlang.json ├── fennel.json ├── fortran.json ├── frameworks ├── angular │ ├── html.json │ ├── jsonc.json │ └── typescript.json ├── blade │ ├── blade.json │ ├── helpers.json │ ├── livewire.json │ └── snippets.json ├── django │ ├── admin.json │ ├── django_rest │ │ ├── serializers.json │ │ └── views.json │ ├── forms.json │ ├── models.json │ ├── tags.json │ ├── urls.json │ └── views.json ├── djangohtml.json ├── edge.json ├── ejs.json ├── flutter.json ├── jekyll.json ├── rails.json ├── relm4 │ ├── components.json │ ├── factories.json │ ├── templates.json │ └── workers.json ├── remix-ts.json ├── twig.json ├── unity.json ├── unreal.json └── vue │ ├── html.json │ ├── nuxt-html.json │ ├── nuxt-script.json │ ├── script.json │ ├── style.json │ └── vue.json ├── fsh.json ├── gdscript.json ├── gitcommit.json ├── gleam.json ├── global.json ├── glsl.json ├── go.json ├── haskell.json ├── html.json ├── java ├── java-tests.json ├── java.json └── javadoc.json ├── javascript ├── javascript.json ├── jsdoc.json ├── next-ts.json ├── next.json ├── react-es7.json ├── react-native-ts.json ├── react-native.json ├── react-ts.json ├── react.json ├── tsdoc.json └── typescript.json ├── julia.json ├── kivy.json ├── kotlin ├── kdoc.json └── kotlin.json ├── kubernetes.json ├── latex.json ├── latex ├── bibtex.json ├── latex-snippets.json └── vscode-latex-snippets.json ├── license.json ├── liquid.json ├── loremipsum.json ├── lua ├── lua.json └── luadoc.json ├── make.json ├── markdown.json ├── mint.json ├── nix.json ├── norg.json ├── nushell.json ├── objc.json ├── ocaml ├── dune-project.json ├── dune.json ├── ocaml.json └── ocamllex.json ├── org.json ├── perl.json ├── php ├── php.json └── phpdoc.json ├── plantuml.json ├── purescript.json ├── python ├── comprehension.json ├── debug.json ├── pydoc.json ├── python.json └── unittest.json ├── quarto.json ├── r.json ├── reason.json ├── rescript.json ├── rmarkdown.json ├── rst.json ├── ruby ├── rdoc.json ├── rspec.json └── ruby.json ├── rust ├── rust.json └── rustdoc.json ├── scala.json ├── shell ├── shell.json └── shelldoc.json ├── solidity.json ├── sql.json ├── svelte.json ├── swift.json ├── systemverilog.json ├── tcl.json ├── terraform.json ├── verilog.json ├── vhdl.json └── zig.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | 7 | [*.json] 8 | indent_style = space 9 | indent_size = 4 10 | 11 | [*.lua] 12 | indent_style = tab 13 | indent_size = 4 14 | 15 | [*.md] 16 | indent_style = space 17 | indent_size = 2 18 | 19 | [*.yml] 20 | indent_style = space 21 | indent_size = 2 22 | -------------------------------------------------------------------------------- /.github/workflows/format.yml: -------------------------------------------------------------------------------- 1 | name: Format JSON files 2 | 3 | # Controls when the workflow will run 4 | on: 5 | # Triggers the workflow on push or pull request events but only for the "main" branch 6 | push: 7 | branches: [ "main" ] 8 | 9 | # Allows you to run this workflow manually from the Actions tab 10 | workflow_dispatch: 11 | 12 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 13 | jobs: 14 | prettier: 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v3 20 | with: 21 | # Make sure the actual branch is checked out when running on pull requests 22 | ref: ${{ github.head_ref }} 23 | 24 | - name: Format JSON 25 | uses: creyD/prettier_action@v4.3 26 | with: 27 | commit_message: "CI: format JSON files" 28 | only_changed: true 29 | # This part is also where you can pass other options, for example: 30 | prettier_options: --tab-width 4 --parser json --write **/*.json 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Rafael Madriz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Friendly Snippets 2 | 3 | Snippets collection for a set of different programming languages. 4 | 5 | The only goal is to have one community driven repository for all kinds of 6 | snippets in all programming languages, this way you can have it all in one 7 | place. 8 | 9 | ## Install 10 | 11 | Use your plugin manager of choice, e.g. 12 | 13 | ### With Lazy.nvim 14 | 15 | ```lua 16 | { "rafamadriz/friendly-snippets" } 17 | ``` 18 | 19 | > [!WARNING] 20 | > If you're using LuaSnip make sure to use 21 | > `require("luasnip.loaders.from_vscode").lazy_load()`, and add 22 | > `friendly-snippets` as a dependency for LuaSnip, otherwise snippets might not 23 | > be detected. If you don't use `lazy_load()` you might notice a slower 24 | > startup-time 25 | > 26 | > ```lua 27 | > { 28 | > "L3MON4D3/LuaSnip", 29 | > dependencies = { "rafamadriz/friendly-snippets" }, 30 | > } 31 | > ``` 32 | 33 | ### With Packer 34 | 35 | ```lua 36 | use "rafamadriz/friendly-snippets" 37 | ``` 38 | 39 | ### With vim-plug 40 | 41 | ```vim 42 | Plug "rafamadriz/friendly-snippets" 43 | ``` 44 | 45 | ### With coc.nvim 46 | 47 | ```vim 48 | :CocInstall https://github.com/rafamadriz/friendly-snippets@main 49 | ``` 50 | 51 | ## Usage 52 | 53 | This collection of snippets should work with any snippet engine that supports 54 | loading vscode snippets. Like for example: 55 | 56 | - [vim-vsnip](https://github.com/hrsh7th/vim-vsnip) 57 | - [LuaSnip](https://github.com/L3MON4D3/LuaSnip) 58 | - [coc-snippets](https://github.com/neoclide/coc-snippets) 59 | 60 | ## Add snippets from a framework to a filetype. 61 | 62 | > [!NOTE] 63 | > This is handled by your snippet engine and has nothing to do with this snippets collection 64 | 65 | There's extra snippets included in this repo but they are not added by default, 66 | since it would be irrelevant for people not using those frameworks. See 67 | [`snippets/frameworks`](https://github.com/rafamadriz/friendly-snippets/tree/main/snippets/frameworks) 68 | 69 | For example: if you want to add rails snippets to ruby. 70 | 71 | With LuaSnip: 72 | 73 | ```lua 74 | require'luasnip'.filetype_extend("ruby", {"rails"}) 75 | ``` 76 | 77 | With vim-vsnip: 78 | 79 | ```viml 80 | let g:vsnip_filetypes.ruby = ['rails'] 81 | ``` 82 | 83 | ## Excluding snippets 84 | 85 | > [!NOTE] 86 | > This is handled by your snippet engine and has nothing to do with this snippets collection 87 | 88 | With LuaSnip, see `help luasnip-loaders` 89 | 90 | ```lua 91 | -- will exclude all javascript snippets 92 | require("luasnip.loaders.from_vscode").load { 93 | exclude = { "javascript" }, 94 | } 95 | ``` 96 | 97 | ## Showcase 98 | 99 | ### HTML 100 | 101 |  102 | 103 | ### JS 104 | 105 |  106 | 107 | ## TODO 108 | 109 | - Add all included snippets to the 110 | [Wiki](https://github.com/rafamadriz/friendly-snippets/wiki). 111 | 112 | ## Thanks to all contributors 113 | 114 | 115 | 116 | 117 | 118 | ## Credits 119 | 120 | A good portion of the snippets have been forked from the following repositories: 121 | 122 | - [vscode-standardjs-snippets](https://github.com/capaj/vscode-standardjs-snippets) 123 | - [python-snippets](https://github.com/cstrap/python-snippets) 124 | - [vs-snippets](https://github.com/kitagry/vs-snippets) 125 | - [Wscats/html-snippets](https://github.com/Wscats/html-snippets) 126 | - [Harry-Ross/vscode-c-snippets](https://github.com/Harry-Ross/vscode-c-snippets) 127 | - [vscode-jekyll-snippets](https://github.com/edheltzel/vscode-jekyll-snippets) 128 | - [vscode-fortran-support](https://github.com/krvajal/vscode-fortran-support) 129 | - [vscode_cobol](https://github.com/spgennard/vscode_cobol) 130 | - [VSCode-LaTeX-Snippets](https://github.com/JeffersonQin/VSCode-LaTeX-Snippets) 131 | - [vscode-react-javascript-snippets](https://github.com/dsznajder/vscode-react-javascript-snippets) 132 | - [honza/vim-snippets - Verilog](https://github.com/honza/vim-snippets/blob/master/snippets/verilog.snippets) 133 | - [vscode-relm4-snippets](https://github.com/Relm4/vscode-relm4-snippets) 134 | - And more... 135 | -------------------------------------------------------------------------------- /debug/lazy-nvim.lua: -------------------------------------------------------------------------------- 1 | local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp" 2 | local install_dir = temp_dir .. "/lazy-nvim" 3 | 4 | -- set stdpaths to use "/tmp/lazy-nvim" 5 | for _, name in ipairs({ "config", "data", "state", "cache" }) do 6 | vim.env[("XDG_%s_HOME"):format(name:upper())] = install_dir .. "/" .. name 7 | end 8 | 9 | -- bootstrap lazy 10 | local lazypath = install_dir .. "/plugins/lazy.nvim" 11 | if not vim.loop.fs_stat(lazypath) then 12 | vim.fn.system({ 13 | "git", 14 | "clone", 15 | "--filter=blob:none", 16 | "--single-branch", 17 | "https://github.com/folke/lazy.nvim.git", 18 | lazypath, 19 | }) 20 | end 21 | vim.opt.runtimepath:prepend(lazypath) 22 | 23 | -- install plugins 24 | -- modify according to which snippet engine,etc you're using 25 | local plugins = { 26 | "rafamadriz/friendly-snippets", 27 | { 28 | -- snippet engine is necessary to load snippets 29 | "L3MON4D3/LuaSnip", 30 | config = function() 31 | require("luasnip.loaders.from_vscode").load({}) 32 | end, 33 | }, 34 | { 35 | -- completion engine is not needed but makes debuggin much easir 36 | -- since you type and instantly see if snippets are being loaded 37 | "hrsh7th/nvim-cmp", 38 | config = function() 39 | local cmp = require("cmp") 40 | cmp.setup({ 41 | snippet = { 42 | expand = function(args) 43 | require("luasnip").lsp_expand(args.body) 44 | end, 45 | }, 46 | mapping = cmp.mapping.preset.insert({ 47 | [""] = cmp.mapping.scroll_docs(-4), 48 | [""] = cmp.mapping.scroll_docs(4), 49 | [""] = cmp.mapping.complete(), 50 | [""] = cmp.mapping.abort(), 51 | [""] = cmp.mapping.confirm({ select = true }), 52 | }), 53 | sources = cmp.config.sources({ 54 | { name = "luasnip" }, 55 | }), 56 | }) 57 | end, 58 | }, 59 | -- cmp completion source for snippets 60 | "saadparwaiz1/cmp_luasnip", 61 | } 62 | require("lazy").setup(plugins, { 63 | root = install_dir .. "/plugins", 64 | }) 65 | 66 | vim.opt.termguicolors = true 67 | -------------------------------------------------------------------------------- /debug/packer-nvim.lua: -------------------------------------------------------------------------------- 1 | local on_windows = vim.loop.os_uname().version:match("Windows") 2 | 3 | local function join_paths(...) 4 | local path_sep = on_windows and "\\" or "/" 5 | local result = table.concat({ ... }, path_sep) 6 | return result 7 | end 8 | 9 | vim.cmd([[set runtimepath=$VIMRUNTIME]]) 10 | 11 | local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp" 12 | 13 | vim.cmd("set packpath=" .. join_paths(temp_dir, "packer-nvim", "site")) 14 | 15 | local package_root = join_paths(temp_dir, "packer-nvim", "site", "pack") 16 | local install_path = join_paths(package_root, "packer", "start", "packer.nvim") 17 | local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua") 18 | 19 | -- install plugins 20 | -- modify according to which snippet engine,etc you're using 21 | local function load_plugins() 22 | require("packer").startup({ 23 | { 24 | "wbthomason/packer.nvim", 25 | "rafamadriz/friendly-snippets", 26 | "L3MON4D3/LuaSnip", -- snippet engine is necessary to load snippets 27 | -- completion engine is not needed but makes debuggin much easir 28 | -- since you type and instantly see if snippets are being loaded 29 | "hrsh7th/nvim-cmp", 30 | "saadparwaiz1/cmp_luasnip", -- cmp completion source for snippets 31 | }, 32 | config = { 33 | package_root = package_root, 34 | compile_path = compile_path, 35 | }, 36 | }) 37 | end 38 | 39 | _G.load_config = function() 40 | local cmp = require("cmp") 41 | 42 | cmp.setup({ 43 | snippet = { 44 | expand = function(args) 45 | require("luasnip").lsp_expand(args.body) 46 | end, 47 | }, 48 | mapping = cmp.mapping.preset.insert({ 49 | [""] = cmp.mapping.scroll_docs(-4), 50 | [""] = cmp.mapping.scroll_docs(4), 51 | [""] = cmp.mapping.complete(), 52 | [""] = cmp.mapping.abort(), 53 | [""] = cmp.mapping.confirm({ select = true }), 54 | }), 55 | sources = cmp.config.sources({ 56 | { name = "luasnip" }, 57 | }), 58 | }) 59 | 60 | require("luasnip.loaders.from_vscode").load({}) 61 | end 62 | 63 | if vim.fn.isdirectory(install_path) == 0 then 64 | vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path }) 65 | load_plugins() 66 | require("packer").sync() 67 | vim.cmd([[autocmd User PackerComplete ++once lua load_config()]]) 68 | else 69 | load_plugins() 70 | require("packer").sync() 71 | _G.load_config() 72 | end 73 | -------------------------------------------------------------------------------- /snippets/beancount.json: -------------------------------------------------------------------------------- 1 | { 2 | "option": { 3 | "prefix": "option", 4 | "body": [ 5 | "option \"${1:name}\" \"${2:value}\"", 6 | "$0" 7 | ], 8 | "description": "Add option." 9 | }, 10 | 11 | "open directive": { 12 | "prefix": "open", 13 | "body": [ 14 | "${1:$CURRENT_YEAR}-${2:$CURRENT_MONTH}-${3:$CURRENT_DATE} open ${4|Assets:,Liabilities:,Equity:,Income:,Expenses:|} ${5:[ConstraintCurrency] [BookingMethod]}", 15 | "$0" 16 | ], 17 | "description": "Open an account." 18 | }, 19 | 20 | "close directive": { 21 | "prefix": "close", 22 | "body": [ 23 | "${1:$CURRENT_YEAR}-${2:$CURRENT_MONTH}-${3:$CURRENT_DATE} close ${4|Assets:,Liabilities:,Equity:,Income:,Expenses:|}", 24 | "$0" 25 | ], 26 | "description": "Close an account." 27 | }, 28 | 29 | "commoditiy directive": { 30 | "prefix": "commodity", 31 | "body": [ 32 | "${1:$CURRENT_YEAR}-${2:$CURRENT_MONTH}-${3:$CURRENT_DATE} commodity ${4:ISO/Ticker}", 33 | " name: \"${5:FullName}\"", 34 | " asset-class: \"${6|cash,stock|}\"", 35 | "$0" 36 | ], 37 | "description": "Add a commodity metadata (optional)." 38 | }, 39 | 40 | "completed transaction directive": { 41 | "prefix": "txn*", 42 | "body": [ 43 | "${1:$CURRENT_YEAR}-${2:$CURRENT_MONTH}-${3:$CURRENT_DATE} * \"${4:Payee}\" \"${5:Narration}\"", 44 | " $0" 45 | ], 46 | "description": "Add a completed transaction." 47 | }, 48 | 49 | "incomplete transaction directive": { 50 | "prefix": "txn!", 51 | "body": [ 52 | "${1:$CURRENT_YEAR}-${2:$CURRENT_MONTH}-${3:$CURRENT_DATE} ! \"${4:Payee}\" \"${5:Narration}\"", 53 | " $0" 54 | ], 55 | "description": "Add an incomplete transaction." 56 | }, 57 | 58 | "balance assertion": { 59 | "prefix": "balance", 60 | "body": [ 61 | "${1:$CURRENT_YEAR}-${2:$CURRENT_MONTH}-${3:$CURRENT_DATE} balance ${4|Assets:,Liabilities:,Equity:,Income:,Expenses:|} ${5:Amount}", 62 | "$0" 63 | ], 64 | "description": "Assert balance on given day." 65 | }, 66 | 67 | "pad": { 68 | "prefix": "pad", 69 | "body": [ 70 | "${1:$CURRENT_YEAR}-${2:$CURRENT_MONTH}-${3:$CURRENT_DATE} pad ${4:AccountTo} ${5:AccountFrom}", 71 | "$0" 72 | ], 73 | "description": "Pad balance between two accounts." 74 | }, 75 | 76 | "note": { 77 | "prefix": "note", 78 | "body": [ 79 | "${1:$CURRENT_YEAR}-${2:$CURRENT_MONTH}-${3:$CURRENT_DATE} note ${4|Assets:,Liabilities:,Equity:,Income:,Expenses:|} ${5:Description}", 80 | "$0" 81 | ], 82 | "description": "Insert a dated comment." 83 | }, 84 | 85 | "document": { 86 | "prefix": "document", 87 | "body": [ 88 | "${1:$CURRENT_YEAR}-${2:$CURRENT_MONTH}-${3:$CURRENT_DATE} document ${4|Assets:,Liabilities:,Equity:,Income:,Expenses:|} \"${5:PathToDocument}\"", 89 | "$0" 90 | ], 91 | "description": "Insert a dated document relating to a account." 92 | }, 93 | 94 | "price": { 95 | "prefix": "price", 96 | "body": [ 97 | "${1:$CURRENT_YEAR}-${2:$CURRENT_MONTH}-${3:$CURRENT_DATE} price ${4:Commodity} ${5:Price}", 98 | "$0" 99 | ], 100 | "description": "Add a dated price between commodities (for unrealized gains)." 101 | }, 102 | 103 | "event": { 104 | "prefix": "event", 105 | "body": [ 106 | "${1:$CURRENT_YEAR}-${2:$CURRENT_MONTH}-${3:$CURRENT_DATE} event \"${4:Key}\" \"${5:Value}\"", 107 | "$0" 108 | ], 109 | "description": "Add a dated event/variable to track." 110 | }, 111 | 112 | "plugin": { 113 | "prefix": "plugin", 114 | "body": [ 115 | "plugin \"${4:PluginName}\" \"${5:ConfigString}\"", 116 | "$0" 117 | ], 118 | "description": "Load a plugin." 119 | }, 120 | 121 | "include": { 122 | "prefix": "include", 123 | "body": [ 124 | "include \"${4:Filename}\"", 125 | "$0" 126 | ], 127 | "description": "Include a beancount file." 128 | }, 129 | 130 | "query": { 131 | "prefix": "query", 132 | "body": [ 133 | "${1:$CURRENT_YEAR}-${2:$CURRENT_MONTH}-${3:$CURRENT_DATE} query \"${4:Name}\" \"${5:SQLContents}\"", 134 | "$0" 135 | ], 136 | "description": "Insert query into the stream of transactions." 137 | }, 138 | 139 | "custom": { 140 | "prefix": "custom", 141 | "body": [ 142 | "${1:$CURRENT_YEAR}-${2:$CURRENT_MONTH}-${3:$CURRENT_DATE} custom \"${4:TypeName}\" ${5:Value...}", 143 | "$0" 144 | ], 145 | "description": "Add a custom directive." 146 | }, 147 | 148 | "pushtag": { 149 | "prefix": "pushtag", 150 | "body": [ 151 | "pushtag #${1:TagName}", 152 | "$0" 153 | ], 154 | "description": "Push a tag onto the stack." 155 | }, 156 | 157 | "poptag": { 158 | "prefix": "poptag", 159 | "body": [ 160 | "poptag #${1:TagName}", 161 | "$0" 162 | ], 163 | "description": "Pop a tag from the stack." 164 | }, 165 | 166 | "budget": { 167 | "prefix": "budget", 168 | "body": [ 169 | "${1:$CURRENT_YEAR}-${2:$CURRENT_MONTH}-${3:$CURRENT_DATE} custom \"budget\" ${5:Expenses:} \"${6|daily,weekly,monthly,quaterly,yearly|}\" ${7:Amount}", 170 | "$0" 171 | ], 172 | "description": "Add a Fava compatible budget directive." 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /snippets/c/cdoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment": { 3 | "prefix": "/**", 4 | "body": [ 5 | "/**", 6 | " * ${1:A one-line summary.}", 7 | " *", 8 | " * ${2:Description.}$0", 9 | " *", 10 | " * @param ${4:name} ${5:Type and description of the parameter.}", 11 | " * @return ${3:Type and description of the returned value.}", 12 | " *", 13 | " * @example", 14 | " * // ${6:Description of my example.}", 15 | " * ${7:Write me later}", 16 | " */" 17 | ], 18 | "description": "A C comment block for functions, including short summary, details, param, return, and example." 19 | }, 20 | "comment_simple": { 21 | "prefix": "/*", 22 | "body": [ 23 | "/**", 24 | " * ${1:A one-line summary.}", 25 | " *", 26 | " * ${2:Description.}$0", 27 | " */" 28 | ], 29 | "description": "A simple C comment block for functions, including short summary, and details. Useful when you prefer to add the other documentation tags manually." 30 | }, 31 | "@param": { 32 | "prefix": "@param", 33 | "body": [ 34 | "@param ${1:name} ${2:Type and description of the parameter.}$0" 35 | ], 36 | "description": "Type and description of a function parameter." 37 | }, 38 | "@return": { 39 | "prefix": "@return", 40 | "body": [ 41 | "@return ${1:Type and description of the returned value.}$0" 42 | ], 43 | "description": "Type and description of the returned value." 44 | }, 45 | "@example": { 46 | "prefix": "@example", 47 | "body": [ 48 | "* @example", 49 | "* // ${1:Description of my example.}$0", 50 | "* ${2:Write me later}" 51 | ], 52 | "description": "Example that demostrates how to use a function. It can be used several times." 53 | }, 54 | "@note": { 55 | "prefix": "@note", 56 | "body": [ 57 | "@note ${1:Text.}$0" 58 | ], 59 | "description": "Anything worth mentioning that wouldn't fit in the description, or other documentation tags." 60 | }, 61 | "@warning": { 62 | "prefix": "@warning", 63 | "body": [ 64 | "@warning ${1:Text.}$0" 65 | ], 66 | "description": "Indicates special considerations when using the function." 67 | }, 68 | "@see": { 69 | "prefix": "@see", 70 | "body": [ 71 | "@see ${1:Text.}$0" 72 | ], 73 | "description": "References another function, or piece of documentation." 74 | }, 75 | "@deprecated": { 76 | "prefix": "@deprecated", 77 | "body": [ 78 | "@deprecated ${1:Text.}$0" 79 | ], 80 | "description": "Marks the function as deprecated, and no longer recommended for use." 81 | }, 82 | "@todo": { 83 | "prefix": "@todo", 84 | "body": [ 85 | "@todo ${1:Text.}$0" 86 | ], 87 | "description": "Used to mark areas of the code that require improvement." 88 | }, 89 | "@fixme": { 90 | "prefix": "@fixme", 91 | "body": [ 92 | "@fixme ${1:Text.}$0" 93 | ], 94 | "description": "Used to mark areas of the code that require fixing." 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /snippets/cobol/vscode_cobol-compound.json: -------------------------------------------------------------------------------- 1 | { 2 | "ep0": { 3 | "prefix": "ep0", 4 | "body": ["exit program returning ${1:0}"], 5 | "description": "exit program returning [0]", 6 | "scope": "cobol,acucobol" 7 | }, 8 | "sr0": { 9 | "prefix": "sr0", 10 | "body": ["stop run returning ${1:0}"], 11 | "description": "stop run returing [0]", 12 | "scope": "cobol,acucobol" 13 | }, 14 | "gr0": { 15 | "prefix": "gr0", 16 | "body": ["goback returning ${1:0}"], 17 | "description": "goback returning [0]", 18 | "scope": "cobol,acucobol" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /snippets/cobol/vscode_cobol_dir.json: -------------------------------------------------------------------------------- 1 | { 2 | "dialect": { 3 | "prefix": "dialect", 4 | "body": [ 5 | "dialect\"${2|ans85,bs2000,bs2000-offload,cob370,cob371,cob372,entcobol,mf,mvs,os390,osvs,vsc21,vsc22,vsc23,vsc24|}\"", 6 | "$0" 7 | ] 8 | }, 9 | "sourceformat": { 10 | "prefix": "sourceformat", 11 | "body": ["sourceformat\"${2|free,variable,fixed|}\"", "$0"] 12 | }, 13 | "jvmgen": { 14 | "prefix": "jvmgen", 15 | "body": ["jvmgen\"${2|sub|}\"", "$0"] 16 | }, 17 | "ilgen": { 18 | "prefix": "ilgen", 19 | "body": ["ilgen\"${2|sub|}\"", "$0"] 20 | }, 21 | "copypath": { 22 | "prefix": "copypath", 23 | "body": ["copypath\"\\$COBCPY;$1\"", "$0"] 24 | }, 25 | "speed - native": { 26 | "prefix": "speed", 27 | "body": [ 28 | "nocheck", 29 | "fastcall", 30 | "fastinit", 31 | "nolinkcheck", 32 | "lnkalign", 33 | "noparamcountcheck", 34 | "$0" 35 | ] 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /snippets/cobol/vscode_cobol_jcl.json: -------------------------------------------------------------------------------- 1 | { 2 | "Job/ADDRSPC": { 3 | "scope": "JCL", 4 | "prefix": "ADDRSPC", 5 | "body": ["ADDRSPC=${2|VIRT,REAL|}${3|\\,|}"], 6 | "description": "ADDRSPC Parameter" 7 | }, 8 | "JOB/BYTES": { 9 | "scope": "JCL", 10 | "prefix": "BYTES", 11 | "body": ["BYTES=${2:500},${3|CANCEL,DUMP,WARNING|}${4|\\,|}"], 12 | "description": "BYTES Parameter" 13 | }, 14 | "Job/CARDS": { 15 | "scope": "JCL", 16 | "prefix": "CARDS", 17 | "body": ["CARDS=${2:500},${3|CANCEL,DUMP,WARNING|}${4|\\,|}"], 18 | "description": "CARDS Parameter" 19 | }, 20 | "Job/COND": { 21 | "scope": "JCL", 22 | "prefix": "COND", 23 | "body": [ 24 | "COND=(${2:0},${3|GT,GE,EQ,LT,LE,NE|},${4:STEPNAME})${5|\\,|}" 25 | ], 26 | "description": "COND Parameter" 27 | }, 28 | "Job/DISP": { 29 | "scope": "JCL", 30 | "prefix": "DISP", 31 | "body": ["DISP=${2|NEW,CATLG,DELETE|}"], 32 | "description": "DISP Parameter, NEW = New data set, CATLG = Create a new catalog entry, DELETE = delete data set on abnormal termination" 33 | }, 34 | "Job/LRECL": { 35 | "scope": "JCL", 36 | "prefix": "LRECL", 37 | "body": ["LRECL=${2|80,132|}"], 38 | "description": "LRECL Parameter" 39 | }, 40 | "Job/IEFBR14": { 41 | "scope": "JCL", 42 | "prefix": "IEFBR14", 43 | "body": ["//${2:STEPID01} EXEC PGM=IEFBR14", "$0"], 44 | "description": "IEFBR14 Data set utility" 45 | }, 46 | "Job/IEBGENER ": { 47 | "scope": "JCL", 48 | "prefix": "IEBGENER ", 49 | "body": [ 50 | "//${2:STEPID01} EXEC PGM=IEBGENER ", 51 | "//SYSUT1 DD *", 52 | "${3}", 53 | "/*", 54 | "//SYSUT2 DD DISP=NEW,DSN=${4:A.B.C}", 55 | "//SYSPRINT DD SYSOUT=*", 56 | "$0" 57 | ], 58 | "description": "IEBGENER create/load a dataset" 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /snippets/cpp/cppdoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment": { 3 | "prefix": "/**", 4 | "body": [ 5 | "/**", 6 | " * ${1:A one-line summary.}", 7 | " *", 8 | " * ${2:Description.}$0", 9 | " *", 10 | " * @param ${4:name} ${5:Type and description of the parameter.}", 11 | " * @return ${3:Type and description of the returned value.}", 12 | " *", 13 | " * @example", 14 | " * // ${6:Description of my example.}", 15 | " * ${7:Write me later}", 16 | " */" 17 | ], 18 | "description": "A C++ comment block for functions, including description, param, return, and example." 19 | }, 20 | "comment_simple": { 21 | "prefix": "/*", 22 | "body": [ 23 | "/**", 24 | " * ${1:A one-line summary.}", 25 | " *", 26 | " * ${2:Description.}$0", 27 | " */" 28 | ], 29 | "description": "A simple C++ comment block for classes, including short summary, and details. Useful when you prefer to add the other documentation tags manually." 30 | }, 31 | "@param": { 32 | "prefix": "@param", 33 | "body": [ 34 | "@param ${1:name} ${2:Type and description of the parameter.}$0" 35 | ], 36 | "description": "Type and description of a function parameter." 37 | }, 38 | "@return": { 39 | "prefix": "@return", 40 | "body": [ 41 | "@return ${1:Type and description of the returned value.}$0" 42 | ], 43 | "description": "Type and description of the returned value." 44 | }, 45 | "@example": { 46 | "prefix": "@example", 47 | "body": [ 48 | "@example", 49 | "* // ${1:Description of my example.}$0", 50 | "* ${2:Write me later}" 51 | ], 52 | "description": "Example that demostrates how to use a function. It can be used several times." 53 | }, 54 | "@throws": { 55 | "prefix": "@throws", 56 | "body": [ 57 | "@throws ${1:ExceptionName} ${2:Description.}$0" 58 | ], 59 | "description": "Indicates the exceptions that can be thrown by a function. This tag is a synonym of @exception." 60 | }, 61 | "@exception": { 62 | "prefix": "@exception", 63 | "body": [ 64 | "@exception ${1:ExceptionName} ${2:Description.}$0" 65 | ], 66 | "description": "Indicates the exceptions that can be thrown by a function. This tag is a synonym of @throws." 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /snippets/dart.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": { 3 | "prefix": "main", 4 | "description": "Insert a main function, used as an entry point.", 5 | "body": ["void main(List args) {", " $0", "}"] 6 | }, 7 | "try": { 8 | "prefix": "try", 9 | "description": "Insert a try/catch block.", 10 | "body": ["try {", " $0", "} catch (${1:e}) {", "}"] 11 | }, 12 | "if": { 13 | "prefix": "if", 14 | "description": "Insert an if statement.", 15 | "body": ["if ($1) {", " $0", "}"] 16 | }, 17 | "if else": { 18 | "prefix": "ife", 19 | "description": "Insert an if statement with an else block.", 20 | "body": ["if ($1) {", " $0", "} else {", "}"] 21 | }, 22 | "switch case": { 23 | "prefix": "switch", 24 | "description": "Insert a switch statement.", 25 | "body": [ 26 | "switch ($1) {", 27 | " case $2:", 28 | " $0", 29 | " break;", 30 | " default:", 31 | "}" 32 | ] 33 | }, 34 | "for": { 35 | "prefix": "for", 36 | "description": "Insert a for loop.", 37 | "body": ["for (var i = 0; i < ${1:count}; i++) {", " $0", "}"] 38 | }, 39 | "for in": { 40 | "prefix": "fori", 41 | "description": "Insert a for-in loop.", 42 | "body": ["for (var ${1:item} in ${2:items}) {", " $0", "}"] 43 | }, 44 | "while": { 45 | "prefix": "while", 46 | "description": "Insert a while loop.", 47 | "body": ["while ($1) {", " $0", "}"] 48 | }, 49 | "do while": { 50 | "prefix": "do", 51 | "description": "Insert a do-while loop.", 52 | "body": ["do {", " $0", "} while ($1);"] 53 | }, 54 | "fun": { 55 | "prefix": "fun", 56 | "description": "Insert a function definition.", 57 | "body": ["${3:void} ${1:name}(${2:args}) {", " $0", "}"] 58 | }, 59 | "class": { 60 | "prefix": "class", 61 | "description": "Insert a class definition.", 62 | "body": ["class ${1:Name} {", " $0", "}"] 63 | }, 64 | "typedef": { 65 | "prefix": "typedef", 66 | "description": "Insert a typedef.", 67 | "body": "typedef ${1:Type} ${2:Name}(${3:params});" 68 | }, 69 | "test": { 70 | "prefix": "test", 71 | "description": "Insert a test block.", 72 | "body": ["test('$1', () {", " $0", "});"] 73 | }, 74 | "group": { 75 | "prefix": "group", 76 | "description": "Insert a test group block.", 77 | "body": ["group('$1', () {", " $0", "});"] 78 | }, 79 | "enum": { 80 | "prefix": "enum", 81 | "description": "Insert a enum.", 82 | "body": ["enum ${1:Name} {", " $0", "}"] 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /snippets/docker/docker_file.json: -------------------------------------------------------------------------------- 1 | { 2 | "FROM": { 3 | "prefix": "F", 4 | "body": "FROM ${1:ubuntu}" 5 | }, 6 | "Label maintainer": { 7 | "prefix": "m", 8 | "body": "LABEL maintainer=\"${1:name}\"" 9 | }, 10 | "RUN": { 11 | "prefix": "R", 12 | "body": ["RUN ${1:command}"] 13 | }, 14 | 15 | "CMD": { 16 | "prefix": "C", 17 | "body": ["CMD ${1:command}"] 18 | }, 19 | 20 | "COPY": { 21 | "prefix": "cp", 22 | "body": ["COPY ${1:src} ${2:dest}"] 23 | }, 24 | 25 | "EXPOSE": { 26 | "prefix": "exp", 27 | "body": ["EXPOSE ${1:port}"] 28 | }, 29 | "ENV": { 30 | "prefix": "env", 31 | "body": ["ENV ${1:key} ${2: value}"] 32 | }, 33 | "ADD": { 34 | "prefix": "a", 35 | "body": ["ADD ${1:src} ${2:dst}"] 36 | }, 37 | "ENTRYPOINT": { 38 | "prefix": "ent", 39 | "body": "ENTRYPOINT ${1:command}" 40 | }, 41 | "VOLUME": { 42 | "prefix": "v", 43 | "body": "VOLUME [\"${1:path}\"]" 44 | }, 45 | "USER": { 46 | "prefix": "u", 47 | "body": "USER ${1:name}" 48 | }, 49 | "WORKDIR": { 50 | "prefix": "w", 51 | "body": "WORKDIR ${1:name}" 52 | }, 53 | "Update Packages": { 54 | "prefix": "upd", 55 | "body": [ 56 | "RUN echo \"deb http://archive.ubuntu.com/ubuntu ${1:precise} main universe\" > /etc/apt/sources.list; \\", 57 | "apt-get update && apt-get -y upgrade; \\ ", 58 | "${2}; \\", 59 | "rm -rf /var/lib/apt/lists/*" 60 | ] 61 | }, 62 | "HEAD": { 63 | "prefix": "head", 64 | "body": ["# ${1:description}", "# ", "# VERSION ${2:0.1.0}", "${3}"] 65 | }, 66 | "ONBUILD": { 67 | "prefix": "o", 68 | "body": "ONBUILD ${1}" 69 | }, 70 | "LABEL": { 71 | "prefix": "L", 72 | "body": "LABEL ${1:label}=\"${2:value}\"" 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /snippets/editorconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": { 3 | "prefix": "root", 4 | "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", 5 | "description": "Editorconfig root configuration" 6 | }, 7 | "indent_style": { 8 | "prefix": "istyle", 9 | "body": "indent_style = space", 10 | "description": "Indentation Style (tab or space)" 11 | }, 12 | "indent_size": { 13 | "prefix": "isize", 14 | "body": "indent_size = 2", 15 | "description": "Indentation Size (integer or 'tab')" 16 | }, 17 | "tab_width": { 18 | "prefix": "tw", 19 | "body": "tab_width = 4", 20 | "description": "Width of a single tabstop character" 21 | }, 22 | "end_of_line": { 23 | "prefix": "eol", 24 | "body": "end_of_line = lf", 25 | "description": "Line ending file format (lf, crlf, or cr)" 26 | }, 27 | "charset": { 28 | "prefix": "char", 29 | "body": "charset = utf-8", 30 | "description": "File character encoding (latin1, utf-8, utf-16be, utf-16le, utf-8-bom)" 31 | }, 32 | "trim_trailing_space": { 33 | "prefix": "tts", 34 | "body": "trim_trailing_whitespace = true", 35 | "description": "Denotes whether whitespace is removed from the end of lines" 36 | }, 37 | "insert_final_newline": { 38 | "prefix": "ifn", 39 | "body": "insert_final_newline = true", 40 | "description": "Denotes whether file should end with a newline" 41 | }, 42 | "max_line_length": { 43 | "prefix": "mll", 44 | "body": "max_line_length = 80", 45 | "description": "Forces hard line wrapping after the amount of characters specified. 'off' to turn off this feature." 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /snippets/eelixir.json: -------------------------------------------------------------------------------- 1 | { 2 | "%": { 3 | "prefix": "%", 4 | "body": "<% $0 %>" 5 | }, 6 | "=": { 7 | "prefix": "=", 8 | "body": "<%= $0 %>" 9 | }, 10 | "gettext": { 11 | "prefix": "gt", 12 | "body": "<%= gettext(\"$0\") %>" 13 | }, 14 | "for": { 15 | "prefix": "for", 16 | "body": ["<%= for ${1:item} <- ${2:items} do %>", " $0", "<% end %>"] 17 | }, 18 | "if": { 19 | "prefix": "if", 20 | "body": ["<%= if ${1} do %>", " $0", "<% end %>"] 21 | }, 22 | "ife": { 23 | "prefix": "ife", 24 | "body": ["<%= if ${1} do %>", " $2", "<% else %>", " $0", "<% end %>"] 25 | }, 26 | "lin": { 27 | "prefix": "lin", 28 | "body": "<%= link \"${1:Submit}\", to: ${2:\"/users\"}, method: ${3::delete} %>" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /snippets/elixir.json: -------------------------------------------------------------------------------- 1 | { 2 | "defmodule": { 3 | "prefix": "defmo", 4 | "body": ["defmodule ${1:module} do", " $0", "end"], 5 | "description": "Define a module" 6 | }, 7 | "def": { 8 | "prefix": "def", 9 | "body": ["def ${1:name}() do", " $0", "end"], 10 | "description": "Define a function" 11 | }, 12 | "defp": { 13 | "prefix": "defp", 14 | "body": ["defp ${1:name}() do", " $0", "end"], 15 | "description": "Define a private function" 16 | }, 17 | "df": { 18 | "prefix": "df", 19 | "body": "def ${1:name}(), do: $0", 20 | "description": "Define a one-liner function" 21 | }, 22 | "dfw": { 23 | "prefix": "dfw", 24 | "body": "def ${1:name}(${2:args}) when ${3:guard}, do: $0", 25 | "description": "Define a one-liner function with when guard" 26 | }, 27 | "IO.puts": { 28 | "prefix": "put", 29 | "body": "IO.puts($0)" 30 | }, 31 | "IO.inspect": { 32 | "prefix": "ins", 33 | "body": "IO.inspect($0)" 34 | }, 35 | "IO.inspect with label": { 36 | "prefix": "insl", 37 | "body": "IO.inspect($1, label: \"$0\")" 38 | }, 39 | "if .. do .. end": { 40 | "prefix": "if", 41 | "body": ["if ${1:condition} do", " $0", "end"] 42 | }, 43 | "if .. do:": { 44 | "prefix": "if:", 45 | "body": "if ${1:condition}, do: $0" 46 | }, 47 | "if .. do .. else .. end": { 48 | "prefix": "ife", 49 | "body": ["if ${1:condition} do", " $2", "else", " $0", "end"] 50 | }, 51 | "if .. do: .. else:": { 52 | "prefix": "ife:", 53 | "body": "if ${1:condition}, do: $2, else: $0" 54 | }, 55 | "cond": { 56 | "prefix": "cond", 57 | "body": ["cond do", " $1 -> ", " $0", "end"] 58 | }, 59 | "case": { 60 | "prefix": "case", 61 | "body": ["case $1 do", " $2 -> ", " $0", "end"] 62 | }, 63 | "for": { 64 | "prefix": "for", 65 | "body": ["for ${1:item} <- ${2:items} do", " $0", "end"] 66 | }, 67 | "def + doc": { 68 | "prefix": "defd", 69 | "body": [ 70 | "@doc \"\"\"", 71 | "${1:doc}", 72 | "\"\"\"", 73 | "def ${2:name} do", 74 | " $0", 75 | "end" 76 | ] 77 | }, 78 | "def + spec": { 79 | "prefix": "defs", 80 | "body": [ 81 | "@spec ${1:name}(${2:args}) :: ${3:no_return}", 82 | "def $1{4:args} do", 83 | " $0", 84 | "end" 85 | ] 86 | }, 87 | "def + doc + spec": { 88 | "prefix": "defsd", 89 | "body": [ 90 | "@doc \"\"\"", 91 | "${1:doc}", 92 | "\"\"\"", 93 | "@spec ${2:name}(${3:args}) :: ${4:no_return}", 94 | "def $2{5:args} do", 95 | " $0", 96 | "end" 97 | ] 98 | }, 99 | "do": { 100 | "prefix": "do", 101 | "body": ["do", " $0", "end"] 102 | }, 103 | "doc": { 104 | "prefix": "doc", 105 | "body": ["@doc \"\"\"", "$0", "\"\"\""] 106 | }, 107 | "doc s": { 108 | "prefix": "docs", 109 | "body": ["@doc ~S\"\"\"", "$0", "\"\"\""] 110 | }, 111 | "doc false": { 112 | "prefix": "docf", 113 | "body": "@doc false" 114 | }, 115 | "moduledoc": { 116 | "prefix": "mdoc", 117 | "body": ["@moduledoc \"\"\"", "$0", "\"\"\""] 118 | }, 119 | "moduledoc s": { 120 | "prefix": "mdocs", 121 | "body": ["@moduledoc ~S\"\"\"", "$0", "\"\"\""] 122 | }, 123 | "moduledoc false": { 124 | "prefix": "mdocf", 125 | "body": "@moduledoc false" 126 | }, 127 | "require": { 128 | "prefix": "req", 129 | "body": "require ${0:Logger}" 130 | }, 131 | "test": { 132 | "prefix": "test", 133 | "body": ["test \"${1:name}\" do", " $0", "end"] 134 | }, 135 | "des": { 136 | "prefix": "desc", 137 | "body": ["describe \"${1:test group subject}\" do", " $0", "end"] 138 | }, 139 | "IEx.pry": { 140 | "prefix": "pry", 141 | "body": ["require IEx; IEx.pry", "$0"] 142 | }, 143 | "pipe char": { 144 | "prefix": "p", 145 | "body": "|> $0" 146 | }, 147 | "pipe into each": { 148 | "prefix": ">e", 149 | "body": "|> Enum.each($0)" 150 | }, 151 | "pipe into map": { 152 | "prefix": ">m", 153 | "body": "|> Enum.map($0)" 154 | }, 155 | "pipe into filter": { 156 | "prefix": ">f", 157 | "body": "|> Enum.filter($0)" 158 | }, 159 | "pipe into reduce": { 160 | "prefix": ">r", 161 | "body": "|> Enum.reduce(${1:acc}, fn ${2}, ${3:acc} -> $0 end)" 162 | }, 163 | "word list": { 164 | "prefix": "wl", 165 | "body": "~w($0)" 166 | }, 167 | "atom list": { 168 | "prefix": "al", 169 | "body": "~w($0)a" 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /snippets/erb.json: -------------------------------------------------------------------------------- 1 | { 2 | "if": { 3 | "prefix": "if", 4 | "body": ["<% if ${1:truevalue} %>", " $2", "<% end %>"], 5 | "description": "if .. end" 6 | }, 7 | "else": { 8 | "prefix": "else", 9 | "body": ["<% else %>"], 10 | "description": "else" 11 | }, 12 | "elsif": { 13 | "prefix": "elsif", 14 | "body": ["<% elsif ${1:truevalue} %>"], 15 | "description": "elsif" 16 | }, 17 | "end": { 18 | "prefix": "end", 19 | "body": ["<% end %>"], 20 | "description": "end" 21 | }, 22 | "ife": { 23 | "prefix": "ife", 24 | "body": [ 25 | "<% if ${1:truevalue} %>", 26 | " $2", 27 | "<% else %>", 28 | " $3", 29 | "<% end %>" 30 | ], 31 | "description": "if .. else .. end" 32 | }, 33 | "unless": { 34 | "prefix": "unless", 35 | "body": ["<% unless ${1:falsevalue} %>", " $2", "<% end %>"], 36 | "description": "unless .. end" 37 | }, 38 | "unlesse": { 39 | "prefix": "unlesse", 40 | "body": [ 41 | "<% unless ${1:falsevalue} %>", 42 | " $2", 43 | "<% else %>", 44 | " $3", 45 | "<% end %>" 46 | ], 47 | "description": "unless .. end" 48 | }, 49 | "each": { 50 | "prefix": "each", 51 | "body": ["<% ${1:items}.each do |${2:item}| %>", " $3", "<% end %>"], 52 | "description": "each do" 53 | }, 54 | "render": { 55 | "prefix": ["pe", "="], 56 | "body": ["<%= $1 %>"], 57 | "description": "render block pe" 58 | }, 59 | "comment": { 60 | "prefix": ["pc"], 61 | "body": ["<%# $1 %>"], 62 | "description": "erb print comment" 63 | }, 64 | "exec": { 65 | "prefix": ["er", "%"], 66 | "body": ["<% $1 %>"], 67 | "description": "erb exec block" 68 | }, 69 | "link_to": { 70 | "prefix": ["lt"], 71 | "body": ["<%= link_to $1, $2 %>"], 72 | "description": "link_to helper" 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /snippets/erlang.json: -------------------------------------------------------------------------------- 1 | { 2 | "module": { 3 | "prefix": "mod", 4 | "body": "-module(${1:module}).", 5 | "description": "module" 6 | }, 7 | "include": { 8 | "prefix": "inc", 9 | "body": "-include(\"${1:hrl_name}.hrl\").", 10 | "description": "module" 11 | }, 12 | "define": { 13 | "prefix": "def", 14 | "body": "-define(${1:def_name}, ${2:def_value}).", 15 | "description": "define" 16 | }, 17 | "export": { 18 | "prefix": "exp", 19 | "body": ["-export([", " ${1}", " ])."], 20 | "description": "export" 21 | }, 22 | "if": { 23 | "prefix": "if", 24 | "body": [ 25 | "if ${1:Cond} ->", 26 | " ${2:todo};", 27 | " true ->", 28 | " ${3:todo}", 29 | "end$4" 30 | ], 31 | "description": "if block" 32 | }, 33 | "case": { 34 | "prefix": "case", 35 | "body": [ 36 | "case ${1:Expr} of", 37 | " ${2:Cond} ->", 38 | " ${3:todo};", 39 | " _ ->", 40 | " ${4:todo}", 41 | "end$5" 42 | ], 43 | "description": "case block" 44 | }, 45 | "receive": { 46 | "prefix": "rec", 47 | "body": [ 48 | "receive", 49 | " ${1:pattern} ->", 50 | " ${2:todo}", 51 | "end$3" 52 | ], 53 | "description": "receive block" 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /snippets/fennel.json: -------------------------------------------------------------------------------- 1 | { 2 | "fn": { 3 | "prefix": "fn", 4 | "body": "(fn ${1:name} [${2:params}]\n )", 5 | "description": "Create a function" 6 | }, 7 | "let": { 8 | "prefix": "let", 9 | "body": "(let [${1:name} ${2:value}])", 10 | "description": "Create a variable" 11 | }, 12 | "while": { 13 | "prefix": "while", 14 | "body": "(while (${1:condition})\n($0))", 15 | "description": "Create a while loop" 16 | }, 17 | "var": { 18 | "prefix": "var", 19 | "body": "(var ${1:name} ${2:value})", 20 | "description": "Create a variable with var" 21 | }, 22 | "local": { 23 | "prefix": "local", 24 | "body": "(local ${1:name} ${2:value})", 25 | "description": "Create a variable with local" 26 | }, 27 | "for": { 28 | "prefix": "for", 29 | "body": "(for [i 1 10]\n($0))", 30 | "description": "Create a for loop" 31 | }, 32 | "global": { 33 | "prefix": "global", 34 | "body": "(global $0)", 35 | "description": "Create a global" 36 | }, 37 | "require": { 38 | "prefix": "require", 39 | "body": "(require :${1:module})", 40 | "description": "Require a module" 41 | }, 42 | "create a table": { 43 | "prefix": "tbl", 44 | "body": "(let [${1:tbl} {}\n\t${2:key1} ${3:key1_value}])", 45 | "description": "Declaring a table" 46 | }, 47 | "set table value": { 48 | "prefix": "tset", 49 | "body": "(tset ${1:tbl} ${2:value})", 50 | "description": "Set a value in a table" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /snippets/frameworks/angular/html.json: -------------------------------------------------------------------------------- 1 | { 2 | "class": { 3 | "prefix": "a-class", 4 | "body": ["[class]=\"${1:expression}\""], 5 | "description": "Angular [class] binding" 6 | }, 7 | "style": { 8 | "prefix": "a-style", 9 | "body": ["[style.${1:property}]=\"${2:expression}\""], 10 | "description": "Angular [style] binding" 11 | }, 12 | "ngClass": { 13 | "prefix": "a-ngClass", 14 | "body": ["[ngClass]=\"{${1:cssClass}: ${2:expression}}\""], 15 | "description": "Angular ngClass" 16 | }, 17 | "ngFor": { 18 | "prefix": "a-ngFor", 19 | "body": ["*ngFor=\"let ${1:item} of ${2:list}\"${0}"], 20 | "description": "Angular *ngFor" 21 | }, 22 | "ngFor with trackBy": { 23 | "prefix": "a-ngFor-trackBy", 24 | "body": ["*ngFor=\"let ${1:item} of ${2:list}; trackBy:${1:item}.id\"${0}"], 25 | "description": "Angular *ngFor with trackBy" 26 | }, 27 | "ngForAsync": { 28 | "prefix": "a-ngForAsync", 29 | "body": ["*ngFor=\"let ${1:item} of ${2:stream} | async as ${3:list}\"${0}"], 30 | "description": "Angular *ngForAsync" 31 | }, 32 | "ngForm": { 33 | "prefix": "a-form", 34 | "body": ["", ""], 35 | "description": "Form with ngSubmit and form attributes" 36 | }, 37 | "ngFormArrayName": { 38 | "prefix": "a-formArrayName", 39 | "body": ["formArrayName=\"${1:control}\""], 40 | "description": "Angular formArrayName" 41 | }, 42 | "ngFormControlName": { 43 | "prefix": "a-formControlName", 44 | "body": ["formControlName=\"${1:control}\""], 45 | "description": "Angular formControlName" 46 | }, 47 | "ngFormGroup": { 48 | "prefix": "a-formGroup", 49 | "body": ["[formGroup]=\"${1:form}\""], 50 | "description": "Angular formGroup" 51 | }, 52 | "ngFormGroupName": { 53 | "prefix": "a-formGroupName", 54 | "body": ["[formGroupName]=\"${1:name}\""], 55 | "description": "Angular formGroupName" 56 | }, 57 | "ngFormSubmit": { 58 | "prefix": "a-form-submit", 59 | "body": ["", "\tSave", ""], 60 | "description": "Angular form submit" 61 | }, 62 | "ngIf": { 63 | "prefix": "a-ngIf", 64 | "body": ["*ngIf=\"${1:expression}\""], 65 | "description": "Angular *ngIf" 66 | }, 67 | "ngIfElse": { 68 | "prefix": "a-ngIfElse", 69 | "body": ["*ngIf=\"${1:expression};else ${2:templateName}\""], 70 | "description": "Angular *ngIfElse" 71 | }, 72 | "ngModel": { 73 | "prefix": "a-ngModel", 74 | "body": ["[(ngModel)]=\"${1:binding}\""], 75 | "description": "Angular ngModel" 76 | }, 77 | "ngRouterLink": { 78 | "prefix": "a-routerLink", 79 | "body": ["[routerLink]=\"['/${1:routePath}']\" routerLinkActive=\"${2:router-link-active}\" $0"], 80 | "description": "Angular routerLink" 81 | }, 82 | "ngRouterLinkWithParameter": { 83 | "prefix": "a-routerLink-param", 84 | "body": [ 85 | "[routerLink]=\"['${1:routePath}', ${2:routeParameterValue}]\"", 86 | "routerLinkActive=\"${3:router-link-active}\"$0" 87 | ], 88 | "description": "Angular routerLink with a route parameter" 89 | }, 90 | "ngSelect": { 91 | "prefix": "a-select", 92 | "body": [ 93 | "", 94 | "\t{{${2:item}}}", 95 | "" 96 | ], 97 | "description": " control with ngModel" 98 | }, 99 | "ngStyle": { 100 | "prefix": "a-ngStyle", 101 | "body": ["[ngStyle]=\"{${1:style}: ${2:expression}}\""], 102 | "description": "Angular ngStyle" 103 | }, 104 | "ngSwitch": { 105 | "prefix": "a-ngSwitch", 106 | "body": [ 107 | "", 108 | "\t${3:output}", 109 | "\t${4:output2}", 110 | "" 111 | ], 112 | "description": "Angular ngSwitch" 113 | }, 114 | "pre w/ json": { 115 | "prefix": "a-prej", 116 | "body": ["{{${1:model} | json}}$0"], 117 | "description": "Angular pre debug | json" 118 | }, 119 | "pre w/ async json": { 120 | "prefix": "a-preja", 121 | "body": ["{{${1:model} | async | json}}$0"], 122 | "description": "Angular pre debug | async | json" 123 | }, 124 | "ng-container": { 125 | "prefix": "a-ng-container", 126 | "body": [""], 127 | "description": "Angular ng-container" 128 | }, 129 | "ng-template": { 130 | "prefix": "a-ng-template", 131 | "body": [""], 132 | "description": "Angular ng-template" 133 | }, 134 | "ng-content": { 135 | "prefix": "a-ng-content", 136 | "body": [""], 137 | "description": "Angular ng-content" 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /snippets/frameworks/angular/jsonc.json: -------------------------------------------------------------------------------- 1 | { 2 | "Create launch config for Chrome": { 3 | "prefix": "a-launch-chrome", 4 | "body": [ 5 | "{", 6 | "\t\"name\": \"Launch Angular\",", 7 | "\t\"type\": \"${1:chrome}\",", 8 | "\t\"request\": \"launch\",", 9 | "\t\"preLaunchTask\": \"${2:npm: start}\",", 10 | "\t\"url\": \"http://localhost:${3:4200}/\",", 11 | "\t\"webRoot\": \"${4:\\${workspaceFolder\\}}\"", 12 | "}" 13 | ] 14 | }, 15 | "Create launch config for Edge": { 16 | "prefix": "a-launch-edge", 17 | "body": [ 18 | "{", 19 | "\t\"name\": \"Launch Angular\",", 20 | "\t\"type\": \"${1:edge}\",", 21 | "\t\"version\": \"${2:dev}\",", 22 | "\t\"request\": \"launch\",", 23 | "\t\"preLaunchTask\": \"${3:npm: start}\",", 24 | "\t\"url\": \"http://localhost:${4:4200}/\",", 25 | "\t\"webRoot\": \"${5:\\${workspaceFolder\\}}\"", 26 | "}" 27 | ] 28 | }, 29 | "Create task to start Angular": { 30 | "prefix": "a-task-start", 31 | "body": [ 32 | "{", 33 | "\t\"type\": \"npm\",", 34 | "\t\"script\": \"${1:start}\",", 35 | "\t\"isBackground\": true,", 36 | "\t\"presentation\": {", 37 | "\t\t\"focus\": true,", 38 | "\t\t\"panel\": \"dedicated\"", 39 | "\t},", 40 | "\t\"group\": {", 41 | "\t\t\"kind\": \"build\",", 42 | "\t\t\"isDefault\": true", 43 | "\t},", 44 | "\t\"problemMatcher\": {", 45 | "\t\t\"owner\": \"typescript\",", 46 | "\t\t\"source\": \"ts\",", 47 | "\t\t\"applyTo\": \"closedDocuments\",", 48 | "\t\t\"fileLocation\": [\"relative\", \"\\${cwd\\}\"],", 49 | "\t\t\"pattern\": \"\\$tsc\",", 50 | "\t\t\"background\": {", 51 | "\t\t\t\"activeOnStart\": true,", 52 | "\t\t\t\"beginsPattern\": {", 53 | "\t\t\t\t\"regexp\": \"(.*?)\"", 54 | "\t\t\t},", 55 | "\t\t\t\"endsPattern\": {", 56 | "\t\t\t\t\"regexp\": \"Compiled |Failed to compile.\"", 57 | "\t\t\t}", 58 | "\t\t}", 59 | "\t}", 60 | "}" 61 | ] 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /snippets/frameworks/blade/blade.json: -------------------------------------------------------------------------------- 1 | { 2 | "Blade-component": { 3 | "prefix": "Blade::component", 4 | "body": "Blade::component('${1:package-name}', ${2:PackageNameComponent}::class);", 5 | "description": "Registering Package Components (AppServiceProvider boot method)" 6 | }, 7 | "Blade-include": { 8 | "prefix": "Blade::include", 9 | "body": "Blade::include('${1:includes.input}', '${2:input}');", 10 | "description": "Aliasing Includes (AppServiceProvider boot method)" 11 | }, 12 | "Blade-if": { 13 | "prefix": "Blade::if", 14 | "body": [ 15 | "Blade::if('${1:env}', function ($${2:environment}) {", 16 | " ${3:return app()->environment($$environment);}", 17 | "});" 18 | ], 19 | "description": "Custom If Statements (AppServiceProvider boot method)" 20 | }, 21 | "Blade-directive": { 22 | "prefix": "Blade::directive", 23 | "body": [ 24 | "Blade::directive('${1:datetime}', function ($${2:expression}) {", 25 | " ${3:return \"format('m/d/Y H:i'); ?>\";}", 26 | "});" 27 | ], 28 | "description": "Custom directive (AppServiceProvider boot method)" 29 | }, 30 | "Blade-stringable": { 31 | "prefix": "Blade::stringable", 32 | "body": [ 33 | "Blade::stringable(function (${1:Money} $${2:money}) {", 34 | " ${3:return $$money->formatTo('en_GB');}", 35 | "});" 36 | ], 37 | "description": "Custom echo handlers (AppServiceProvider boot method)" 38 | }, 39 | "Blade-render": { 40 | "prefix": "Blade::render", 41 | "body": "Blade::render(${1:'Blade template string'}, ${2:\\$data});", 42 | "description": "Transform a raw Blade template string into valid HTML (Laravel 9.x)" 43 | }, 44 | "Blade-renderComponent": { 45 | "prefix": "Blade::renderComponent", 46 | "body": "Blade::renderComponent(new ${1:HelloComponent}(${2:\\$params}));", 47 | "description": "Render a given class component by passing the component instance to the method (Laravel 9.x)" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /snippets/frameworks/blade/helpers.json: -------------------------------------------------------------------------------- 1 | { 2 | "Path-elixir": { 3 | "prefix": "lv:elixir", 4 | "body": "{{ elixir('${1:file}') }}", 5 | "description": "(deprecated) elixir path" 6 | }, 7 | "Path-mix": { 8 | "prefix": "lv:mix", 9 | "body": "{{ mix('${1:file}') }}", 10 | "description": "mix path" 11 | }, 12 | "String-trans": { 13 | "prefix": "lv:trans", 14 | "body": "{{ trans('$1') }}", 15 | "description": "trans" 16 | }, 17 | "URL-action": { 18 | "prefix": "lv:action", 19 | "body": "{{ action('${1:ControllerName}', [${2:'id'=>1}]) }}", 20 | "description": "URL-action" 21 | }, 22 | "URL-secure-asset": { 23 | "prefix": "lv:secure-asset", 24 | "body": "{{ secure_asset('$1', ${2:\\$title}, ${3:\\$attributes=[]}) }}", 25 | "description": "URL-secure-asset" 26 | }, 27 | "URL-url": { 28 | "prefix": "lv:url", 29 | "body": "{{ url('${1:url}', [$2]) }}", 30 | "description": "URL-url" 31 | }, 32 | "URL-asset": { 33 | "prefix": "lv:asset", 34 | "body": "{{ asset('$1') }}", 35 | "description": "URL-asset" 36 | }, 37 | "URL-route": { 38 | "prefix": "lv:route", 39 | "body": "{{ route('${1:routeName}', [${2:'id'=>1}]) }}", 40 | "description": "URL-route" 41 | }, 42 | "Form-csrf-field": { 43 | "prefix": "lv:csrf-field", 44 | "body": "{{ csrf_field() }}", 45 | "description": "CSRF hidden field" 46 | }, 47 | "csrf-token": { 48 | "prefix": "lv:csrf-token", 49 | "body": "{{ csrf_token() }}", 50 | "description": "CSRF token" 51 | }, 52 | "Paginate-links": { 53 | "prefix": "lv:pagination-links", 54 | "body": "{{ \\$${1:collection}->links() }}", 55 | "description": "pagination links" 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /snippets/frameworks/blade/livewire.json: -------------------------------------------------------------------------------- 1 | { 2 | "livewireStyles": { 3 | "prefix": "livewire:styles", 4 | "body": "@livewireStyles", 5 | "description": "Livewire Styles directive" 6 | }, 7 | "livewireScripts": { 8 | "prefix": "livewire:scripts", 9 | "body": "@livewireScripts", 10 | "description": "Livewire Scripts directive" 11 | }, 12 | "livewire-component": { 13 | "prefix": "livewire:component", 14 | "body": "@livewire('${1:component}', ['${2:user}' => \\$${3:user}]${4:, key(\\$$3->id)})", 15 | "description": "Livewire nesting components" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /snippets/frameworks/django/admin.json: -------------------------------------------------------------------------------- 1 | { 2 | "adminview": { 3 | "prefix": "adminview", 4 | "body": [ 5 | "@admin.register(${1})", 6 | "class ${1}Admin(admin.ModelAdmin):", 7 | "\t'''Admin View for ${1}'''", 8 | "", 9 | "\tlist_display = ('${2}',)", 10 | "\tlist_filter = ('${3}',)", 11 | "\tinlines = [", 12 | "\t\t${4}Inline,", 13 | "\t]", 14 | "\traw_id_fields = ('${5}',)", 15 | "\treadonly_fields = ('${6}',)", 16 | "\tsearch_fields = ('${7}',)", 17 | "\tdate_hierarchy = '${8}'", 18 | "\tordering = ('${9}',)" 19 | ], 20 | "description": "Model Admin View", 21 | "scope": "source.python" 22 | }, 23 | "stackedinline": { 24 | "prefix": "stackedinline", 25 | "body": [ 26 | "class ${1}Inline(admin.StackedInline):", 27 | "\t'''Stacked Inline View for ${1}'''", 28 | "", 29 | "\tmodel = ${2:${1}}", 30 | "\tmin_num = ${3:3}", 31 | "\tmax_num = ${4:20}", 32 | "\textra = ${5:1}", 33 | "\traw_id_fields = (${6},)" 34 | ], 35 | "description": "Stacked Inline", 36 | "scope": "source.python" 37 | }, 38 | "tabularinline": { 39 | "prefix": "tabularinline", 40 | "body": [ 41 | "class ${1}Inline(admin.TabularInline):", 42 | "\t'''Tabular Inline View for ${1}'''", 43 | "", 44 | "\tmodel = ${2:${1}}", 45 | "\tmin_num = ${3:3}", 46 | "\tmax_num = ${4:20}", 47 | "\textra = ${5:1}", 48 | "\traw_id_fields = (${6},)" 49 | ], 50 | "description": "Tabular Inline", 51 | "scope": "source.python" 52 | }, 53 | "simplelistfilter": { 54 | "prefix": "simplelistfilter", 55 | "body": [ 56 | "class ${1:NAME}Filter(admin.SimpleListFilter):", 57 | "", 58 | "\ttitle = '$2'", 59 | "\tparameter_name = '$0'", 60 | "", 61 | "\tdef lookups(self, request, model_admin):", 62 | "\t\tpass", 63 | "", 64 | "\tdef queryset(self, request, queryset):", 65 | "\t\treturn queryset" 66 | ], 67 | "description": "Admin SimpleList Filter", 68 | "scope": "source.python" 69 | }, 70 | "iadmin": { 71 | "prefix": "iadmin", 72 | "body": "from django.contrib import admin", 73 | "description": "from ... import admin", 74 | "scope": "source.python" 75 | }, 76 | "iadminsite": { 77 | "prefix": "iadminsite", 78 | "body": "from django.contrib.admin import AdminSite", 79 | "description": "from ... import AdminSite", 80 | "scope": "source.python" 81 | }, 82 | "register": { 83 | "prefix": "register", 84 | "body": "admin.site.register($1)", 85 | "description": "register the model class without providing a ModelAdmin description.", 86 | "scope": "source.python" 87 | }, 88 | "registermadmin": { 89 | "prefix": "registermadmin", 90 | "body": "admin.site.register($1, $1Admin)", 91 | "description": "register the model class providing a ModelAdmin description", 92 | "scope": "source.python" 93 | }, 94 | "fieldsets": { 95 | "prefix": "fieldsets", 96 | "body": [ 97 | "fieldsets = (", 98 | "\t(None, {", 99 | "\t\t'fields': (", 100 | "\t\t\t$1", 101 | "\t\t),", 102 | "\t}),", 103 | ")" 104 | ], 105 | "description": "", 106 | "scope": "source.python" 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /snippets/frameworks/django/django_rest/views.json: -------------------------------------------------------------------------------- 1 | { 2 | "DRF APIView": { 3 | "prefix": "apiview", 4 | "body": ["class ${1:Name}APIView(APIView):", "\t${2}"], 5 | "description": "Django-rest Views ``APIView`` Class" 6 | }, 7 | "DRF CreateAPIView": { 8 | "prefix": "createapiview", 9 | "body": [ 10 | "class ${1:Name}CreateAPIView(generics.CreateAPIView):", 11 | "\tserializer_class = ${2:$1Serializer}" 12 | ], 13 | "description": "Django-rest Views ``CreateAPI`` Class" 14 | }, 15 | "DRF DestroyAPIView": { 16 | "prefix": "destroyapiview", 17 | "body": [ 18 | "class ${1:Name}DestroyAPIView(generics.DestroyAPIView):", 19 | "\tserializer_class = ${2:$1Serializer}", 20 | "\tqueryset = $1.objects.filter(${3})" 21 | ], 22 | "description": "Django-rest Views ``DestroyAPIView`` Class" 23 | }, 24 | "DRF ListAPIView": { 25 | "prefix": "listapiview", 26 | "body": [ 27 | "class ${1:Name}ListAPIView(generics.ListAPIView):", 28 | "\tserializer_class = ${2:$1Serializer}", 29 | "\tqueryset = $1.objects.filter(${3})" 30 | ], 31 | "description": "Django-rest Views ``ListAPIView`` Class" 32 | }, 33 | "DRF ListCreateAPIView": { 34 | "prefix": "listcreateapiview", 35 | "body": [ 36 | "class ${1:Name}ListCreateAPIView(generics.ListCreateAPIView):", 37 | "\tserializer_class = ${2:$1Serializer}", 38 | "\tqueryset = $1.objects.filter(${3})" 39 | ], 40 | "description": "Django-rest Views ``ListCreateAPIView`` Class" 41 | }, 42 | "DRF RetrieveAPIView": { 43 | "prefix": "retrieveapiview", 44 | "body": [ 45 | "class ${1:Name}RetrieveAPIView(generics.RetrieveAPIView):", 46 | "\tserializer_class = ${2:$1Serializer}", 47 | "\tqueryset = $1.objects.filter(${3})" 48 | ], 49 | "description": "Django-rest Views ``RetrieveAPIView`` Class" 50 | }, 51 | "DRF RetrieveDestroyAPIView": { 52 | "prefix": "retrievedestroyapiview", 53 | "body": [ 54 | "class ${1:Name}RetrieveDestroyAPIView(generics.RetrieveDestroyAPIView):", 55 | "\tserializer_class = ${2:$1Serializer}", 56 | "\tqueryset = $1.objects.filter(${3})" 57 | ], 58 | "description": "Django-rest Views ``RetrieveDestroyAPIView`` Class" 59 | }, 60 | "DRF RetrieveUpdateAPIView": { 61 | "prefix": "retrieveupdateapiview", 62 | "body": [ 63 | "class ${1:Name}RetrieveUpdateAPIView(generics.RetrieveUpdateAPIView):", 64 | "\tserializer_class = ${2:$1Serializer}", 65 | "\tqueryset = $1.objects.filter(${3})" 66 | ], 67 | "description": "Django-rest Views ``RetrieveUpdateAPIView`` Class" 68 | }, 69 | "DRF RetrieveUpdateDestroyAPIView": { 70 | "prefix": "retrieveupdatedestroyapiview", 71 | "body": [ 72 | "class ${1:Name}RetrieveUpdateDestroyAPIView(generics.RetrieveUpdateDestroyAPIView):", 73 | "\tserializer_class = ${2:$1Serializer}", 74 | "\tqueryset = $1.objects.filter(${3})" 75 | ], 76 | "description": "Django-rest Views ``RetrieveUpdateDestroyAPIView`` Class" 77 | }, 78 | "DRF UpdateAPIView": { 79 | "prefix": "updateapiview", 80 | "body": [ 81 | "class ${1:Name}UpdateAPIView(generics.UpdateAPIView):", 82 | "\tserializer_class = ${2:$1Serializer}", 83 | "\tqueryset = $1.objects.filter(${3})" 84 | ], 85 | "description": "Django-rest Views ``UpdateAPIView`` Class" 86 | }, 87 | 88 | "DRF perform_create": { 89 | "prefix": "performcreate", 90 | "body": [ 91 | "def perform_create(self, serializer):", 92 | "\treturn ${1:super().perform_create(serializer)}" 93 | ], 94 | "description": "Django-rest Views ``perform_create`` method" 95 | }, 96 | "DRF perform_update": { 97 | "prefix": "perfromupdate", 98 | "body": [ 99 | "def perform_create(self, serializer):", 100 | "\treturn ${1:super().perform_create(serializer)}" 101 | ], 102 | "description": "Django-rest Views ``perform_create`` method" 103 | }, 104 | "DRF perform_destroy": { 105 | "prefix": "performdestroy", 106 | "body": [ 107 | "def perform_destroy(self, instance):", 108 | "\treturn ${1:super().perform_destroy(instance)}" 109 | ], 110 | "description": "Django-rest Views ``perform_create`` method" 111 | }, 112 | 113 | "DRF ModelViewSet": { 114 | "prefix": "modelviewset", 115 | "body": [ 116 | "class ${1:Name}ModelViewSet(viewsets.ModelViewSet):", 117 | "\tserializer_class = ${2:$1Serializer}", 118 | "\tqueryset = $1.objects.filter(${3})" 119 | ], 120 | "description": "Django-rest Views ``ModelViewSet`` Class" 121 | }, 122 | "DRF ReadOnlyModelViewSet": { 123 | "prefix": "readonlymodelviewset", 124 | "body": [ 125 | "class ${1:Name}ReadOnlyModelViewSet(viewsets.ReadOnlyModelViewSet):", 126 | "\tserializer_class = ${2:$1Serializer}", 127 | "\tqueryset = $1.objects.filter(${3})" 128 | ], 129 | "description": "Django-rest Views ``ReadOnlyModelViewSet`` Class" 130 | }, 131 | "DRF ViewSet": { 132 | "prefix": "viewset", 133 | "body": [ 134 | "class ${1:Name}ViewSet(viewsets.ViewSet):", 135 | "\tdef list(self, request):", 136 | "\t\tpass", 137 | "\tdef create(self, request):", 138 | "\t\tpass", 139 | "\tdef retrieve(self, request, pk=None):", 140 | "\t\tpass", 141 | "\tdef update(self, request, pk=None):", 142 | "\t\tpass", 143 | "\tdef partial_update(self, request, pk=None):", 144 | "\t\tpass", 145 | "\tdef destroy(self, request, pk=None):", 146 | "\t\tpass" 147 | ], 148 | "description": "Django-rest Views ``ViewSet`` Class" 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /snippets/frameworks/django/tags.json: -------------------------------------------------------------------------------- 1 | { 2 | "ilib": { 3 | "prefix": "ilib", 4 | "body": [ 5 | "from django import template", 6 | "register = template.Library()" 7 | ], 8 | "description": "", 9 | "scope": "source.python" 10 | }, 11 | "li18n": { 12 | "prefix": "li18n", 13 | "body": "{% load i18n %}", 14 | "description": "", 15 | "scope": "text.html.django" 16 | }, 17 | "lstatic": { 18 | "prefix": "lstatic", 19 | "body": "{% load staticfiles %}", 20 | "description": "", 21 | "scope": "text.html.django" 22 | }, 23 | "ltags": { 24 | "prefix": "ltags", 25 | "body": "{% load $SELECTION$1_tags %}", 26 | "description": "", 27 | "scope": "text.html.django" 28 | }, 29 | "register_assignment_tag": { 30 | "prefix": "register_assignment_tag", 31 | "body": [ 32 | "def get_$1(context):", 33 | "\trequest = context.get('request')", 34 | "\t$1 = ${2:[]}", 35 | "\treturn ${3:$1}" 36 | ], 37 | "description": "", 38 | "scope": "source.python" 39 | }, 40 | "register_filter": { 41 | "prefix": "register_filter", 42 | "body": ["@register.filter", "def $1(value):", "\treturn value$2"], 43 | "description": "", 44 | "scope": "source.python" 45 | }, 46 | "register_inclusion_tag": { 47 | "prefix": "register_inclusion_tag", 48 | "body": [ 49 | "@register.inclusion_tag(${2:'$1.html'}, takes_context=True)", 50 | "def $1(context):", 51 | "\trequest = context.get('request')", 52 | "\t$3", 53 | "\treturn {", 54 | "\t\t'request': request,", 55 | "\t\t$4", 56 | "\t}" 57 | ], 58 | "description": "", 59 | "scope": "source.python" 60 | }, 61 | "register_simple_tag": { 62 | "prefix": "register_simple_tag", 63 | "body": [ 64 | "@register.simple_tag(takes_context=True)", 65 | "def $1(context):", 66 | "\trequest = context.get('request')", 67 | "\treturn ${2:'It Works!'}" 68 | ], 69 | "description": "", 70 | "scope": "source.python" 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /snippets/frameworks/django/urls.json: -------------------------------------------------------------------------------- 1 | { 2 | "urlresolvers": { 3 | "prefix": "iurlresolvers", 4 | "body": "from django.core.urlresolvers import ${1|reverse,reverse_lazy,resolve,get_script_prefix|}", 5 | "description": "*Deprecated since version 1.10*\n\nUtility functions.\n\n", 6 | "scope": "source.python" 7 | }, 8 | "urls (≥1.10 & ≤1.11)": { 9 | "prefix": "iurls", 10 | "body": "from django.urls import ${1|reverse,reverse_lazy,resolve,get_script_prefix|}", 11 | "description": "Utility functions for use in URLconfs.", 12 | "scope": "source.python" 13 | }, 14 | "conf.urls (≤1.11)": { 15 | "prefix": "iconf_urls", 16 | "body": "from django.conf.urls import ${1|static,url,include,handler400,handler403,handler404,handler500|}", 17 | "description": "Utility functions for use in URLconfs.", 18 | "scope": "source.python" 19 | }, 20 | "urls (≥2.0)": { 21 | "prefix": "iurls", 22 | "body": "from django.urls import ${1|path,re_path,include,reverse,reverse_lazy,register_converter|}", 23 | "description": "Utility functions for use in URLconfs.", 24 | "scope": "source.python" 25 | }, 26 | "conf.urls (≥2.0)": { 27 | "prefix": "iconf_urls", 28 | "body": "from django.conf.urls import ${1|static,url,handler400,handler403,handler404,handler500|}", 29 | "description": "Utilityfunctions for use in URLconfs.", 30 | "scope": "source.python" 31 | }, 32 | "url_stack": { 33 | "prefix": "url_stack", 34 | "body": [ 35 | "${1|url,re_path|}(", 36 | "\tr'^${2:REGEX}/$',", 37 | "\t${3:VIEW}${4:.as_view()},", 38 | "\tname='$5'", 39 | ")," 40 | ], 41 | "description": "url(regex, view, kwargs=None, name=None)\n\n*url is an alias to re_path*\n\n", 42 | "scope": "source.python" 43 | }, 44 | "url_inline": { 45 | "prefix": "url_inline", 46 | "body": [ 47 | "${1|url,re_path|}(r'^${2:REGEX}/$', ${3:VIEW}${4:.as_view()}, name='$5')," 48 | ], 49 | "description": "url(regex, view, kwargs=None, name=None)\n\n*url is an alias to re_path*\n\n", 50 | "scope": "source.python" 51 | }, 52 | "path_stack": { 53 | "prefix": "path_stack", 54 | "body": [ 55 | "path(", 56 | "\t'${1:ROUTE}/',", 57 | "\t${2:VIEW}${3:.as_view()},", 58 | "\tname='$4'", 59 | ")," 60 | ], 61 | "description": "path(route, view, kwargs=None, name=None)", 62 | "scope": "source.python" 63 | }, 64 | "path_inline": { 65 | "prefix": "path_inline", 66 | "body": ["path('${1:ROUTE}/', ${2:VIEW}${3:.as_view()}, name='$4'),"], 67 | "description": "path(route, view, kwargs=None, name=None)", 68 | "scope": "source.python" 69 | }, 70 | "urlpatterns": { 71 | "prefix": "urlpatterns", 72 | "body": ["urlpatterns = [", "\t$0", "]"], 73 | "description": "", 74 | "scope": "source.python" 75 | }, 76 | "repk": { 77 | "prefix": "repk", 78 | "body": "r'^(?P<${1:pk}>d+)/$'", 79 | "description": "PK URL regex", 80 | "scope": "source.python" 81 | }, 82 | "reslug": { 83 | "prefix": "reslug", 84 | "body": "r'^(?P<${1:slug}>[-w]+)/$'", 85 | "description": "Slug URL regex", 86 | "scope": "source.python" 87 | }, 88 | "reusername": { 89 | "prefix": "reusername", 90 | "body": "r'^(?P[w.@+-]+)/$'", 91 | "description": "Username regex", 92 | "scope": "source.python" 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /snippets/frameworks/django/views.json: -------------------------------------------------------------------------------- 1 | { 2 | "createview": { 3 | "prefix": "createview", 4 | "body": "\r\nclass ${1:MODEL_NAME}CreateView(CreateView):\r\n model = ${1:MODEL_NAME}\r\n template_name = \"${2:TEMPLATE_NAME}\"\r\n", 5 | "description": "", 6 | "scope": "source.python" 7 | }, 8 | "deleteview": { 9 | "prefix": "deleteview", 10 | "body": "\r\nclass ${1:MODEL_NAME}DeleteView(DeleteView):\r\n model = ${1:MODEL_NAME}\r\n template_name = \"${2:TEMPLATE_NAME}\"\r\n", 11 | "description": "", 12 | "scope": "source.python" 13 | }, 14 | "detailview": { 15 | "prefix": "detailview", 16 | "body": "\r\nclass ${1:MODEL_NAME}DetailView(DetailView):\r\n model = ${1:MODEL_NAME}\r\n template_name = \"${2:TEMPLATE_NAME}\"\r\n", 17 | "description": "", 18 | "scope": "source.python" 19 | }, 20 | "listview": { 21 | "prefix": "listview", 22 | "body": "\r\nclass ${1:MODEL_NAME}ListView(ListView):\r\n model = ${1:MODEL_NAME}\r\n template_name = \"${2:TEMPLATE_NAME}\"\r\n", 23 | "description": "", 24 | "scope": "source.python" 25 | }, 26 | "templateview": { 27 | "prefix": "templateview", 28 | "body": "\r\nclass ${1:CLASS_NAME}(TemplateView):\r\n template_name = \"${2:TEMPLATE_NAME}\"\r\n", 29 | "description": "", 30 | "scope": "source.python" 31 | }, 32 | "updateview": { 33 | "prefix": "updateview", 34 | "body": "\r\nclass ${1:MODEL_NAME}UpdateView(UpdateView):\r\n model = ${1:MODEL_NAME}\r\n template_name = \"${2:TEMPLATE_NAME}\"\r\n", 35 | "description": "", 36 | "scope": "source.python" 37 | }, 38 | "from views import": { 39 | "prefix": "fvi", 40 | "body": "from .views import $1", 41 | "description": "", 42 | "scope": "source.python" 43 | }, 44 | "igenericviews": { 45 | "prefix": "igenericviews", 46 | "body": "from django.views.generic import ${1|CreateView,DetailView,FormView,ListView,TemplateView,UpdateView|}", 47 | "description": "Generic class-based views", 48 | "scope": "source.python" 49 | }, 50 | "isettings": { 51 | "prefix": "isettings", 52 | "body": "from django.conf import settings", 53 | "description": "from django.conf import settings", 54 | "scope": "source.python" 55 | }, 56 | "view": { 57 | "prefix": "view", 58 | "body": "def ${1:VIEWNAME}(request):", 59 | "description": "View", 60 | "scope": "source.python" 61 | }, 62 | "dispatch": { 63 | "prefix": "dispatch", 64 | "body": "\r\ndef dispatch(self, request, *args, **kwargs):\r\n return super(${1:CLASS_NAME}, self).dispatch(request, *args, **kwargs)\r\n", 65 | "description": "", 66 | "scope": "source.python" 67 | }, 68 | "context": { 69 | "prefix": "get_context_data", 70 | "body": "\r\ndef get_context_data(self, **kwargs):\r\n context = super(${1:CLASS_NAME}, self).get_context_data(**kwargs)\r\n return context\r\n", 71 | "description": "", 72 | "scope": "source.python" 73 | }, 74 | "get_queryset": { 75 | "prefix": "get_queryset", 76 | "body": [ 77 | "def get_queryset(self):", 78 | "\tqueryset = super(${1:CLASS_NAME}, self).get_queryset()", 79 | "\tqueryset = queryset${3: # TODO}", 80 | "\treturn queryset" 81 | ], 82 | "description": "", 83 | "scope": "source.python" 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /snippets/frameworks/ejs.json: -------------------------------------------------------------------------------- 1 | { 2 | "EJS No Output": { 3 | "prefix": "ejs", 4 | "body": ["<% $1 %> $2"], 5 | "description": "EJS No Output" 6 | }, 7 | "EJS Output Value": { 8 | "prefix": "ejsout", 9 | "body": ["<%= $1 %> $2"], 10 | "description": "EJS outputs no value" 11 | }, 12 | "EJS Output Escaped": { 13 | "prefix": "ejsesc", 14 | "body": ["<%- $1 %> $2"], 15 | "description": "EJS outputs value" 16 | }, 17 | "EJS Comment": { 18 | "prefix": "ejscom", 19 | "body": ["<%# $1 %> $2"], 20 | "description": "EJS comment tag with no output" 21 | }, 22 | "EJS Literal": { 23 | "prefix": "ejslit", 24 | "body": ["<%% $1 %> $2"], 25 | "description": "EJS outputs a literal '<%'" 26 | }, 27 | "EJS Include": { 28 | "prefix": "ejsinc", 29 | "body": ["<% include $1 %> $2"], 30 | "description": "EJS include statement" 31 | }, 32 | "EJS For Loop": { 33 | "prefix": "ejsfor", 34 | "body": [ 35 | "<% for( let ${1:index} = 0; ${1:index} < ${2:array}.length; ${1:index}++ ) { %>", 36 | "$3", 37 | "<% } %>" 38 | ], 39 | "description": "EJS For Loop" 40 | }, 41 | "EJS ForEach": { 42 | "prefix": "ejseach", 43 | "body": [ 44 | "<% ${1:array}.forEach(${2:element} => { %>", 45 | " $3", 46 | "<% }) %>" 47 | ], 48 | "description": "EJS ForEach Loop" 49 | }, 50 | "EJS If Statement": { 51 | "prefix": "ejsif", 52 | "body": ["<% if (${1:condition}) { %>", " $2", "<% } %>"], 53 | "description": "EJS if statement" 54 | }, 55 | "EJS Else Statement": { 56 | "prefix": "ejselse", 57 | "body": ["<% } else { %>", " $1"], 58 | "description": "EJS if statement" 59 | }, 60 | "EJS Else If Statement": { 61 | "prefix": "ejselif", 62 | "body": ["<% } else if ({$1:condition}) { %>", " $2"], 63 | "description": "EJS if statement" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /snippets/frameworks/relm4/factories.json: -------------------------------------------------------------------------------- 1 | { 2 | "Relm4 Factory Component": { 3 | "prefix": "relm-factory", 4 | "description": "Relm4 Factory Component", 5 | "body": [ 6 | "use relm4::{", 7 | " factory::FactoryView,", 8 | " gtk,", 9 | " prelude::{DynamicIndex, FactoryComponent},", 10 | " FactorySender,", 11 | "};", 12 | "", 13 | "pub struct FactoryModel {}", 14 | "", 15 | "#[derive(Debug)]", 16 | "pub enum FactoryInput {}", 17 | "", 18 | "#[derive(Debug)]", 19 | "pub enum FactoryOutput {}", 20 | "", 21 | "pub struct FactoryInit {}", 22 | "", 23 | "#[relm4::factory(pub)]", 24 | "impl FactoryComponent for FactoryModel {", 25 | " type ParentWidget = gtk::Box;", 26 | " type ParentInput = ();", 27 | " type Input = FactoryInput;", 28 | " type Output = FactoryOutput;", 29 | " type Init = FactoryInit;", 30 | " type CommandOutput = ();", 31 | "", 32 | " view! {", 33 | " #[root]", 34 | " gtk::Box {", 35 | "", 36 | " }", 37 | " }", 38 | "", 39 | " fn init_model(", 40 | " init: Self::Init,", 41 | " index: &DynamicIndex,", 42 | " sender: FactorySender,", 43 | " ) -> Self {", 44 | " Self {}", 45 | " }", 46 | "", 47 | " fn init_widgets(", 48 | " &mut self,", 49 | " _index: &DynamicIndex,", 50 | " root: &Self::Root,", 51 | " _returned_widget: &::ReturnedWidget,", 52 | " sender: FactorySender,", 53 | " ) -> Self::Widgets {", 54 | " let widgets = view_output!();", 55 | " widgets", 56 | " }", 57 | "", 58 | " fn update(&mut self, message: Self::Input, sender: FactorySender) {", 59 | " match message {}", 60 | " }", 61 | "", 62 | " fn output_to_parent_input(output: Self::Output) -> Option {", 63 | " let output = match output {};", 64 | " Some(output)", 65 | " }", 66 | "}" 67 | ] 68 | }, 69 | "Relm4 Async Factory Component": { 70 | "prefix": "relm-async-factory", 71 | "description": "Relm4 Async Factory Component", 72 | "body": [ 73 | "use relm4::{", 74 | " factory::{FactoryView, AsyncFactoryComponent},", 75 | " gtk,", 76 | " prelude::{DynamicIndex}, ", 77 | " AsyncFactorySender, loading_widgets::LoadingWidgets,", 78 | "};", 79 | "", 80 | "pub struct FactoryModel {}", 81 | "", 82 | "#[derive(Debug)]", 83 | "pub enum FactoryInput {}", 84 | "", 85 | "#[derive(Debug)]", 86 | "pub enum FactoryOutput {}", 87 | "", 88 | "pub struct FactoryInit {}", 89 | "", 90 | "#[relm4::factory(pub async)]", 91 | "impl AsyncFactoryComponent for FactoryModel {", 92 | " type ParentWidget = gtk::Box;", 93 | " type ParentInput = ();", 94 | " type Input = FactoryInput;", 95 | " type Output = FactoryOutput;", 96 | " type Init = FactoryInit;", 97 | " type CommandOutput = ();", 98 | "", 99 | " view! {", 100 | " #[root]", 101 | " gtk::Box {", 102 | "", 103 | " }", 104 | " }", 105 | "", 106 | " fn init_loading_widgets(", 107 | " root: &mut Self::Root,", 108 | " ) -> Option {", 109 | " relm4::view! {", 110 | " #[local_ref]", 111 | " root {", 112 | " #[name(spinner)]", 113 | " gtk::Spinner {", 114 | " start: ()", 115 | " }", 116 | " }", 117 | " }", 118 | " Some(LoadingWidgets::new(root, spinner))", 119 | " }", 120 | "", 121 | " async fn init_model(", 122 | " init: Self::Init,", 123 | " _index: &DynamicIndex,", 124 | " _sender: AsyncFactorySender,", 125 | " ) -> Self {", 126 | " Self {", 127 | " ", 128 | " }", 129 | " }", 130 | "", 131 | " fn init_widgets(", 132 | " &mut self,", 133 | " _index: &DynamicIndex,", 134 | " root: &Self::Root,", 135 | " _returned_widget: &::ReturnedWidget,", 136 | " sender: AsyncFactorySender,", 137 | " ) -> Self::Widgets {", 138 | " let widgets = view_output!();", 139 | " widgets", 140 | " }", 141 | "", 142 | " async fn update(", 143 | " &mut self,", 144 | " message: Self::Input,", 145 | " sender: AsyncFactorySender,", 146 | " ) {", 147 | " match message {}", 148 | " }", 149 | "", 150 | " fn output_to_parent_input(output: Self::Output) -> Option {", 151 | " let output = match output {};", 152 | " Some(output)", 153 | " }", 154 | "}" 155 | ] 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /snippets/frameworks/relm4/templates.json: -------------------------------------------------------------------------------- 1 | { 2 | "Relm4 Widget Template": { 3 | "prefix": "relm-template", 4 | "description": "Relm4 Widget Template", 5 | "body": [ 6 | "use relm4::{gtk, WidgetTemplate};", 7 | "", 8 | "#[relm4::widget_template]", 9 | "impl WidgetTemplate for Widget {", 10 | " view! {", 11 | " gtk::Box {", 12 | " // Customize your widget", 13 | " }", 14 | " }", 15 | "}" 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /snippets/frameworks/relm4/workers.json: -------------------------------------------------------------------------------- 1 | { 2 | "Relm4 Worker": { 3 | "prefix": "relm-worker", 4 | "description": "Relm4 Worker", 5 | "body": [ 6 | "use relm4::{ComponentSender, Worker};", 7 | "", 8 | "pub struct AsyncHandler;", 9 | "", 10 | "#[derive(Debug)]", 11 | "pub enum AsyncHandlerInput {}", 12 | "", 13 | "impl Worker for AsyncHandler {", 14 | " type Init = ();", 15 | " type Input = AsyncHandlerInput;", 16 | " type Output = ();", 17 | "", 18 | " fn init(_init: Self::Init, _sender: ComponentSender) -> Self {", 19 | " Self", 20 | " }", 21 | "", 22 | " fn update(&mut self, msg: AsyncHandlerInput, sender: ComponentSender) {", 23 | " match msg {}", 24 | " }", 25 | "}" 26 | ] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /snippets/frameworks/remix-ts.json: -------------------------------------------------------------------------------- 1 | { 2 | "Remix loader function": { 3 | "prefix": "rxl", 4 | "body": [ 5 | "import { type LoaderFunction, json } from '@remix-run/node'", 6 | "import { useLoaderData } from '@remix-run/react'", 7 | "", 8 | "export const loader: LoaderFunction = async () => {", 9 | "\treturn json({ ok: true })", 10 | "}" 11 | ], 12 | "description": "Remix loader function" 13 | }, 14 | "Remix action function": { 15 | "prefix": "rxa", 16 | "body": [ 17 | "import { type ActionFunction, json } from '@remix-run/node'", 18 | "", 19 | "export const action: ActionFunction = async ({ request }) => {", 20 | "\treturn json({ ok: true })", 21 | "}" 22 | ], 23 | "description": "Remix action function" 24 | }, 25 | "Remix meta function": { 26 | "prefix": "rxm", 27 | "body": [ 28 | "import { type MetaFunction } from '@remix-run/node'", 29 | "", 30 | "export const meta: MetaFunction = () => {", 31 | "\treturn [", 32 | "\t\t{ title: ''},", 33 | "\t\t{ name: 'description', content: ''}", 34 | "\t]", 35 | "}" 36 | ], 37 | "description": "Remix meta function" 38 | }, 39 | "Remix links function": { 40 | "prefix": "rxi", 41 | "body": [ 42 | "import { type LinksFunction } from '@remix-run/node'", 43 | "", 44 | "export const links: LinksFunction = () => {", 45 | "\treturn [", 46 | "\t\t{", 47 | "\t\t}", 48 | "\t]", 49 | "}" 50 | ], 51 | "description": "Remix links function" 52 | } 53 | } -------------------------------------------------------------------------------- /snippets/frameworks/vue/nuxt-html.json: -------------------------------------------------------------------------------- 1 | { 2 | "NuxtWelcome": { 3 | "prefix": "NuxtWelcome", 4 | "body": [ 5 | "" 6 | ], 7 | "description": "The component greets users in new projects made from the starter template. It includes links to the Nuxt documentation, source code, and social media accounts." 8 | }, 9 | "NuxtPage": { 10 | "prefix": "NuxtPage", 11 | "body": [ 12 | "" 13 | ], 14 | "description": " is a built-in component that comes with Nuxt. NuxtPage is required to display top-level or nested pages located in the pages/ directory." 15 | }, 16 | "NuxtLink": { 17 | "prefix": "NuxtLink", 18 | "body": [ 19 | "$0" 20 | ], 21 | "description": "Nuxt provides component to handle any kind of links within your application." 22 | }, 23 | "NuxtLayout": { 24 | "prefix": "NuxtLayout", 25 | "body": [ 26 | "", 27 | "" 28 | ], 29 | "description": " can be used to override default layout on app.vue, error.vue or even page components found in the /pages directory." 30 | }, 31 | "NuxtErrorBoundary": { 32 | "prefix": "NuxtErrorBoundary", 33 | "body": [ 34 | "", 35 | "" 36 | ], 37 | "description": "The component handles client-side errors happening in its default slot, using Vue's onErrorCaptured hook." 38 | }, 39 | "NuxtLoadingIndicator": { 40 | "prefix": "NuxtLoadingIndicator", 41 | "body": [ 42 | "" 43 | ], 44 | "description": "The component displays a progress bar on page navigation." 45 | }, 46 | "ClientOnly": { 47 | "prefix": "ClientOnly", 48 | "body": [ 49 | "", 50 | "" 51 | ], 52 | "description": "The component renders its slot only in client-side. To import a component only on the client, register the component in a client-side only plugin." 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /snippets/frameworks/vue/nuxt-script.json: -------------------------------------------------------------------------------- 1 | { 2 | "useAppConfig": { 3 | "prefix": "useAppConfig", 4 | "body": ["const ${1:appConfig} = useAppConfig()", "\t$0"], 5 | "description": "Access the reactive app config defined in the project." 6 | }, 7 | "useHead": { 8 | "prefix": "useHead", 9 | "body": ["useHead({", "\t$0", "})"], 10 | "description": "The useHead composable function allows you to manage your head tags in a programmatic and reactive way, powered by Unhead. If the data comes from a user or other untrusted source, we recommend you check out useHeadSafe" 11 | }, 12 | "useError": { 13 | "prefix": "useError", 14 | "body": ["const ${1:error} = useError()", "\t$0"], 15 | "description": "useError composable returns the global Nuxt error that is being handled and it is available on both client and server." 16 | }, 17 | "useFetch": { 18 | "prefix": "useFetch", 19 | "body": [ 20 | "const {${1:data},${2:pending},${3:error},${4:refresh}} = await useFetch('$5', {", 21 | "$0", 22 | "})" 23 | ], 24 | "description": "This composable provides a convenient wrapper around useAsyncData and $fetch. It automatically generates a key based on URL and fetch options, provides type hints for request url based on server routes, and infers API response type." 25 | }, 26 | "useNuxtApp": { 27 | "prefix": "useAppConfig", 28 | "body": ["const ${1:nuxtApp} = useNuxtApp()", "\t$0"], 29 | "description": "useNuxtApp is a built-in composable that provides a way to access shared runtime context of Nuxt, which is available on both client and server side. It helps you access the Vue app instance, runtime hooks, runtime config variables and internal states, such as ssrContext and payload." 30 | }, 31 | "useRoute": { 32 | "prefix": "useRoute", 33 | "body": ["const ${1:route} = useRoute()", "\t$0"], 34 | "description": "The useRoute composable returns the current route and must be called in a setup function, plugin, or route middleware." 35 | }, 36 | "useRouter": { 37 | "prefix": "useRouter", 38 | "body": ["const ${1:router} = useRouter()", "\t$0"], 39 | "description": "The useRouter composable returns the router instance and must be called in a setup function, plugin, or route middleware. Within the template of a Vue component, you can access the router using $router instead. If you have a pages/ folder, useRouter is identical in behavior to the one provided by vue-router. Feel free to read the router documentation for more information on what each method does." 40 | }, 41 | "useState": { 42 | "prefix": "useState", 43 | "body": ["const ${1:route} = useRoute()", "\t$0"], 44 | "description": "The useRoute composable returns the current route and must be called in a setup function, plugin, or route middleware." 45 | }, 46 | "definePageMeta": { 47 | "prefix": "definePageMeta", 48 | "body": ["definePageMeta({", "$0", "})"], 49 | "description": "definePageMeta is a compiler macro that you can use to set metadata for your page components located in the pages/ directory (unless set otherwise). This way you can set custom metadata for each static or dynamic route of your Nuxt application." 50 | }, 51 | "navigateTo": { 52 | "prefix": "navigateTo", 53 | "body": ["navigateTo($0)"], 54 | "description": "navigateTo is a router helper function that allows programmatically navigating users through your Nuxt application." 55 | }, 56 | "Anonymouse Route Middleware": { 57 | "prefix": "addRouteMiddlewareAnonym", 58 | "body": [ 59 | "addRouteMiddleware((to, from) => {", 60 | "\tif(to.path === '$1') {", 61 | "\t\treturn false", 62 | "\t})" 63 | ], 64 | "description": "Anonymous route middleware does not have a name. It takes a function as the first argument, making the second middleware argument redundant" 65 | }, 66 | "Named Route Middleware": { 67 | "prefix": "addRouteMiddlewareNamed", 68 | "body": [ 69 | "addRouteMiddleware('${1:named-middleware}', () => {", 70 | "\t$0", 71 | "\t})" 72 | ], 73 | "description": "Named route middleware takes a string as the first argument and a function as the second. When defined in a plugin, it overrides any existing middleware of the same name located in the middleware/ directory" 74 | }, 75 | 76 | "Global Route Middleware": { 77 | "prefix": "addRouteMiddlewareGlobal", 78 | "body": [ 79 | "addRouteMiddleware('${1:global-middleware}', (to, from) => {", 80 | "\t$0", 81 | "},", 82 | "\t{global: true}", 83 | ")" 84 | ], 85 | "description": "Set an optional, third argument { global: true } to indicate whether the route middleware is global" 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /snippets/frameworks/vue/style.json: -------------------------------------------------------------------------------- 1 | { 2 | "tailwind-base": { 3 | "prefix": "tailwindBase", 4 | "body": [ 5 | "@tailwind base;", 6 | "@tailwind components;", 7 | "@tailwind utilities;" 8 | ], 9 | "description": "An opinionated set of base styles for Tailwind projects." 10 | }, 11 | "aspect-ratio": { 12 | "prefix": "aspect-ratio", 13 | "body": [ 14 | "aspect-${1|auto, square, video|}" 15 | ], 16 | "description": "aspect-ratio" 17 | }, 18 | "aspect-arbitrary": { 19 | "prefix": "aspectArbitrary", 20 | "body": [ 21 | "aspect-[$1] $0" 22 | ], 23 | "description": "aspect arbitrary values" 24 | }, 25 | "container": { 26 | "prefix": "container", 27 | "body": [ 28 | "container" 29 | ], 30 | "description": "container => sm(640px), md(768px), lg(1024px), xl(1280px), 2xl(1536px) and use max-width overall" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /snippets/fsh.json: -------------------------------------------------------------------------------- 1 | { 2 | "FSH Profile": { 3 | "prefix": ["pro", "Pro"], 4 | "body": [ 5 | "Profile: $1", 6 | "Parent: $2", 7 | "Id: ${3:${1/(([A-Z]*)[_]([A-Z]*))|(([A-Z]*[a-z0-9]+)([A-Z]+))|(([A-Z]+)([A-Z0-9])([a-z]))/${2:/downcase}${5:/downcase}${8:/downcase}-${3:/downcase}${6:/downcase}${9:/downcase}$10/g}}", 8 | "Title: \"${4:${1/[_]|(([a-z0-9])([A-Z]))|(([A-Z])([A-Z0-9])([a-z]))/$2$5 $3$6$7/g}}\"", 9 | "Description: \"$5\"", 10 | "* $0" 11 | ], 12 | "description": "Create a FSH Profile" 13 | }, 14 | "FSH Extension": { 15 | "prefix": ["ext", "Ext"], 16 | "body": [ 17 | "Extension: $1", 18 | "Id: ${2:${1/(([A-Z]*)[_]([A-Z]*))|(([A-Z]*[a-z0-9]+)([A-Z]+))|(([A-Z]+)([A-Z0-9])([a-z]))/${2:/downcase}${5:/downcase}${8:/downcase}-${3:/downcase}${6:/downcase}${9:/downcase}$10/g}}", 19 | "Title: \"${3:${1/[_]|(([a-z0-9])([A-Z]))|(([A-Z])([A-Z0-9])([a-z]))/$2$5 $3$6$7/g}}\"", 20 | "Description: \"$4\"", 21 | "* $0" 22 | ], 23 | "description": "Create a FSH Extension" 24 | }, 25 | "FSH Logical": { 26 | "prefix": ["log", "Log"], 27 | "body": [ 28 | "Logical: $1", 29 | "Parent: ${2:Base}", 30 | "Id: ${3:$1}", 31 | "Title: \"${4:${1/[_]|(([a-z0-9])([A-Z]))|(([A-Z])([A-Z0-9])([a-z]))/$2$5 $3$6$7/g}}\"", 32 | "Description: \"$5\"", 33 | "* $0" 34 | ], 35 | "description": "Create a FSH Resource" 36 | }, 37 | "FSH Resource": { 38 | "prefix": ["res", "Res"], 39 | "body": [ 40 | "Resource: $1", 41 | "Parent: ${2|DomainResource,Resource|}", 42 | "Id: ${3:$1}", 43 | "Title: \"${4:${1/[_]|(([a-z0-9])([A-Z]))|(([A-Z])([A-Z0-9])([a-z]))/$2$5 $3$6$7/g}}\"", 44 | "Description: \"$5\"", 45 | "* $0" 46 | ], 47 | "description": "Create a FSH Resource" 48 | }, 49 | "FSH Value Set": { 50 | "prefix": ["vs", "VS", "val", "Val"], 51 | "body": [ 52 | "ValueSet: $1", 53 | "Id: ${2:${1/(([A-Z]*)[_]([A-Z]*))|(([A-Z]*[a-z0-9]+)([A-Z]+))|(([A-Z]+)([A-Z0-9])([a-z]))/${2:/downcase}${5:/downcase}${8:/downcase}-${3:/downcase}${6:/downcase}${9:/downcase}$10/g}}", 54 | "Title: \"${3:${1/[_]|(([a-z0-9])([A-Z]))|(([A-Z])([A-Z0-9])([a-z]))/$2$5 $3$6$7/g}}\"", 55 | "Description: \"$4\"", 56 | "* $0" 57 | ], 58 | "description": "Create a FSH ValueSet" 59 | }, 60 | "FSH Code System": { 61 | "prefix": ["cs", "CS", "cod", "Cod"], 62 | "body": [ 63 | "CodeSystem: $1", 64 | "Id: ${2:${1/(([A-Z]*)[_]([A-Z]*))|(([A-Z]*[a-z0-9]+)([A-Z]+))|(([A-Z]+)([A-Z0-9])([a-z]))/${2:/downcase}${5:/downcase}${8:/downcase}-${3:/downcase}${6:/downcase}${9:/downcase}$10/g}}", 65 | "Title: \"${3:${1/[_]|(([a-z0-9])([A-Z]))|(([A-Z])([A-Z0-9])([a-z]))/$2$5 $3$6$7/g}}\"", 66 | "Description: \"$4\"", 67 | "* $0" 68 | ], 69 | "description": "Create a FSH Code System" 70 | }, 71 | "FSH Instance": { 72 | "prefix": ["inst", "Inst"], 73 | "body": [ 74 | "Instance: $1", 75 | "InstanceOf: $2", 76 | "Usage: ${3|#example,#definition,#inline|}", 77 | "Title: \"${4:${1/[_]|(([a-z0-9])([A-Z]))|(([A-Z])([A-Z0-9])([a-z]))/$2$5 $3$6$7/g}}\"", 78 | "Description: \"$5\"", 79 | "* $0" 80 | ], 81 | "description": "Create a FSH Instance" 82 | }, 83 | "FSH Invariant": { 84 | "prefix": ["inv", "Inv"], 85 | "body": [ 86 | "Invariant: $1", 87 | "Description: \"$2\"", 88 | "Expression: \"$3\"", 89 | "Severity: ${4|#error,#warning|}", 90 | "XPath: \"$5\"", 91 | "", 92 | "$0" 93 | ], 94 | "description": "Create a FSH Invariant" 95 | }, 96 | "FSH Mapping": { 97 | "prefix": ["map", "Map"], 98 | "body": [ 99 | "Mapping: $1", 100 | "Source: $2", 101 | "Target: \"$3\"", 102 | "Id: $4", 103 | "Title: \"$5\"", 104 | "Description: \"$6\"", 105 | "* $0" 106 | ], 107 | "description": "Create a FSH Invariant" 108 | }, 109 | "FSH RuleSet": { 110 | "prefix": ["RS", "rs", "rule", "Rule"], 111 | "body": ["RuleSet: $1", "* $0"], 112 | "description": "Create a FSH RuleSet" 113 | }, 114 | "Slicing rules": { 115 | "prefix": ["^slicing"], 116 | "body": [ 117 | "^slicing.discriminator.type = ${1|#value,#exists,#pattern,#type,#profile|}", 118 | "${TM_CURRENT_LINE/\\s*([^\\^]+).*/$1/}^slicing.discriminator.path = \"$2\"", 119 | "${TM_CURRENT_LINE/\\s*([^\\^]+).*/$1/}^slicing.rules = ${3|#open,#closed,#openAtEnd|}", 120 | "${TM_CURRENT_LINE/\\s*([^\\^]+).*/$1/}^slicing.description = \"$4\"", 121 | "${TM_CURRENT_LINE/\\s*([^\\^]+).*/$1/}^slicing.ordered = ${5|false,true|}", 122 | "$0" 123 | ], 124 | "description": "Add slicing rules" 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /snippets/gdscript.json: -------------------------------------------------------------------------------- 1 | { 2 | "Inner class": { 3 | "prefix": "class", 4 | "body": ["class $1 extends ${2:Reference}", "\t$3"] 5 | }, 6 | 7 | "Print messages to console": { 8 | "prefix": "pr", 9 | "body": ["print($1)"] 10 | }, 11 | 12 | "_ready method of Node": { 13 | "prefix": "ready", 14 | "body": ["func _ready():", "\t${1:pass}"] 15 | }, 16 | 17 | "_init method of Object": { 18 | "prefix": "init", 19 | "body": ["func _init():", "\t${1:pass}"] 20 | }, 21 | 22 | "_process method of Node": { 23 | "prefix": "process", 24 | "body": ["func _process(delta):", "\t${1:pass}"] 25 | }, 26 | 27 | "_input method of Node": { 28 | "prefix": "input", 29 | "body": ["func _input(event):", "\t${1:pass}"] 30 | }, 31 | 32 | "_input_event method of Node": { 33 | "prefix": "inpute", 34 | "body": ["func _input_event(event):", "\t${1:pass}"] 35 | }, 36 | 37 | "_draw method of Node": { 38 | "prefix": "draw", 39 | "body": ["func _draw():", "\t${1:pass}"] 40 | }, 41 | 42 | "_gui_input method of Node": { 43 | "prefix": "guii", 44 | "body": ["func _gui_input(event):", "\t${1:pass}"] 45 | }, 46 | 47 | "for loop": { 48 | "prefix": "for", 49 | "body": ["for $1 in $2:", "\t${3:pass}"] 50 | }, 51 | 52 | "for range loop": { 53 | "prefix": "for", 54 | "body": ["for $1 in range(${2:start},${3:end}):", "\t${4:pass}"] 55 | }, 56 | 57 | "if elif else": { 58 | "prefix": "if", 59 | "body": [ 60 | "if ${1:condition}:", 61 | "\t${3:pass}", 62 | "elif ${2:condition}:", 63 | "\t${4:pass}", 64 | "else:", 65 | "\t${5:pass}" 66 | ] 67 | }, 68 | 69 | "if else": { 70 | "prefix": "if", 71 | "body": ["if ${1:condition}:", "\t${2:pass}", "else:", "\t${3:pass}"] 72 | }, 73 | 74 | "if": { 75 | "prefix": "if", 76 | "body": ["if ${1:condition}:", "\t${2:pass}"] 77 | }, 78 | 79 | "while": { 80 | "prefix": "while", 81 | "body": ["while ${1:condition}:", "\t${2:pass}"] 82 | }, 83 | 84 | "function define": { 85 | "prefix": "func", 86 | "body": ["func ${1:method}(${2:args}):", "\t${3:pass}"] 87 | }, 88 | 89 | "match": { 90 | "prefix": "match", 91 | "body": ["match ${1:expression}:\n\t${2:pattern}:\n\t\t${3}\n\t_:\n\t\t${0:default}"] 92 | }, 93 | 94 | "signal declaration": { 95 | "prefix": "signal", 96 | "body": ["signal ${1:signalname}(${2:args})"] 97 | }, 98 | 99 | "export variables": { 100 | "prefix": "export", 101 | "body": [ 102 | "export(${1:type}${2:,other_configs}) var ${3:name}${4: = }${5:}${6: setget }" 103 | ] 104 | }, 105 | 106 | "define variables": { 107 | "prefix": "var", 108 | "body": ["var ${1:name}${2: = }${3:}${4: setget }"] 109 | }, 110 | 111 | "define onready variables": { 112 | "prefix": "onready", 113 | "body": ["onready var ${1:name} = get_node($2)"] 114 | }, 115 | 116 | "Is instance of a class or script": { 117 | "prefix": "is", 118 | "body": ["${1:instance} is ${2:class}"] 119 | }, 120 | 121 | "element in array": { 122 | "prefix": "in", 123 | "body": ["${1:element} in ${2:array}"] 124 | }, 125 | 126 | "GDScript template": { 127 | "prefix": "gdscript", 128 | "body": [ 129 | "extends ${1:BaseClass}", 130 | "", 131 | "# class member variables go here, for example:", 132 | "# var a = 2", 133 | "# var b = \"textvar\"", 134 | "", 135 | "func _ready():", 136 | "\t# Called every time the node is added to the scene.", 137 | "\t# Initialization here", 138 | "\tpass", 139 | "" 140 | ] 141 | }, 142 | 143 | "pass statement": { 144 | "prefix": "pass", 145 | "body": ["pass"] 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /snippets/gitcommit.json: -------------------------------------------------------------------------------- 1 | { 2 | "conventional commit": { 3 | "prefix": "cc", 4 | "body": ["${1:type}(${2:scope}): ${3:title}", "", "$0"] 5 | }, 6 | "fix conventional commit": { 7 | "prefix": "fix", 8 | "body": ["fix(${1:scope}): ${2:title}", "", "$0"] 9 | }, 10 | "feat conventional commit": { 11 | "prefix": "feat", 12 | "body": ["feat(${1:scope}): ${2:title}", "", "$0"] 13 | }, 14 | "build conventional commit": { 15 | "prefix": "build", 16 | "body": ["build(${1:scope}): ${2:title}", "", "$0"] 17 | }, 18 | "chore conventional commit": { 19 | "prefix": "chore", 20 | "body": ["chore(${1:scope}): ${2:title}", "", "$0"] 21 | }, 22 | "ci conventional commit": { 23 | "prefix": "ci", 24 | "body": ["ci(${1:scope}): ${2:title}", "", "$0"] 25 | }, 26 | "docs conventional commit": { 27 | "prefix": "docs", 28 | "body": ["docs(${1:scope}): ${2:title}", "", "$0"] 29 | }, 30 | "style conventional commit": { 31 | "prefix": "style", 32 | "body": ["style(${1:scope}): ${2:title}", "", "$0"] 33 | }, 34 | "refactor conventional commit": { 35 | "prefix": "refactor", 36 | "body": ["refactor(${1:scope}): ${2:title}", "", "$0"] 37 | }, 38 | "perf conventional commit": { 39 | "prefix": "perf", 40 | "body": ["perf(${1:scope}): ${2:title}", "", "$0"] 41 | }, 42 | "test conventional commit": { 43 | "prefix": "test", 44 | "body": ["test(${1:scope}): ${2:title}", "", "$0"] 45 | }, 46 | "breaking change conventional commit footer": { 47 | "prefix": "BREAK", 48 | "body": ["BREAKING CHANGE: $0"] 49 | }, 50 | "co-authored by": { 51 | "prefix": "co", 52 | "body": ["Co-authored-by: ${1:name} <${2:email}>", "$0"] 53 | }, 54 | "signed off by": { 55 | "prefix": "si", 56 | "body": ["Signed-off-by: ${1:name} <${2:email}>", "$0"] 57 | }, 58 | "on behalf of": { 59 | "prefix": "on", 60 | "body": ["On-behalf-of: ${1:org} <${2:email}>", "$0"] 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /snippets/gleam.json: -------------------------------------------------------------------------------- 1 | { 2 | "Public Function": { 3 | "prefix": [ 4 | "pub", 5 | "pub fn" 6 | ], 7 | "body": [ 8 | "pub fn ${1:function_name}(${2}) -> ${3:Nil} {", 9 | "\t${0:todo}", 10 | "}" 11 | ], 12 | "description": "public function" 13 | }, 14 | "Private Function": { 15 | "prefix": [ 16 | "fn" 17 | ], 18 | "body": [ 19 | "fn ${1:function_name}(${2}) -> ${3:Nil} {", 20 | "\t${0:todo}", 21 | "}" 22 | ], 23 | "description": "private function" 24 | }, 25 | "Test Function": { 26 | "prefix": [ 27 | "test" 28 | ], 29 | "body": [ 30 | "pub fn ${1:name}_test() {", 31 | "\t${0}", 32 | "}" 33 | ], 34 | "description": "test function" 35 | }, 36 | "Anonymous Function": { 37 | "prefix": [ 38 | "af", 39 | "fn" 40 | ], 41 | "body": [ 42 | "fn(${1}) { ${0} }" 43 | ], 44 | "description": "anonymous function" 45 | }, 46 | "Let assignment": { 47 | "prefix": [ 48 | "let" 49 | ], 50 | "body": [ 51 | "let ${1} = ${0}" 52 | ], 53 | "description": "let assignment" 54 | }, 55 | "Let Assert assignment": { 56 | "prefix": [ 57 | "leta" 58 | ], 59 | "body": [ 60 | "let assert ${1} = ${0}" 61 | ], 62 | "description": "let assert assignment" 63 | }, 64 | "Use expression": { 65 | "prefix": [ 66 | "use" 67 | ], 68 | "body": [ 69 | "use ${1} <- ${0}" 70 | ], 71 | "description": "use expression" 72 | }, 73 | "Case Expression": { 74 | "prefix": [ 75 | "case" 76 | ], 77 | "body": [ 78 | "case ${1} {", 79 | "\t${2} -> ${0}", 80 | "}" 81 | ], 82 | "description": "case expression" 83 | }, 84 | "Type": { 85 | "prefix": [ 86 | "type" 87 | ], 88 | "body": [ 89 | "type ${1:Name} {", 90 | "\t${0:$1}", 91 | "}" 92 | ], 93 | "description": "type declaration" 94 | }, 95 | "Public Type": { 96 | "prefix": [ 97 | "pty", 98 | "pub", 99 | "pub type" 100 | ], 101 | "body": [ 102 | "pub type ${1:Name} {", 103 | "\t${0:$1}", 104 | "}" 105 | ], 106 | "description": "public type declaration" 107 | }, 108 | "External attribute": { 109 | "prefix": [ 110 | "external" 111 | ], 112 | "body": [ 113 | "@external(${1:erlang}, \"${2}\", \"${0}\")" 114 | ], 115 | "description": "external attribute" 116 | }, 117 | "Public External Function": { 118 | "prefix": [ 119 | "pexfn", 120 | "pub", 121 | "pub external", 122 | "pub external fn" 123 | ], 124 | "body": [ 125 | "pub external fn ${1:function_name}(${2}) -> ${3:Nil} = \"${4}\" \"${0}\"" 126 | ], 127 | "description": "public external function" 128 | }, 129 | "Import": { 130 | "prefix": [ 131 | "im", 132 | "import" 133 | ], 134 | "body": [ 135 | "import ${0:gleam/result}" 136 | ], 137 | "description": "import" 138 | }, 139 | "Import Unqualified": { 140 | "prefix": [ 141 | "im.", 142 | "import" 143 | ], 144 | "body": [ 145 | "import ${1:gleam/result}.{${0}}" 146 | ], 147 | "description": "import unqualified" 148 | }, 149 | "Pipe": { 150 | "prefix": [ 151 | "p", 152 | "|>" 153 | ], 154 | "body": [ 155 | "|> ${0}" 156 | ], 157 | "description": "Pipe |>" 158 | }, 159 | "Tuple": { 160 | "prefix": [ 161 | "#", 162 | "tuple" 163 | ], 164 | "body": [ 165 | "#(${0})" 166 | ], 167 | "description": "tuple #()" 168 | }, 169 | "Block": { 170 | "prefix": [ 171 | "bl" 172 | ], 173 | "body": [ 174 | "{", 175 | "\t${0}", 176 | "}" 177 | ], 178 | "description": "block" 179 | }, 180 | "Should Equal": { 181 | "prefix": [ 182 | "seq", 183 | "should" 184 | ], 185 | "body": [ 186 | "should.equal(${0})" 187 | ], 188 | "description": "should.equal" 189 | }, 190 | "Should Be True": { 191 | "prefix": [ 192 | "strue", 193 | "should", 194 | "should.b" 195 | ], 196 | "body": [ 197 | "should.be_true(${0})" 198 | ], 199 | "description": "should.be_true" 200 | }, 201 | "Should Be False": { 202 | "prefix": [ 203 | "sfalse", 204 | "should", 205 | "should.b" 206 | ], 207 | "body": [ 208 | "should.be_false(${0})" 209 | ], 210 | "description": "should.be_false" 211 | }, 212 | "Public Constant": { 213 | "prefix": [ 214 | "pub", 215 | "pub const" 216 | ], 217 | "body": [ 218 | "pub const ${1} = ${0}" 219 | ], 220 | "description": "public constant" 221 | }, 222 | "Constant": { 223 | "prefix": [ 224 | "const" 225 | ], 226 | "body": [ 227 | "const ${1} = ${0}" 228 | ], 229 | "description": "constant" 230 | } 231 | } 232 | -------------------------------------------------------------------------------- /snippets/global.json: -------------------------------------------------------------------------------- 1 | { 2 | "copyright": { 3 | "prefix": "copyright", 4 | "body": [ 5 | "Copyright (c) ${CURRENT_YEAR} ${0:Author}. All Rights Reserved." 6 | ], 7 | "description": "Snippet to put copyright" 8 | }, 9 | "diso": { 10 | "prefix": "diso", 11 | "body": [ 12 | "${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}T${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}" 13 | ], 14 | "description": "ISO date time stamp" 15 | }, 16 | "date": { 17 | "prefix": "date", 18 | "body": ["${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}"], 19 | "description": "Put the date in (Y-m-D) format" 20 | }, 21 | "dateDMY": { 22 | "prefix": "dateDMY", 23 | "body": ["${CURRENT_DATE}/${CURRENT_MONTH}/${CURRENT_YEAR}"], 24 | "description": "Put date in (DD/MM/YY) format" 25 | }, 26 | "dateMDY": { 27 | "prefix": "dateMDY", 28 | "body": ["${CURRENT_MONTH}/${CURRENT_DATE}/${CURRENT_YEAR}"], 29 | "description": "Put the date in (m/D/Y) format" 30 | }, 31 | "time": { 32 | "prefix": "time", 33 | "body": ["${CURRENT_HOUR}:${CURRENT_MINUTE}"], 34 | "description": "I give you back the time (H:M)" 35 | }, 36 | "timeHMS": { 37 | "prefix": "timeHMS", 38 | "body": ["${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}"], 39 | "description": "I give you back the time (H:M:S)" 40 | }, 41 | "datetime": { 42 | "prefix": "datetime", 43 | "body": [ 44 | "${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}" 45 | ], 46 | "description": "I give you back the time and date (Y-m-d H:M)" 47 | }, 48 | "uuid": { 49 | "prefix": "uuid", 50 | "body": "${UUID}", 51 | "description": "A Version 4 UUID" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /snippets/haskell.json: -------------------------------------------------------------------------------- 1 | { 2 | "case": { 3 | "prefix": ["case"], 4 | "body": [ 5 | "case ${1:expression} of", 6 | "\t${2:case1} -> ${3:result}", 7 | "\t${4:case2} -> ${5:result}$0" 8 | ], 9 | "description": "Case statement" 10 | }, 11 | "block_comment": { 12 | "prefix": ["--", "comment", "block_comment"], 13 | "body": ["{- $0 -}"], 14 | "description": "Block Comment" 15 | }, 16 | "data_inline": { 17 | "prefix": ["data inline"], 18 | "body": ["data ${1:type} = ${2:data}$0 ${3:deriving (${4:Show, Eq})}"], 19 | "description": "Inline data" 20 | }, 21 | "data_record": { 22 | "prefix": ["data record"], 23 | "body": [ 24 | "data ${1:Type} = $1", 25 | "\t{ ${2:field} :: ${3:Type}", 26 | "\t, ${4:field} :: ${5:Type}$0", 27 | "\t} ${6:deriving (${7:Show, Eq})}" 28 | ], 29 | "description": "Data record" 30 | }, 31 | "fn": { 32 | "prefix": ["fns", "simple function"], 33 | "body": [ 34 | "${1:f} :: ${2:a} ${3:-> ${4:b}}", 35 | "$1 ${5:x} = ${6:undefined}$0 " 36 | ], 37 | "description": "Simple function" 38 | }, 39 | "fn_clause": { 40 | "prefix": ["fnc", "clause function"], 41 | "body": [ 42 | "${1:f} :: ${2:a} ${3:-> ${4:b}}", 43 | "$1 ${5:pattern} = ${7:undefined}", 44 | "$1 ${6:pattern} = ${8:undefined}$0" 45 | ], 46 | "description": "Clause function" 47 | }, 48 | "fn_guarded": { 49 | "prefix": ["fng", "guarded function"], 50 | "body": [ 51 | "${1:f} :: ${2:a} ${3:-> ${4:b}}", 52 | "$1 ${5:x}", 53 | "\t| ${6:condition} = ${8:undefined}", 54 | "\t| ${7:condition} = ${9:undefined}$0" 55 | ], 56 | "description": "Guarded function" 57 | }, 58 | "fn_where": { 59 | "prefix": ["fnw", "where function"], 60 | "body": [ 61 | "${1:f} :: ${2:a} ${3:-> ${4:b}}", 62 | "$1 ${5:x} = ${6:undefined}$0", 63 | "\twhere", 64 | "\t\t${7:exprs}" 65 | ], 66 | "description": "Function with where" 67 | }, 68 | "get": { 69 | "prefix": ["get"], 70 | "body": ["${1:x} <- ${2:undefined}$0"], 71 | "description": "Monadic get" 72 | }, 73 | "if_inline": { 74 | "prefix": ["if inline"], 75 | "body": [ 76 | "if ${1:condition} then ${2:undefined} else ${3:undefined}$0," 77 | ], 78 | "description": "If inline" 79 | }, 80 | "if": { 81 | "prefix": ["if simple"], 82 | "body": [ 83 | "if ${1:condition}", 84 | "\tthen ${2:undefined}", 85 | "\telse ${3:undefined}$0" 86 | ], 87 | "description": "If block" 88 | }, 89 | "import": { 90 | "prefix": ["import simple"], 91 | "body": ["import ${1:module} ${2:(${3:f})}$0"], 92 | "description": "Simple import" 93 | }, 94 | "import_qualified": { 95 | "prefix": ["import qual"], 96 | "body": ["import qualified ${1:module} as ${2:name}"], 97 | "description": "Qualified import" 98 | }, 99 | "instance": { 100 | "prefix": ["inst"], 101 | "body": [ 102 | "instance ${1:Class} ${2:Data} where", 103 | "\t${3:f} = ${4:undefined}$0" 104 | ], 105 | "description": "typeclass instance" 106 | }, 107 | "lambda": { 108 | "prefix": ["\\", "lambda"], 109 | "body": ["\\\\${1:x} -> ${2:undefined}$0"], 110 | "description": "lambda function" 111 | }, 112 | "pragma": { 113 | "prefix": ["lang"], 114 | "body": ["{-# LANGUAGE ${1:extension} #-}$0"], 115 | "description": "Language extension pragma" 116 | }, 117 | "let": { 118 | "prefix": ["let"], 119 | "body": ["let ${1:x} = ${2:undefined}$0"], 120 | "description": "let statement" 121 | }, 122 | "main": { 123 | "prefix": ["main"], 124 | "body": [ 125 | "module Main where", 126 | "", 127 | "", 128 | "main :: IO ()", 129 | "main = do", 130 | "\t${1:undefined}$0", 131 | "return ()" 132 | ], 133 | "description": "main module" 134 | }, 135 | "module": { 136 | "prefix": ["mods", "mod simple"], 137 | "body": ["module ${1:mod} where$0"], 138 | "description": "simple module" 139 | }, 140 | "module exports": { 141 | "prefix": ["modu", "mod exports"], 142 | "body": [ 143 | "module ${1:mod} (", 144 | "\t\t${2:export}", 145 | "\t${3:, ${4:export}}", 146 | ") where$0" 147 | ], 148 | "description": "simple module with exports" 149 | }, 150 | "newtype": { 151 | "prefix": ["new"], 152 | "body": [ 153 | "newtype ${1:Type} ${2:a} = $1 { un$1 :: ${3:a} } ${4:deriving (${5:Show, Eq})}$0" 154 | ], 155 | "description": "Newtype definition" 156 | }, 157 | "opt pragma": { 158 | "prefix": ["opt"], 159 | "body": ["{-# OPTIONS_GHC ${1:opt} #-}$0"], 160 | "description": "GHC options pragma" 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /snippets/java/java.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": { 3 | "prefix": "main", 4 | "body": ["public static void main(String[] args) {", "\t$0", "}"], 5 | "description": "Public static main method" 6 | }, 7 | "class": { 8 | "prefix": "class", 9 | "body": ["public class ${1:TM_FILENAME_BASE} {", "\t$0", "}"], 10 | "description": "Public class" 11 | }, 12 | "sysout": { 13 | "prefix": "sysout", 14 | "body": ["System.out.println($0);"], 15 | "description": "Print to standard out" 16 | }, 17 | "syserr": { 18 | "prefix": "syserr", 19 | "body": ["System.err.println($0);"], 20 | "description": "Print to standard err" 21 | }, 22 | "fori": { 23 | "prefix": "fori", 24 | "body": [ 25 | "for (${1:int} ${2:i} = ${3:0}; $2 < ${4:max}; $2++) {", 26 | "\t$0", 27 | "}" 28 | ], 29 | "description": "Indexed for loop" 30 | }, 31 | "foreach": { 32 | "prefix": "foreach", 33 | "body": ["for (${1:type} ${2:var} : ${3:iterable}) {", "\t$0", "}"], 34 | "description": "Enhanced for loop" 35 | }, 36 | "Public constructor": { 37 | "prefix": "ctor", 38 | "body": [ 39 | "public ${1:${TM_FILENAME_BASE}}($2) {", 40 | "\t${0:super();}", 41 | "}" 42 | ], 43 | "description": "Public constructor" 44 | }, 45 | "if": { 46 | "prefix": "if", 47 | "body": ["if (${1:condition}) {", "\t$0", "}"], 48 | "description": "if statement" 49 | }, 50 | "ifelse": { 51 | "prefix": "ifelse", 52 | "body": ["if (${1:condition}) {", "\t$2", "} else {", "\t$0", "}"], 53 | "description": "if/else statement" 54 | }, 55 | "ifnull": { 56 | "prefix": "ifnull", 57 | "body": ["if (${1:condition} == null) {", "\t$0", "}"], 58 | "description": "if statement checking for null" 59 | }, 60 | "ifnotnull": { 61 | "prefix": "ifnotnull", 62 | "body": ["if (${1:condition} != null) {", "\t$0", "}"], 63 | "description": "if statement checking for not null" 64 | }, 65 | "trycatch": { 66 | "prefix": "try_catch", 67 | "body": [ 68 | "try {", 69 | "\t$1", 70 | "} catch (${2:Exception} ${3:e}) {", 71 | "\t$4//${0:TODO}: handle exception", 72 | "}" 73 | ], 74 | "description": "try/catch block" 75 | }, 76 | "tryresources": { 77 | "prefix": "try_resources", 78 | "body": [ 79 | "try ($1) {", 80 | "\t$2", 81 | "} catch (${3:Exception} ${4:e}) {", 82 | "\t$5//${0:TODO}: handle exception", 83 | "}" 84 | ] 85 | }, 86 | "private_method": { 87 | "prefix": "private_method", 88 | "body": ["private ${1:void} ${2:name}($3) {", "\t$0", "}"], 89 | "description": "private method" 90 | }, 91 | "Public method": { 92 | "prefix": "public_method", 93 | "body": ["public ${1:void} ${2:name}(${3}) {", "\t$0", "}"], 94 | "description": "public method" 95 | }, 96 | "Private static method": { 97 | "prefix": "private_static_method", 98 | "body": ["private static ${1:Type} ${2:name}(${3}) {", "\t$0", "}"], 99 | "description": "private static method" 100 | }, 101 | "Public static method": { 102 | "prefix": "public_static_method", 103 | "body": ["public static ${1:void} ${2:name}(${3}) {", "\t$0", "}"], 104 | "description": "public static method" 105 | }, 106 | "Protected Method": { 107 | "prefix": "protected_method", 108 | "body": ["protected ${1:void} ${2:name}(${3}) {", "\t$0", "}"], 109 | "description": "Protected method" 110 | }, 111 | "Switch Statement": { 112 | "prefix": "switch", 113 | "body": [ 114 | "switch (${1:key}) {", 115 | "\tcase ${2:value}:", 116 | "\t\t$0", 117 | "\t\tbreak;", 118 | "", 119 | "\tdefault:", 120 | "\t\tbreak;", 121 | "}" 122 | ], 123 | "description": "Switch Statement" 124 | }, 125 | "While Statement": { 126 | "prefix": "while", 127 | "body": ["while (${1:condition}) {", "\t$0", "}"], 128 | "description": "While Statement" 129 | }, 130 | "Do-While Statement": { 131 | "prefix": "dowhile", 132 | "body": ["do {", "\t$0", "} while (${1:condition});"], 133 | "description": "Do-While Statement" 134 | }, 135 | "newObject": { 136 | "prefix": "new", 137 | "body": ["${1:Object} ${2:foo} = new ${1:Object}();"], 138 | "description": "Create new Object" 139 | }, 140 | "Public field": { 141 | "prefix": "public_field", 142 | "body": ["public ${1:String} ${2:name};"], 143 | "description": "Public field" 144 | }, 145 | "Private field": { 146 | "prefix": "private_field", 147 | "body": ["private ${1:String} ${2:name};"], 148 | "description": "Private field" 149 | }, 150 | "Protected field": { 151 | "prefix": "protected_field", 152 | "body": ["protected ${1:String} ${2:name};"], 153 | "description": "Protected field" 154 | }, 155 | "package": { 156 | "prefix": "package", 157 | "body": ["package ${1:PackageName}"], 158 | "description": "Package statement" 159 | }, 160 | "import": { 161 | "prefix": "import", 162 | "body": ["import ${1:PackageName}"], 163 | "description": "Import statement" 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /snippets/java/javadoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment": { 3 | "prefix": "/**", 4 | "body": [ 5 | "/**", 6 | " * ${1:A one-line summary.}", 7 | " *", 8 | " * ${2:Description.}$0", 9 | " *", 10 | " * @param ${4:name} ${5:Type and description of the parameter.}", 11 | " * @return ${6:Type and description of the returned object.}", 12 | " *", 13 | " * @example", 14 | " * ```", 15 | " * ${7:Write me later}", 16 | " * ```", 17 | " */" 18 | ], 19 | "description": "A Java comment block including short summary, description, param, return, and examples." 20 | }, 21 | "comment_simple": { 22 | "prefix": "/*", 23 | "body": [ 24 | "/**", 25 | " * ${1:A one-line summary.}", 26 | " *", 27 | " * ${2:Description.}$0", 28 | " */" 29 | ], 30 | "description": "A simple Java comment block with short summary and description. Useful when the user prefers to manually add the other documentation tags." 31 | }, 32 | "@param": { 33 | "prefix": "@param", 34 | "body": [ 35 | "@param ${1:name} ${2:Type and description of the parameter.}$0" 36 | ], 37 | "description": "Documents a parameter." 38 | }, 39 | "@return": { 40 | "prefix": "@return", 41 | "body": [ 42 | "@param ${1:name} ${2:Type and description of the parameter.}$0" 43 | ], 44 | "description": "Documents a the returned object." 45 | }, 46 | "@example": { 47 | "prefix": "@example", 48 | "body": [ 49 | "@example", 50 | "```", 51 | "${1:Write me later}$0", 52 | "```" 53 | ], 54 | "description": "Adds an example to the documentation." 55 | }, 56 | "@see": { 57 | "prefix": "@see", 58 | "body": [ 59 | "@see ${1:item.}$0" 60 | ], 61 | "description": "References another item or piece of documentation." 62 | }, 63 | "@throws": { 64 | "prefix": "@throws", 65 | "body": [ 66 | "@throws ${1:IOException} ${2:Description.}$0" 67 | ], 68 | "description": "Document an exception raised by the item. Synonym of @exception." 69 | }, 70 | "@exception": { 71 | "prefix": "@exception", 72 | "body": [ 73 | "@exception ${1:IOException} ${2:Description.}$0" 74 | ], 75 | "description": "Document an exception raised by the item. Synonym of @throws." 76 | }, 77 | "@since": { 78 | "prefix": "@since", 79 | "body": [ 80 | "@since ${1:1.0}$0" 81 | ], 82 | "description": "Version of Java when the the product was implemented." 83 | }, 84 | "@serial": { 85 | "prefix": "@serial", 86 | "body": [ 87 | "@serial ${1:Field description.}$0" 88 | ], 89 | "description": "The @serial tag should be placed in the javadoc comment for a default serializable field. Using @serial at a class level overrides @serial at a package level." 90 | }, 91 | "@serialField": { 92 | "prefix": "@serialField", 93 | "body": [ 94 | "@serialField ${1:Field name} ${2:Field type} ${3:Field description.}$0" 95 | ], 96 | "description": "The @serialField tag is used to document an ObjectStreamField component of a serialPersistentFields array. One of these tags should be used for each ObjectStreamField component." 97 | }, 98 | "@serialData": { 99 | "prefix": "@serialData", 100 | "body": [ 101 | "@serialData ${1:Data description.}$0" 102 | ], 103 | "description": "The @serialData tag describes the sequences and types of data written or read. The tag describes the sequence and type of optional data written by writeObject or all data written by the Externalizable.writeExternal method." 104 | }, 105 | "@author": { 106 | "prefix": "@author", 107 | "body": [ 108 | "@author ${1:name}$0" 109 | ], 110 | "description": "You can provide one @author tag, multiple @author tags, or no @author tags. For classes and interfaces only, required." 111 | }, 112 | "@version": { 113 | "prefix": "@version", 114 | "body": [ 115 | "@version ${1:1.39}, ${2:02/28/97}$0" 116 | ], 117 | "description": "The Java Software convention for the argument to the @version tag is the SCCS string \"%I%, %G%\". For classes and interfaces only, required." 118 | }, 119 | "@deprecated": { 120 | "prefix": "@deprecated", 121 | "body": [ 122 | "@deprecated As of JDK ${1:1.1}, replaced by", 123 | "${2:{@link #setBounds(int,int,int,int)}}$0" 124 | ], 125 | "description": "The @deprecated description in the first sentence should at least tell the user when the API was deprecated and what to use as a replacement. Only the first sentence will appear in the summary section and index. Subsequent sentences can also explain why it has been deprecated." 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /snippets/javascript/next-ts.json: -------------------------------------------------------------------------------- 1 | { 2 | "import Next.js GetStaticProps type": { 3 | "prefix": "igsp", 4 | "body": "import { GetStaticProps } from 'next';", 5 | "description": "Next.js GetStaticProps type import" 6 | }, 7 | "import Next.js InferGetStaticPropsType": { 8 | "prefix": "infg", 9 | "body": "import { InferGetStaticPropsType } from 'next'", 10 | "description": "Next.js InferGetStaticPropsType import" 11 | }, 12 | "use Next.js InferGetStaticPropsType": { 13 | "prefix": "uifg", 14 | "body": [ 15 | "function ${1:${TM_FILENAME_BASE}}({ posts }: InferGetStaticPropsType) {", 16 | "\treturn $2", 17 | "}" 18 | ], 19 | "description": "use InferGetStaticPropsType snippet" 20 | }, 21 | "Next.js Get initial props outside Component": { 22 | "prefix": "gip", 23 | "body": [ 24 | "${1:${TM_FILENAME_BASE}}.getInitialProps = async ({ req }) => {", 25 | "\treturn $2", 26 | "}" 27 | ], 28 | "description": "Next.js Get initial props outside Component" 29 | }, 30 | "Next.js getInitialProps() inside Class Component": { 31 | "prefix": "cgip", 32 | "body": ["static async getInitialProps() {", "\treturn { $1 };", "}"], 33 | "description": "Next.js static async getInitialProps() inside Class Component" 34 | }, 35 | "Next.js getStaticProps() export": { 36 | "prefix": "gsp", 37 | "body": [ 38 | "export const getStaticProps: GetStaticProps = async (context) => {", 39 | "\treturn {", 40 | "\t\tprops: {$1}", 41 | "\t};", 42 | "}" 43 | ], 44 | "description": "Next.js getStaticProps() export" 45 | }, 46 | "Next.js getStaticPaths() export": { 47 | "prefix": "gspt", 48 | "body": [ 49 | "export const getStaticPaths: GetStaticPaths = async () => {", 50 | "\treturn {", 51 | "\t\tpaths: [", 52 | "\t\t\t{ params: { $1 }}", 53 | "\t\t],", 54 | "\t\tfallback: $2", 55 | "\t};", 56 | "}" 57 | ], 58 | "description": "Next.js pre-renders all the static paths https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation" 59 | }, 60 | "import Next.js GetStaticPaths type": { 61 | "prefix": "igspt", 62 | "body": "import { GetStaticPaths } from 'next'", 63 | "description": "Next.js GetStaticPaths type import" 64 | }, 65 | "Next.js getServerSideProps() export": { 66 | "prefix": "gssp", 67 | "body": [ 68 | "export const getServerSideProps: GetServerSideProps = async (context) => {", 69 | "\treturn {", 70 | "\t\tprops: {$1}", 71 | "\t};", 72 | "}" 73 | ], 74 | "description": "Next.js getServerSideProps() export https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering" 75 | }, 76 | "import Next.js GetServerSideProps type": { 77 | "prefix": "igss", 78 | "body": "import { GetServerSideProps } from 'next'", 79 | "description": "Next.js GetServerSideProps type import" 80 | }, 81 | "import Next.js InferGetServerSidePropsType": { 82 | "prefix": "ifgss", 83 | "body": "import { InferGetServerSidePropsType } from 'next'", 84 | "description": "Next.js InferGetServerSidePropsType import" 85 | }, 86 | "use Next.js InferGetServerSidePropsType": { 87 | "prefix": "ufgss", 88 | "body": [ 89 | "function ${1:${TM_FILENAME_BASE}}({ data }: InferGetServerSidePropsType) {", 90 | "\treturn $2", 91 | "}" 92 | ], 93 | "description": "use InferGetServerSidePropsType snippet" 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /snippets/javascript/next.json: -------------------------------------------------------------------------------- 1 | { 2 | "Next.js Get initial props outside Component": { 3 | "prefix": "gip", 4 | "body": "${1:${TM_FILENAME_BASE}}.getInitialProps = ({ req }) => {\treturn $2}", 5 | "description": "Next.js Get initial props outside Component" 6 | }, 7 | "Next.js getInitialProps() inside Class Component": { 8 | "prefix": "cgip", 9 | "body": ["static async getInitialProps() {", "\treturn { $1 };", "}"], 10 | "description": "Next.js static async getInitialProps() inside Class Component" 11 | }, 12 | "Next.js getStaticProps() export": { 13 | "prefix": "gsp", 14 | "body": [ 15 | "export async function getStaticProps(context) {", 16 | "\treturn {", 17 | "\t\tprops: {$1}", 18 | "\t};", 19 | "}" 20 | ], 21 | "description": "Next.js getStaticProps() export" 22 | }, 23 | "Next.js getStaticPaths() export": { 24 | "prefix": "gspt", 25 | "body": [ 26 | "export async function getStaticPaths() {", 27 | "\treturn {", 28 | "\t\tpaths: [", 29 | "\t\t\t{ params: { $1 }}", 30 | "\t\t],", 31 | "\t\tfallback: $2", 32 | "\t};", 33 | "}" 34 | ], 35 | "description": "Next.js pre-renders all the static paths https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation" 36 | }, 37 | "Next.js getServerSideProps() export": { 38 | "prefix": "gssp", 39 | "body": [ 40 | "export async function getServerSideProps(context) {", 41 | "\treturn {", 42 | "\t\tprops: {$1}", 43 | "\t};", 44 | "}" 45 | ], 46 | "description": "Next.js getServerSideProps() export https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering" 47 | }, 48 | "import Next.js Head": { 49 | "prefix": "imh", 50 | "body": "import Head from 'next/head';", 51 | "description": "Next.js Head import" 52 | }, 53 | "import Next.js Link": { 54 | "prefix": "iml", 55 | "body": "import Link from 'next/link';", 56 | "description": "Next.js Link import" 57 | }, 58 | "Use Next.js Link": { 59 | "prefix": "usl", 60 | "body": ["", "\t", "\t\t$0", "\t", ""], 61 | "description": "Next.js Link Tag with " 62 | }, 63 | "Use Next.js Link With Pathname": { 64 | "prefix": "uslp", 65 | "body": [ 66 | "", 67 | "\t", 68 | "\t\t$0", 69 | "\t", 70 | "" 71 | ], 72 | "description": "Next.js Link with Pathname" 73 | }, 74 | "Use Next.js LinkTagWithDynmicRoute": { 75 | "prefix": "usld", 76 | "body": [ 77 | "", 78 | "\t", 79 | "\t\t$0", 80 | "\t", 81 | "" 82 | ], 83 | "description": "Next.js Link Tag with Dynamic Route" 84 | }, 85 | "importNextRouter": { 86 | "prefix": "imro", 87 | "body": "import Router from 'next/router';", 88 | "description": "Next.js Router import" 89 | }, 90 | "Next.js Router from useRouter": { 91 | "prefix": "usro", 92 | "body": "const router = useRouter();", 93 | "description": "Declare Next.js Router from useRouter" 94 | }, 95 | "Next.js query param from useRouter": { 96 | "prefix": "nroq", 97 | "body": "const { $1 } = router.query;", 98 | "description": "Destructure Next.js query param from Router from useRouter" 99 | }, 100 | "importNextRouterWithRouter": { 101 | "prefix": "imrow", 102 | "body": "import Router, { withRouter } from 'next/router';", 103 | "description": "Next.js Router and { withRouter } import" 104 | }, 105 | "importNextUseRouter": { 106 | "prefix": "imuro", 107 | "body": "import { useRouter } from 'next/router';", 108 | "description": "Next.js { useRouter } import" 109 | }, 110 | "Import Next Image component": { 111 | "prefix": "imni", 112 | "body": "import Image from 'next/image';", 113 | "description": "Next.js 10 Image component import" 114 | }, 115 | "Use sized Next Image component": { 116 | "prefix": "usim", 117 | "body": "", 118 | "description": "Use sized Next Image component" 119 | }, 120 | "Use unsized Next Image component": { 121 | "prefix": "usimu", 122 | "body": "", 123 | "description": "Use sized Next Image component" 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /snippets/kivy.json: -------------------------------------------------------------------------------- 1 | { 2 | "orientaiton from pykv-snippets": { 3 | "prefix": "orientation", 4 | "body": "orientation: '${1|vertical,horizontal|}'" 5 | }, 6 | "font_size from pykv-snippets": { 7 | "prefix": "font_size", 8 | "body": "font_size: " 9 | }, 10 | "padding from pykv-snippets": { 11 | "prefix": "padding", 12 | "body": "padding: " 13 | }, 14 | "size_x from pykv-snippets": { 15 | "prefix": ["sx", "size_hint_x"], 16 | "body": "size_hint_x: " 17 | }, 18 | "size_y from pykv-snippets": { 19 | "prefix": ["sy", "size_hint_y"], 20 | "body": "size_hint_y: " 21 | }, 22 | "size_hint from pykv-snippets" : { 23 | "prefix" : "size_hint", 24 | "body" : "size_hint: $1, $2" 25 | }, 26 | "pos_hint from pykv-snippets" : { 27 | "prefix" : "pos_hint", 28 | "body" : "pos_hint: {'${1|x,right,center_x|}': $2, '${3|y,top,center_y|}': $4}$0" 29 | }, 30 | "Rectangle: from pykv-snippets": { 31 | "prefix": "rect", 32 | "body": "Rectangle: " 33 | }, 34 | "rectangle: from pykv-snippets": { 35 | "prefix": "rect", 36 | "body": "rectangle: " 37 | }, 38 | "Color: from pykv-snippets": { 39 | "prefix": "color", 40 | "body": "Color: " 41 | }, 42 | "color: from pykv-snippets": { 43 | "prefix": "color", 44 | "body": "color: " 45 | }, 46 | "on_press from pykv-snippets": { 47 | "prefix": ["onpress", "on_press"], 48 | "body": "on_press: " 49 | }, 50 | "on_release from pykv-snippets": { 51 | "prefix": ["onrelease", "on_release"], 52 | "body": "on_release: " 53 | }, 54 | "on_text from pykv-snippets": { 55 | "prefix": ["ontext", "on_text"], 56 | "body": "on_text: " 57 | }, 58 | "on_text_validate from pykv-snippets": { 59 | "prefix": ["ontextvalidate", "on_text_validate"], 60 | "body": "on_text_validate: " 61 | }, 62 | "set from pykv-snippets": { 63 | "prefix": "#:set", 64 | "body": "#: set ${1:key} ${2:expr}" 65 | }, 66 | "import from pykv-snippets": { 67 | "prefix": "#:import", 68 | "body": "#: import ${1:alias} ${2:package}" 69 | }, 70 | "include from pykv-snippets": { 71 | "prefix": "#:include", 72 | "body": "#: include ${1:file}" 73 | }, 74 | "size_hint_x from pykv-sippets": { 75 | "prefix": ["sx", "size_hint_x"], 76 | "body": "size_hint_x=", 77 | "description": "keyword argument of Widget" 78 | }, 79 | "size_hint_y from pykv-sippets": { 80 | "prefix": ["sy", "size_hint_y"], 81 | "body": "size_hint_y=", 82 | "description": "keyword argument of Widget" 83 | }, 84 | "size_hint from pykv-sippets": { 85 | "prefix": "size_hint", 86 | "body": "size_hint=($1, $2)$0", 87 | "description": "keyword argument of Widget" 88 | }, 89 | "pos_hint from pykv-sippets": { 90 | "prefix": "pos_hint", 91 | "body": "pos_hint={'${1|x,right,center_x|}': $2, '${3|y,top,center_y|}': $4}$0", 92 | "description": "keyword argument of Widget" 93 | }, 94 | "font_size from pykv-sippets": { 95 | "prefix": "font_size", 96 | "body": "font_size=", 97 | "description": "keyword argument of Widget" 98 | }, 99 | "orientation from pykv-sippets": { 100 | "prefix": "orientation", 101 | "body": "orientation='${1|vertical,horizontal|}'", 102 | "description": "keyword argument of Layout classes" 103 | }, 104 | "text from pykv-sippets": { 105 | "prefix": "text", 106 | "body": "text='$1'$0", 107 | "description": "keyword argument of Widget" 108 | }, 109 | "transition from pykv-snippets": { 110 | "prefix": "transition", 111 | "body": "transition=", 112 | "description": "keyword argument of ScreenManager" 113 | }, 114 | "background_color from pykv-snippets": { 115 | "prefix": ["background_color", "bg"], 116 | "body": "background_color=", 117 | "description": "keyword argument of Button and so on" 118 | }, 119 | "duration from pykv-snippets": { 120 | "prefix": "duration", 121 | "body": "duration=", 122 | "description": "keyword argument of Animation" 123 | }, 124 | "opacity from pykv-snippets": { 125 | "prefix": "opacity", 126 | "body": "opacity=", 127 | "description": "keyword argument of Animation" 128 | }, 129 | "step from pykv-snippets": { 130 | "prefix": "step", 131 | "body": "step=", 132 | "description": "keyword argument of Animation" 133 | }, 134 | "size from pykv-snippets": { 135 | "prefix": "size", 136 | "body": "size=", 137 | "description": "keyword argument of Animation" 138 | }, 139 | "on_press from pykv-sippets": { 140 | "prefix": ["onpress", "on_press"], 141 | "body": "on_press=${1:callback}", 142 | "description": "keyword argument of Widget.bind" 143 | }, 144 | "on_release from pykv-sippets": { 145 | "prefix": ["onrelease", "on_release"], 146 | "body": "on_release=${1:callback}", 147 | "description": "keyword argument of Widget.bind" 148 | }, 149 | "on_start from pykv-snippets": { 150 | "prefix": ["onstart", "on_start"], 151 | "body": "on_start=${1:callback}", 152 | "description": "keyword argument of Widget.bind" 153 | }, 154 | "on_complete from pykv-snippets": { 155 | "prefix": ["oncomplete", "on_complete"], 156 | "body": "on_complete=${1:callback}", 157 | "description": "keyword argument of Widget.bind" 158 | }, 159 | "on_progress from pykv-snippets": { 160 | "prefix": ["onprogress", "on_progress"], 161 | "body": "on_progress=${1:callback}", 162 | "description": "keyword argument of Widget.bind" 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /snippets/kotlin/kotlin.json: -------------------------------------------------------------------------------- 1 | { 2 | "open keyword": { 3 | "prefix": "open", 4 | "body": ["open "], 5 | "description": "Snippet for open keyword" 6 | }, 7 | "override keyword": { 8 | "prefix": "override", 9 | "body": ["override "], 10 | "description": "Snippet for override keyword" 11 | }, 12 | "class": { 13 | "prefix": "class", 14 | "body": ["class ${TM_FILENAME_BASE} {", "\t$0", "}"], 15 | "description": "Snippet for class declaration" 16 | }, 17 | "init": { 18 | "prefix": "init", 19 | "body": ["init {\n\t$0\n}"], 20 | "description": "Snippet for init block" 21 | }, 22 | "set": { 23 | "prefix": "set", 24 | "body": ["set(${1:arg}: ${2:type}) {\n\t$0\n}"], 25 | "description": "Snippet for set block" 26 | }, 27 | "get": { 28 | "prefix": "get", 29 | "body": ["get() ${1:value}"], 30 | "description": "Snippet for get block" 31 | }, 32 | "constructor": { 33 | "prefix": "constructor", 34 | "body": ["constructor(${1:arg}: ${2:type}) {\n\t$0\n}"], 35 | "description": "Snippet for constructor function" 36 | }, 37 | "function declaration": { 38 | "prefix": "fun", 39 | "body": "fun ${1:main}(${2:args} : ${3:Array}) {\n\t$0\n}", 40 | "description": "Snippet for function declaration" 41 | }, 42 | "variable declaration": { 43 | "prefix": "var", 44 | "body": "var ${1:name} = ${2:value}", 45 | "description": "Snippet for a variable" 46 | }, 47 | "variable declaration with val": { 48 | "prefix": "val", 49 | "body": "val ${1:name} = ${2:value}", 50 | "description": "Snippet for a variable" 51 | }, 52 | "if": { 53 | "prefix": "if", 54 | "body": "if (${1:condition}) ${2:value}", 55 | "description": "Snippet for if expression" 56 | }, 57 | "if...else": { 58 | "prefix": "ifelse", 59 | "body": "if (${1:condition}) \n\t${2:value}\nelse\n\t${3:value}", 60 | "description": "Snippet for if...else expression" 61 | }, 62 | "when": { 63 | "prefix": "when", 64 | "body": "when (${1:value}) {\n\t${2:branch} -> ${3:branchValue}\n\n\telse -> ${4:defaultValue}\n}", 65 | "description": "Snippet for when expression" 66 | }, 67 | "while": { 68 | "prefix": "while", 69 | "body": "while (${1:condition}) {\n\t$0\n}", 70 | "description": "Snippet for while expression" 71 | }, 72 | "do...while": { 73 | "prefix": "do", 74 | "body": "do {\n\t$1\n} while (${2:condition})", 75 | "description": "Snippet for do...while expression" 76 | }, 77 | "for": { 78 | "prefix": "for", 79 | "body": "for (${1:i} in ${2:0}..${3:5})\n\t${4:expression}", 80 | "description": "Snippet for iterating array with for loop" 81 | }, 82 | "foreach": { 83 | "prefix": "foreach", 84 | "body": "for (${1:item} in ${2:list})\n\t${3:expression}", 85 | "description": "Snippet for iterating array with for loop" 86 | }, 87 | "try...catch": { 88 | "prefix": "try", 89 | "body": "try {\n\t$1\n} catch(${2:e}: ${3:Type}){\n\t$4\n}", 90 | "description": "Snippet for try block" 91 | }, 92 | "finally": { 93 | "prefix": "finally", 94 | "body": "finally {\n\t$1\n}", 95 | "description": "Snippet for finally block" 96 | }, 97 | "package": { 98 | "prefix": "package", 99 | "body": "package ${1:packageName}", 100 | "description": "Snippet for package statement" 101 | }, 102 | "import": { 103 | "prefix": "import", 104 | "body": "import ${1:packageName}", 105 | "description": "Snippet for import statement" 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /snippets/loremipsum.json: -------------------------------------------------------------------------------- 1 | { 2 | "Lorem Ipsum Sentence": { 3 | "prefix": "loremSent", 4 | "body": "Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat.", 5 | "description": "Lorem Ipsum Sentence" 6 | }, 7 | "Lorem Ipsum Paragraph": { 8 | "prefix": "loremPara", 9 | "body": "Lorem ipsum dolor sit amet, officia excepteur ex fugiat reprehenderit enim labore culpa sint ad nisi Lorem pariatur mollit ex esse exercitation amet. Nisi anim cupidatat excepteur officia. Reprehenderit nostrud nostrud ipsum Lorem est aliquip amet voluptate voluptate dolor minim nulla est proident. Nostrud officia pariatur ut officia. Sit irure elit esse ea nulla sunt ex occaecat reprehenderit commodo officia dolor Lorem duis laboris cupidatat officia voluptate. Culpa proident adipisicing id nulla nisi laboris ex in Lorem sunt duis officia eiusmod. Aliqua reprehenderit commodo ex non excepteur duis sunt velit enim. Voluptate laboris sint cupidatat ullamco ut ea consectetur et est culpa et culpa duis.", 10 | "description": "Lorem Ipsum Paragraph" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /snippets/lua/lua.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "prefix": "req", 4 | "body": ["require(${1:module})"], 5 | "description": "Require module" 6 | }, 7 | "return": { 8 | "prefix": "rt", 9 | "body": ["return $0"], 10 | "description": "Return value" 11 | }, 12 | "assigment": { 13 | "prefix": "ll", 14 | "body": ["local ${1:varName} = ${0:value}"], 15 | "description": "Define a variable" 16 | }, 17 | "local": { 18 | "prefix": "l", 19 | "body": ["local ${0}"], 20 | "description": "Declare a variable" 21 | }, 22 | "locreq": { 23 | "prefix": "lreq", 24 | "body": ["local ${1:module} = require(\"${2:$1}\")$0"], 25 | "description": "Require module as a variable" 26 | }, 27 | "class": { 28 | "prefix": "cl", 29 | "body": [ 30 | "${1:M} = {}\n", 31 | "$1.${2:new} = function($3)", 32 | "\t${6}", 33 | "end" 34 | ], 35 | "description": "Create a class" 36 | }, 37 | "if": { 38 | "prefix": "if", 39 | "body": ["if ${1:true} then", "\t$0", "end"] 40 | }, 41 | "elseif": { 42 | "prefix": "elseif", 43 | "body": ["elseif ${1:true} then", "\t$0"] 44 | }, 45 | "for": { 46 | "prefix": "for", 47 | "body": ["for $1 do", "\t$0", "end"], 48 | "description": "for statement" 49 | }, 50 | "for-numeric": { 51 | "prefix": "forn", 52 | "body": ["for ${1:i} = ${2:1}, ${3:10} do", "\t$0", "end"], 53 | "description": "for numeric range statement" 54 | }, 55 | "for-ipairs": { 56 | "prefix": "fori", 57 | "body": ["for ${1:i}, ${2:x} in ipairs(${3:t}) do", "\t$0", "end"], 58 | "description": "for i, x in ipairs(t)" 59 | }, 60 | "for-pairs": { 61 | "prefix": "forp", 62 | "body": ["for ${1:k}, ${2:v} in pairs(${3:t}) do", "\t$0", "end"], 63 | "description": "for k, v in pairs(t)" 64 | }, 65 | "forline": { 66 | "prefix": "forline", 67 | "body": [ 68 | "local f = io.open(${1:${2:filename}}, \"${3:r}\")\n", 69 | "while true do", 70 | "\tline = f:read()", 71 | "\tif line == nil then break end\n", 72 | "\t${0}", 73 | "end" 74 | ], 75 | "description": "Read file line by line" 76 | }, 77 | "function": { 78 | "prefix": "fu", 79 | "body": ["function ${1:name}($2)", "\t${0}", "end"], 80 | "description": "Define a function" 81 | }, 82 | "assign-function": { 83 | "prefix": "f=", 84 | "body": ["${1:name} = function($2)", "\t${0}", "end"], 85 | "description": "Assign a function to a variable" 86 | }, 87 | "local-function": { 88 | "prefix": "lfu", 89 | "body": ["local function ${1:name}($2)", "\t${0}", "end"], 90 | "description": "Define a local function" 91 | }, 92 | "local-assign-function": { 93 | "prefix": "lf=", 94 | "body": ["local ${1:name} = function($2)", "\t${0}", "end"], 95 | "description": "Assign a function to a local variable" 96 | }, 97 | "anonymous-function": { 98 | "prefix": "f)", 99 | "body": ["function($1)", "\t${0}", "end"], 100 | "description": "Create an anonymous function" 101 | }, 102 | "member-function": { 103 | "prefix": "f,", 104 | "body": ["${1:name} = function($2)", "\t${0}", "end,"], 105 | "description": "Assign a function to a table key" 106 | }, 107 | "print": { 108 | "prefix": "p", 109 | "body": ["print(${0})"] 110 | }, 111 | "self": { 112 | "prefix": "self:", 113 | "body": ["function self:${1:methodName}($2)", "\t$0", "end"] 114 | }, 115 | "while": { 116 | "prefix": "while", 117 | "body": ["while ${1:true} do", "\t$0", "end"] 118 | }, 119 | "pcall": { 120 | "prefix": "pca", 121 | "body": ["pcall(${1:function})"], 122 | "description": "Protect call a function" 123 | }, 124 | "locpcall": { 125 | "prefix": "lpca", 126 | "body": ["local ${1:status}, ${2:err_or_value} = pcall(${3:function})"], 127 | "description": "Protect call a function as a variable" 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /snippets/lua/luadoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment": { 3 | "prefix": "---", 4 | "body": [ 5 | "--- ${1:A one-line summary.}", 6 | "-- ${2:Description.}$0", 7 | "-- @param ${5:name} ${6:type} ${7:Parameter description.}", 8 | "-- @return ${3:type} ${4: Description of the returned object.}", 9 | "-- @usage ${8:Example about how to use it.}" 10 | ], 11 | "description": "A lua comment with short summary, description, parameters, return, and example." 12 | }, 13 | "comment_simple": { 14 | "prefix": "--", 15 | "body": [ 16 | "--- ${1:A one-line summary.}", 17 | "-- ${2:Description.}$0" 18 | ], 19 | "description": "A simple lua comment with short summary and description. Useful when you prefer to add the tags manually on functions." 20 | }, 21 | "@author": { 22 | "prefix": "@author", 23 | "body": [ 24 | "@author ${1:text.}$0" 25 | ], 26 | "description": "An author of the module or file." 27 | }, 28 | "@copyright": { 29 | "prefix": "@copyright", 30 | "body": [ 31 | "@copyright ${1:text.}$0" 32 | ], 33 | "description": "The copyright notice of the module or file. LuaDoc adds a © sign between the label (Copyright) and the given text (e.g. 2004-2007 Kepler Project)." 34 | }, 35 | "@field": { 36 | "prefix": "@field", 37 | "body": [ 38 | "@field ${1:description.}$0" 39 | ], 40 | "description": "Describe a table field definition." 41 | }, 42 | "@param": { 43 | "prefix": "@param", 44 | "body": [ 45 | "@param ${1:name} ${2:type} ${3:Parameter description.}$0" 46 | ], 47 | "description": "Describe function parameters. It requires the name of the parameter and its description." 48 | }, 49 | "@release": { 50 | "prefix": "@release", 51 | "body": [ 52 | "@release ${1:text}$0" 53 | ], 54 | "description": "Free format string to describe the module or file release." 55 | }, 56 | "@return": { 57 | "prefix": "@return", 58 | "body": [ 59 | "@return ${1:type} ${2:Description of the returned object.}$0" 60 | ], 61 | "description": "Describe a returning value of the function. Since Lua can return multiple values, this tag should appear more than once." 62 | }, 63 | "@see": { 64 | "prefix": "@see", 65 | "body": [ 66 | "@see ${1:name of a function or table}$0" 67 | ], 68 | "description": "Refers to other descriptions of functions or tables." 69 | }, 70 | "@class": { 71 | "prefix": "@class", 72 | "body": [ 73 | "@class ${1:name}$0" 74 | ], 75 | "description": "If LuaDoc cannot infer the type of documentation (function, table or module definition), the programmer can specify it explicitly." 76 | }, 77 | "@description": { 78 | "prefix": "@description", 79 | "body": [ 80 | "@description ${1:text}$0" 81 | ], 82 | "description": "The description of the function or table. This is usually infered automatically." 83 | }, 84 | "@name": { 85 | "prefix": "@name", 86 | "body": [ 87 | "@name ${1:text}$0" 88 | ], 89 | "description": "The name of the function or table definition. This is usually infered from the code analysis, and the programmer does not need to define it. If LuaDoc can infer the name of the function automatically it's even not recomended to define the name explicitly, to avoid redundancy." 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /snippets/make.json: -------------------------------------------------------------------------------- 1 | { 2 | "help": { 3 | "prefix": "help", 4 | "body": [ 5 | "help: ## Prints help for targets with comments", 6 | "\t@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = \":.*?## \"}; {printf \"\\033[36m%-30s\\033[0m %s\\n\", $\\$1, $\\$2}'" 7 | ], 8 | "description": "help target for self-documented Makefile" 9 | }, 10 | "if statement": { 11 | "prefix": "if", 12 | "body": ["ifeq (${1:cond0}, ${2:cond1})", "\t$0", "endif"], 13 | "description": "if statement" 14 | }, 15 | "print": { 16 | "prefix": "print", 17 | "body": ["print-%: ; @echo $*=$($*)"], 18 | "description": "print" 19 | }, 20 | "if else statement": { 21 | "prefix": "ife", 22 | "body": [ 23 | "ifeq (${1:cond0}, ${2:cond1})", 24 | "\t$3", 25 | "else", 26 | "\t$4", 27 | "endif" 28 | ], 29 | "description": "if else statement" 30 | }, 31 | "else": { 32 | "prefix": "el", 33 | "body": ["else", "\t$0"], 34 | "description": "else" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /snippets/nix.json: -------------------------------------------------------------------------------- 1 | { 2 | "ifelse": { 3 | "prefix": "if", 4 | "body": [ 5 | "if $1 then", 6 | " $2", 7 | "else$0" 8 | ], 9 | "description": "if-else block" 10 | }, 11 | "letin": { 12 | "prefix": "let", 13 | "body": [ 14 | "let", 15 | " $1", 16 | "in $0" 17 | ], 18 | "description": "let-in block" 19 | }, 20 | "hash": { 21 | "prefix": "hash", 22 | "body": "\"${1:sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=}\";", 23 | "description": "Empty hash" 24 | }, 25 | "fetchFrom": { 26 | "prefix": "fetchFrom", 27 | "body": [ 28 | "fetchFrom${1|GitHub,GitLab,Gitea,Gitiles,BitBucket,Savannah,RepoOrCz,SourceHut|} {", 29 | " owner = \"$2\";", 30 | " repo = \"$3\";", 31 | " rev = \"${4:v\\${version\\}}\";", 32 | " hash = \"${5:sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=}\";", 33 | "};" 34 | ], 35 | "description": "fetchFromGitHub, or any other common fetcher from Nixpkgs" 36 | }, 37 | "fetchurl": { 38 | "prefix": "fetchurl", 39 | "body": [ 40 | "fetchurl {", 41 | " url = \"$1\";", 42 | " hash = \"${2:sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=}\";", 43 | "};" 44 | ], 45 | "description": "fetchurl with default empty hash" 46 | }, 47 | "package-arguments": { 48 | "prefix": "pkg", 49 | "body": [ 50 | "{ lib", 51 | ", ${1:stdenv}", 52 | ", $2", 53 | "}:", 54 | "", 55 | "$0" 56 | ], 57 | "description": "Package arguments, starting with { lib" 58 | }, 59 | "stdenv.mkDerivation": { 60 | "prefix": "mkd", 61 | "body": [ 62 | "stdenv.mkDerivation (finalAttrs: {", 63 | " pname = \"$1\";", 64 | " version = \"$2\";", 65 | "", 66 | " src = $3", 67 | "", 68 | " nativeBuildInputs = [", 69 | " $4", 70 | " ];", 71 | " buildInputs = [", 72 | " $0", 73 | " ];", 74 | "", 75 | " meta = {", 76 | " description = \"$5\";", 77 | " homepage = \"$6\";", 78 | " license = lib.licenses.$7;", 79 | " maintainers = with lib.maintainers; [ $8 ];", 80 | " };", 81 | "})" 82 | ], 83 | "description": "Nixpkgs' stdenv.mkDerivation template" 84 | }, 85 | "meta": { 86 | "prefix": "meta", 87 | "body": [ 88 | "meta = {", 89 | " description = \"$1\";", 90 | " homepage = \"$2\";", 91 | " license = lib.licenses.$3;", 92 | " maintainers = with lib.maintainers; [ $0 ];", 93 | "};" 94 | ], 95 | "description": "Nixpkgs' minimal meta attribute set" 96 | }, 97 | "with": { 98 | "prefix": "with", 99 | "body": ["with $1; $0;"], 100 | "description": "with expression" 101 | }, 102 | "inherit": { 103 | "prefix": "inherit", 104 | "body": ["inherit $1;"], 105 | "description": "inherit expression" 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /snippets/ocaml/dune-project.json: -------------------------------------------------------------------------------- 1 | { 2 | "lang": { 3 | "prefix": "lang", 4 | "body": ["(lang $1 $2)"], 5 | "description": "Snippet for a lang stanza" 6 | }, 7 | "name": { 8 | "prefix": "name", 9 | "body": ["(name $1)"], 10 | "description": "Snippet for a name stanza" 11 | }, 12 | "using": { 13 | "prefix": "using", 14 | "body": ["(using $1 $2)"], 15 | "description": "Snippet for an using stanza" 16 | }, 17 | "info": { 18 | "prefix": "info", 19 | "body": [ 20 | "(license $1)\n(authors \"$2\")\n(maintainers \"$3\")\n(source (${4|uri,github|} $5))\n(bug_reports \"$6\")\n(homepage \"$7\")\n(documentation \"$8\")" 21 | ], 22 | "description": "Snippet to add info related stanzas" 23 | }, 24 | "package": { 25 | "prefix": "package", 26 | "body": [ 27 | "(package\n (name $1)\n (synopsis \"$2\")\n (description \"$3\")\n (depends $4))" 28 | ], 29 | "description": "Snippet for a package stanza" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /snippets/ocaml/dune.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "prefix": "env", 4 | "body": ["(env\n ($1 $2))"], 5 | "description": "Snippet for an env stanza" 6 | }, 7 | "executable": { 8 | "prefix": "executable", 9 | "body": ["(executable\n (name $1)\n (public_name $2)\n (libraries $3))"], 10 | "description": "Snippet for an executable stanza" 11 | }, 12 | "executables": { 13 | "prefix": "executables", 14 | "body": ["(executables\n (names $1)\n (public_names $2)\n (libraries $3))"], 15 | "description": "Snippet for an executables stanza" 16 | }, 17 | "install": { 18 | "prefix": "install", 19 | "body": ["(install\n (section $1)\n (files ($2.exe as $3)))"], 20 | "description": "Snippet for an install stanza" 21 | }, 22 | "library": { 23 | "prefix": "library", 24 | "body": ["(library\n (name $1)\n (public_name $2)\n (libraries $3))"], 25 | "description": "Snippet for a library stanza" 26 | }, 27 | "rule": { 28 | "prefix": "rule", 29 | "body": ["(rule\n (alias $1)\n (deps $2)\n (targets $3)\n (action $4))"], 30 | "description": "Snippet for a rule stanza" 31 | }, 32 | "test": { 33 | "prefix": "test", 34 | "body": ["(test\n (name $1)\n (libraries $2))"], 35 | "description": "Snippet for a test stanza" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /snippets/ocaml/ocaml.json: -------------------------------------------------------------------------------- 1 | { 2 | "lambda": { 3 | "prefix": "fun", 4 | "body": ["fun (${1:pattern}) -> ${2:${1:pattern}}"], 5 | "description": "Snippet for a lambda function definition" 6 | }, 7 | "let .. in": { 8 | "prefix": "let", 9 | "body": ["let ${1:pattern} = ${2:()} in$0"], 10 | "description": "Snippet for a let .. in binding" 11 | }, 12 | "function": { 13 | "prefix": "func", 14 | "body": ["function\n| $0"], 15 | "description": "Snippet for a match function definition" 16 | }, 17 | "variant pattern": { 18 | "prefix": "|", 19 | "body": ["| ${1:_} -> $0"], 20 | "description": "Snippet for a variant definition" 21 | }, 22 | "let (toplevel)": { 23 | "prefix": "let", 24 | "body": ["let ${1:pattern} = $0"], 25 | "description": "Snippet for a let definition" 26 | }, 27 | "val": { 28 | "prefix": "val", 29 | "body": ["val ${1:name} : $0"], 30 | "description": "Snippet for a value definition" 31 | }, 32 | "sig": { 33 | "prefix": "sig", 34 | "body": ["sig\n ${1}\nend$0"], 35 | "description": "Snippet for a signature block" 36 | }, 37 | "struct": { 38 | "prefix": "struct", 39 | "body": ["struct\n ${1}\nend$0"], 40 | "description": "Snippet for a struct block" 41 | }, 42 | "module": { 43 | "prefix": "module", 44 | "body": ["module ${1:M} = struct\n ${2}\nend$0"], 45 | "description": "Snippet for a module definition" 46 | }, 47 | "module signature": { 48 | "prefix": "module", 49 | "body": ["module ${1:M} : sig\n ${2}\nend$0"], 50 | "description": "Snippet for a module signature definition" 51 | }, 52 | "module type": { 53 | "prefix": "module", 54 | "body": ["module type ${1:M} = sig\n ${2}\nend$0"], 55 | "description": "Snippet for a module type definition" 56 | }, 57 | "match": { 58 | "prefix": "match", 59 | "body": ["match ${1:scrutinee} with\n| ${2:pattern} -> ${3:${2:pattern}}"], 60 | "description": "Snippet for a pattern match block definition" 61 | }, 62 | "type declaration": { 63 | "prefix": "type", 64 | "body": ["type ${1:name} = $0"], 65 | "description": "Snippet for a type declaration" 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /snippets/ocaml/ocamllex.json: -------------------------------------------------------------------------------- 1 | { 2 | "rule": { 3 | "prefix": "rule", 4 | "body": ["rule ${1:pattern} = parse", "| $0"], 5 | "description": "Snippet for a rule" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /snippets/org.json: -------------------------------------------------------------------------------- 1 | { 2 | "center block": { 3 | "description": "#+BEGIN_CENTER block", 4 | "prefix": "', \"${2:file name}\") or die \"Cannot open file '$2' for writing: \\$!\";" 91 | ] 92 | }, 93 | "print to file": { 94 | "prefix": "file print", 95 | "body": ["print \\$${1:fh} \"${2:string}\\n\";"] 96 | }, 97 | "read file into a scalar": { 98 | "prefix": "slurp", 99 | "body": [ 100 | "use File::Slurp;", 101 | "", 102 | "my \\$${1:contents} = read_file(\"${2:file_path}\")" 103 | ] 104 | }, 105 | "read a directory": { 106 | "prefix": "readdir", 107 | "body": [ 108 | "opendir(my \\$${1:dir}, '$2') or die \"Cannot open directory '$2': \\$!\";", 109 | "my @files = readdir(\\$$1);", 110 | "closedir(\\$$1);" 111 | ] 112 | }, 113 | "create a directory": { 114 | "prefix": "mkdir", 115 | "body": [ 116 | "mkdir \"${1:dir}\" or die \"Cannot create directory '$1': \\$!\";" 117 | ] 118 | }, 119 | "split a string": { 120 | "prefix": "split", 121 | "body": [ 122 | "my @${1:array var} = split(/${2:delimiter pattern}/, \"${3:string}\");" 123 | ] 124 | }, 125 | "join array": { 126 | "prefix": "join", 127 | "body": [ 128 | "my \\$${1:string var} = join('${2:delimiter pattern}', @${3:array_var});" 129 | ] 130 | }, 131 | "format time": { 132 | "prefix": "strftime", 133 | "body": [ 134 | "use POSIX qw(strftime);", 135 | "my $formatted = strftime('%Y-%m-%d %H:%M:%S', localtime($1));" 136 | ] 137 | }, 138 | "try catch block": { 139 | "prefix": "trycatch", 140 | "body": [ 141 | "use Try::Tiny;", 142 | "", 143 | "try {", 144 | "\t${1:body}", 145 | "} catch {", 146 | "\tmy \\$catch_error = shift;", 147 | "\tprint \"Error: \\$catch_error\\n\";", 148 | "} finally {", 149 | "\tif (@_) {", 150 | "\t\tprint \"The try block died with error: @_\\n\"", 151 | "\t} else {", 152 | "\t\tprint \"The try ran successfully.\\n\"", 153 | "\t}", 154 | "};" 155 | ] 156 | }, 157 | "perl module": { 158 | "prefix": "module package", 159 | "body": [ 160 | "package ${1:ModuleName};", 161 | "use strict;", 162 | "use warnings;", 163 | "", 164 | "sub new {", 165 | "\tmy (\\$class, %args) = @_;", 166 | "\tmy \\$self = bless {%args}, \\$class;", 167 | "\treturn \\$self;", 168 | "}", 169 | "", 170 | "# Add more methods here", 171 | "$2", 172 | "", 173 | "1; # Return true to indicate successful module loading" 174 | ] 175 | } 176 | } 177 | -------------------------------------------------------------------------------- /snippets/php/phpdoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment": { 3 | "prefix": "/**", 4 | "body": [ 5 | "/**", 6 | " * ${1:A one-line summary.}", 7 | " *", 8 | " * ${2:Description.}$0", 9 | " *", 10 | " * @param ${4:name} ${5:Type and description of the parameter.}", 11 | " * @return ${3:Type and description of the returned value.}", 12 | " *", 13 | " * @example", 14 | " * // ${6:Description of my example.}", 15 | " * ${7:Write me later}", 16 | " */" 17 | ], 18 | "description": "A PHP comment block for functions, including description, param, return, and example." 19 | }, 20 | "comment_simple": { 21 | "prefix": "/*", 22 | "body": [ 23 | "/**", 24 | " * ${1:A one-line summary.}", 25 | " *", 26 | " * ${2:Description.}$0", 27 | " */" 28 | ], 29 | "description": "A simple PHP comment block for classes, including short summary, and details. Useful when you prefer to add the other documentation tags manually." 30 | }, 31 | "@param": { 32 | "prefix": "@param", 33 | "body": [ 34 | "@param ${1:name} ${2:Type and description of the parameter.}$0" 35 | ], 36 | "description": "Type and description of a function parameter." 37 | }, 38 | "@return": { 39 | "prefix": "@return", 40 | "body": [ 41 | "@return ${3:Type and description of the returned value.}$0" 42 | ], 43 | "description": "Type and description of the returned value." 44 | }, 45 | "@example": { 46 | "prefix": "@example", 47 | "body": [ 48 | "* @example", 49 | "* // ${1:Description of my example.}$0", 50 | "* ${2:Write me later}" 51 | ], 52 | "description": "Example that demostrates how to use a function. It can be used several times." 53 | }, 54 | "@throws": { 55 | "prefix": "@throws", 56 | "body": [ 57 | "@throws ${1:ExceptionName} ${2:Description.}$0" 58 | ], 59 | "description": "Indicates the exceptions that can be thrown by a function. This tag is a synonym of @exception." 60 | }, 61 | "@exception": { 62 | "prefix": "@exception", 63 | "body": [ 64 | "@exception ${1:ExceptionName} ${2:Description.}$0" 65 | ], 66 | "description": "Indicates the exceptions that can be thrown by a function. This tag is a synonym of @throws." 67 | } 68 | } 69 | 70 | 71 | -------------------------------------------------------------------------------- /snippets/purescript.json: -------------------------------------------------------------------------------- 1 | { 2 | "ado": { 3 | "body": [ 4 | "ado", 5 | " ${1:binder} ← ${2:expression}", 6 | "", 7 | " in ${3:experssion}" 8 | ], 9 | "description": "Ado-block", 10 | "prefix": [ 11 | "ado" 12 | ] 13 | }, 14 | "case": { 15 | "body": [ 16 | "case ${1:expression} of", 17 | " ${2:case1} → ${3:result}", 18 | " ${4:case2} → ${5:result}$0" 19 | ], 20 | "description": "Case statement", 21 | "prefix": [ 22 | "case" 23 | ] 24 | }, 25 | "derive-instance": { 26 | "body": [ 27 | "derive instance ${1:type}" 28 | ], 29 | "description": "Derive instance", 30 | "prefix": [ 31 | "derive", 32 | "drv" 33 | ] 34 | }, 35 | "derive-newtype-instance": { 36 | "body": [ 37 | "derive newtype instance ${1:type}" 38 | ], 39 | "description": "Derive newtype instance", 40 | "prefix": [ 41 | "derive-newtype", 42 | "drvnt", 43 | "dni" 44 | ] 45 | }, 46 | "do": { 47 | "body": [ 48 | "do", 49 | " ${1:binder} ← ${2:expression}" 50 | ], 51 | "description": "Do-block", 52 | "prefix": [ 53 | "do" 54 | ] 55 | }, 56 | "foreign-import": { 57 | "body": [ 58 | "foreign import ${1:name} ∷ ${2:type}" 59 | ], 60 | "description": "Foreign import", 61 | "prefix": [ 62 | "foreign", 63 | "fri" 64 | ] 65 | }, 66 | "foreign-import-data": { 67 | "body": [ 68 | "foreign import data ${1:name} ∷ ${2:kind}" 69 | ], 70 | "description": "Foreign import data", 71 | "prefix": [ 72 | "foreign-data", 73 | "frd" 74 | ] 75 | }, 76 | "open-row-type-alias": { 77 | "body": [ 78 | "type ${1:type} r =", 79 | " ( ${2:field} ∷ ${3:type}", 80 | " , ${4:field} ∷ ${5:type}", 81 | " | r", 82 | " )" 83 | ], 84 | "description": "Type alias for an open row", 85 | "prefix": [ 86 | "open-row-type-alias", 87 | "rta", 88 | "row" 89 | ] 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /snippets/python/comprehension.json: -------------------------------------------------------------------------------- 1 | { 2 | "List comprehension": { 3 | "prefix": "lc", 4 | "body": "[${3:value} for ${2:value} in ${1:iterable}]$0", 5 | "description": "List comprehension for creating a list based on existing lists." 6 | }, 7 | "List comprehension if else": { 8 | "prefix": "lcie", 9 | "body": "[${3:value} if ${4:condition} else ${5:condition} for ${2:value} in ${1:iterable}]$0", 10 | "description": "List comprehension for creating a list based on existing lists, with conditional if-else statement." 11 | }, 12 | "List comprehension if filter": { 13 | "prefix": "lci", 14 | "body": "[${3:value} for ${2:value} in ${1:iterable} if ${4:condition}$0]", 15 | "description": "List comprehension for creating a list based on existing lists, with conditional if statement." 16 | }, 17 | "Dictionary comprehension": { 18 | "prefix": "dc", 19 | "body": "{${4:key}: ${5:value} for ${2:key}, ${3:value} in ${1:iterable}}$0", 20 | "description": "Handy and faster way to create dictionaries based on existing dictionaries." 21 | }, 22 | "Dictionary comprehension if filter": { 23 | "prefix": "dci", 24 | "body": "{${4:key}: ${5:value} for ${2:key}, ${3:value} in ${1:iterable} if ${6:condition}}$0", 25 | "description": "Handy and faster way to create dictionaries based on existing dictionaries, with conditional if statement." 26 | }, 27 | "Set comprehension": { 28 | "prefix": "sc", 29 | "body": "{${3:value} for ${2:value} in ${1:iterable}}$0", 30 | "description": "Create a set based on existing iterables." 31 | }, 32 | "Set Comprehension if filter": { 33 | "prefix": "sci", 34 | "body": "{${3:value} for ${2:value} in ${1:iterable} if ${4:condition}}$0", 35 | "description": "Create a set based on existing iterables, with condition if statement." 36 | }, 37 | "Generator comprehension": { 38 | "prefix": "gc", 39 | "body": "(${3:key} for ${2:value} in ${1:iterable})$0", 40 | "description": "Create a generator based on existing iterables." 41 | }, 42 | "Generator comprehension if filter": { 43 | "prefix": "gci", 44 | "body": "(${3:key} for ${2:value} in ${1:iterable} if ${4:condition})$0", 45 | "description": "Create a generator based on existing iterables, with condition if statement." 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /snippets/python/debug.json: -------------------------------------------------------------------------------- 1 | { 2 | "PDB set trace": { 3 | "prefix": "pdb", 4 | "body": "__import__('pdb').set_trace()$0", 5 | "description": "Code snippet for pdb debug" 6 | }, 7 | "iPDB set trace": { 8 | "prefix": "ipdb", 9 | "body": "__import__('ipdb').set_trace()$0", 10 | "description": "Code snippet for ipdb debug" 11 | }, 12 | "rPDB set trace": { 13 | "prefix": "rpdb", 14 | "body": "import rpdb2; rpdb2.start_embedded_debugger('${1:debug_password}')$0" 15 | }, 16 | "PuDB set trace": { 17 | "prefix": "pudb", 18 | "body": "import pudb; pudb.set_trace()$0", 19 | "description": "Code snippet for pudb debug" 20 | }, 21 | "IPython set trace": { 22 | "prefix": "ipydb", 23 | "body": "from IPython import embed; embed()$0" 24 | }, 25 | "Celery set trace": { 26 | "prefix": "rdb", 27 | "body": "from celery.contrib import rdb; rdb.set_trace()$0", 28 | "description": "Code snippet for celery remote debugger breakpoint" 29 | }, 30 | "Pretty print": { 31 | "prefix": "pprint", 32 | "body": "__import__('pprint').pprint(${1:expression})$0" 33 | }, 34 | "debugpy remote attach": { 35 | "prefix": "debugpy", 36 | "body": [ 37 | "import debugpy, platform", 38 | "debugpy.listen((platform.node(), ${1:5678}))", 39 | "print(f\"debugpy listening on {platform.node()}:$1\", flush=True)", 40 | "debugpy.wait_for_client()$0" 41 | ], 42 | "description": "Code snippet for debugpy remote attach" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /snippets/python/unittest.json: -------------------------------------------------------------------------------- 1 | { 2 | "Assert equal": { 3 | "prefix": "ase", 4 | "body": "self.assertEqual(${1:expected}, ${2:actual}${3:, '${4:message}'})$0" 5 | }, 6 | "Assert not equal": { 7 | "prefix": "asne", 8 | "body": "self.assertNotEqual(${1:expected}, ${2:actual}${3:, '${4:message}'})$0" 9 | }, 10 | "Assert raises": { 11 | "prefix": "asr", 12 | "body": "self.assertRaises(${1:exception}, ${2:callable}, ${3:args})$0" 13 | }, 14 | "Assert True": { 15 | "prefix": "ast", 16 | "body": "self.assertTrue(${1:actual}${2:, '${3:message}'})$0" 17 | }, 18 | "Assert False": { 19 | "prefix": "asf", 20 | "body": "self.assertFalse(${1:actual}${2:, '${3:message}'})$0" 21 | }, 22 | "Assert is": { 23 | "prefix": "asi", 24 | "body": "self.assertIs(${1:expected}, ${2:actual}${3:, '${4:message}'})$0" 25 | }, 26 | "Assert is not": { 27 | "prefix": "asint", 28 | "body": "self.assertIsNot(${1:expected}, ${2:actual}${3:, '${4:message}'})$0" 29 | }, 30 | "Assert is None": { 31 | "prefix": "asino", 32 | "body": "self.assertIsNone(${1:actual}${2:, '${3:message}'})$0" 33 | }, 34 | "Assert is not None": { 35 | "prefix": "asinno", 36 | "body": "self.assertIsNotNone(${1:actual}${2:, '${3:message}'})$0" 37 | }, 38 | "Assert in": { 39 | "prefix": "asin", 40 | "body": "self.assertIn(${1:needle}, ${2:haystack}${3:, '${4:message}'})$0" 41 | }, 42 | "Assert not in": { 43 | "prefix": "asni", 44 | "body": "self.assertNotIn(${1:needle}, ${2:haystack}${3:, '${4:message}'})$0" 45 | }, 46 | "Assert": { 47 | "prefix": "as", 48 | "body": "self.assert_(${1:boolean expression}${2:, '${3:message}'})$0" 49 | }, 50 | "Fail (a test)": { 51 | "prefix": "fail", 52 | "body": "self.fail('${1:message}')$0" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /snippets/r.json: -------------------------------------------------------------------------------- 1 | { 2 | "library": { 3 | "prefix": "lib", 4 | "body": ["library(${1:package})"] 5 | }, 6 | "require": { 7 | "prefix": "req", 8 | "body": ["require(${1:package})"] 9 | }, 10 | "source": { 11 | "prefix": "src", 12 | "body": ["source(\"${1:file.R}\")"] 13 | }, 14 | "return": { 15 | "prefix": "ret", 16 | "body": "return(${1:code})" 17 | }, 18 | "matrix": { 19 | "prefix": "mat", 20 | "body": "matrix(${1:data}, nrow = ${2:rows}, ncol = ${3:cols})" 21 | }, 22 | "setGeneric": { 23 | "prefix": "sg", 24 | "body": [ 25 | "setGeneric(\"${1:generic}\", function(${2:x, ...}) {", 26 | " standardGeneric(\"${1:generic}\")", 27 | "})\n" 28 | ] 29 | }, 30 | "setMethod": { 31 | "prefix": "sm", 32 | "body": [ 33 | "setMethod(\"${1:generic}\", ${2:class}, function(${2:x, ...}) {", 34 | " ${0}", 35 | "})\n" 36 | ] 37 | }, 38 | "setClass": { 39 | "prefix": "sc", 40 | "body": ["setClass(\"${1:Class}\", slots = c(${2:name = \"type\"}))\n"] 41 | }, 42 | "if": { 43 | "prefix": "if", 44 | "body": ["if (${1:condition}) {", " ${0}", "}\n"] 45 | }, 46 | "else": { 47 | "prefix": "el", 48 | "body": ["else {", " ${0}", "}\n"] 49 | }, 50 | "else if": { 51 | "prefix": "ei", 52 | "body": ["else if (${1:condition}) {", " ${0}", "}\n"] 53 | }, 54 | "function": { 55 | "prefix": "fun", 56 | "body": ["${1:name} <- function(${2:variables}) {", " ${0}", "}\n"] 57 | }, 58 | "for": { 59 | "prefix": "for", 60 | "body": ["for (${1:variable} in ${2:vector}) {", " ${0}", "}\n"] 61 | }, 62 | "while": { 63 | "prefix": "while", 64 | "body": ["while (${1:condition}) {", " ${0}", "}\n"] 65 | }, 66 | "switch": { 67 | "prefix": "switch", 68 | "body": ["switch (${1:object},", " ${2:case} = ${3:action}", ")\n"] 69 | }, 70 | "apply": { 71 | "prefix": "apply", 72 | "body": "apply(${1:array}, ${2:margin}, ${3:...})" 73 | }, 74 | "lapply": { 75 | "prefix": "lapply", 76 | "body": "lapply(${1:list}, ${2:function})" 77 | }, 78 | "sapply": { 79 | "prefix": "sapply", 80 | "body": "sapply(${1:list}, ${2:function})" 81 | }, 82 | "mapply": { 83 | "prefix": "mapply", 84 | "body": "mapply(${1:function}, ${2:...})" 85 | }, 86 | "tapply": { 87 | "prefix": "tapply", 88 | "body": "tapply(${1:vector}, ${2:index}, ${3:function})" 89 | }, 90 | "vapply": { 91 | "prefix": "vapply", 92 | "body": "vapply(${1:list}, ${2:function}, FUN.VALUE = ${3:type}, ${4:...})" 93 | }, 94 | "rapply": { 95 | "prefix": "rapply", 96 | "body": "rapply(${1:list}, ${2:function})" 97 | }, 98 | "timestamp": { 99 | "prefix": "ts", 100 | "body": "# ${CURRENT_DAY_NAME_SHORT} ${CURRENT_MONTH_NAME_SHORT} ${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND} ${CURRENT_YEAR} ------------------------------\n" 101 | }, 102 | "shinyapp": { 103 | "prefix": "shinyapp", 104 | "body": [ 105 | "library(shiny)", 106 | "", 107 | "ui <- fluidPage(", 108 | " ${0}", 109 | ")", 110 | "", 111 | "server <- function(input, output, session) {", 112 | " ", 113 | "}", 114 | "", 115 | "shinyApp(ui, server)\n" 116 | ] 117 | }, 118 | "shinymod": { 119 | "prefix": "shinymod", 120 | "body": [ 121 | "${1:name}UI <- function(id) {", 122 | " ns <- NS(id)", 123 | " tagList(", 124 | " ${2}", 125 | " )", 126 | "}", 127 | "", 128 | "${1:name}Server <- function(id) {", 129 | " moduleServer(id, function(input, output, session) {", 130 | " ${3}", 131 | " })", 132 | "}\n" 133 | ] 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /snippets/reason.json: -------------------------------------------------------------------------------- 1 | { 2 | "function": { 3 | "prefix": "let", 4 | "body": ["let ${1:f} = (${2:pattern}) => ${3:${2:pattern}};$0"], 5 | "description": "Snippet for a short function definition" 6 | }, 7 | "function (block)": { 8 | "prefix": "let", 9 | "body": ["let ${1:f} = (${2:pattern}) => {", "\t${3:${2:pattern}}$0", "};"], 10 | "description": "Snippet for a function block definition" 11 | }, 12 | "lambda": { 13 | "prefix": "fun", 14 | "body": ["(${1:pattern}) => ${2:${1:pattern}}"], 15 | "description": "Snippet for a lambda function" 16 | }, 17 | "lambda (switch)": { 18 | "prefix": "fun", 19 | "body": ["fun", "\t| ${1:pattern} => ${2:${1:pattern}}", "\t;"], 20 | "description": "Snippet for a lambda switch function" 21 | }, 22 | "let": { 23 | "prefix": "let", 24 | "body": ["let ${1:pattern} = ${2:()};$0"], 25 | "description": "Snippet for a variable declaration" 26 | }, 27 | "let (block)": { 28 | "prefix": "let", 29 | "body": ["let ${1:pattern} = {", "\t$0", "};"], 30 | "description": "Snippet for a block variable declaration" 31 | }, 32 | "module": { 33 | "prefix": "module", 34 | "body": ["module ${1:M} = ${2:{}};$0"], 35 | "description":"Snippet for a module declaration" 36 | }, 37 | "module (block)": { 38 | "prefix": "module", 39 | "body": ["module ${1:M} = {", "\t$0", "};"], 40 | "description":"Snippet for a block module declaration" 41 | }, 42 | "module function": { 43 | "prefix": "module", 44 | "body": ["module ${1:M} = (${2:X}: $3{:{}}) => ${4:${2:X}};$0"], 45 | "description": "Snippet for a functor declaration" 46 | }, 47 | "module function (block)": { 48 | "prefix": "module", 49 | "body": ["module ${1:M} = (${2:X}: $3{:{}}) => {", "\t${4:include ${2:X}}", "\t$0", "};"], 50 | "description": "Snippet for a functor block declaration" 51 | }, 52 | "switch": { 53 | "prefix": "switch", 54 | "body": ["switch ${1:scrutinee} {", "| ${2:pattern} => ${3:${2:pattern}}", "};"], 55 | "description": "Snippet for a pattern matching declaration" 56 | }, 57 | "type (alias or abstract)": { 58 | "prefix": "type", 59 | "body": ["type ${1:name} ${2:${3:'${4:arg} }= ${5:'${4:arg}}};$0"], 60 | "description": "Snippet for a type alias declaration" 61 | }, 62 | "type": { 63 | "prefix": "type", 64 | "body": ["type ${1:name} ${2:'${3:arg} }=", "\t| ${4:Con${2: '${3:arg}}}", "\t;"], 65 | "description": "Snippet for a variants declaration" 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /snippets/rescript.json: -------------------------------------------------------------------------------- 1 | { 2 | "Module": { 3 | "prefix": ["module"], 4 | "body": ["module ${1:Name} = {", "\t${2:// Module contents}", "}"] 5 | }, 6 | "Switch": { 7 | "prefix": ["switch"], 8 | "body": [ 9 | "switch ${1:value} {", 10 | "| ${2:pattern1} => ${3:expression}", 11 | "${4:| ${5:pattern2} => ${6:expression}}", 12 | "}" 13 | ] 14 | }, 15 | "Try": { 16 | "prefix": ["try"], 17 | "body": [ 18 | "try {", 19 | "\t${1:expression}", 20 | "} catch {", 21 | "| ${2:MyException} => ${3:expression}", 22 | "}" 23 | ] 24 | }, 25 | "For Loop": { 26 | "prefix": ["for"], 27 | "body": [ 28 | "for ${1:i} in ${2:startValueInclusive} to ${3:endValueInclusive} {", 29 | "\t${4:Js.log(${1:i})}", 30 | "}" 31 | ] 32 | }, 33 | "Reverse For Loop": { 34 | "prefix": ["for"], 35 | "body": [ 36 | "for ${1:i} in ${2:startValueInclusive} downto ${3:endValueInclusive} {", 37 | "\t${4:Js.log(${1:i})}", 38 | "}" 39 | ] 40 | }, 41 | "Global External Object": { 42 | "prefix": ["@bs", "external"], 43 | "body": [ 44 | "@val external ${1:setTimeout}: ${2:(unit => unit, int) => float} = \"${3:setTimeout}\"" 45 | ] 46 | }, 47 | "Global External Module": { 48 | "prefix": ["@bs", "external"], 49 | "body": [ 50 | "@scope(\"${1:Math}\") @val external ${2:random}: ${3:unit => float} = \"${4:random}\"" 51 | ] 52 | }, 53 | "JS Module External": { 54 | "prefix": ["@bs", "external"], 55 | "body": [ 56 | "@module(\"${1:path}\") external ${2:dirname}: ${3:string => string} = \"${4:dirname}\"" 57 | ] 58 | }, 59 | "JS Module Default External": { 60 | "prefix": ["@bs", "external"], 61 | "body": [ 62 | "@module external ${1:leftPad}: ${2:(string, int) => string} = \"${3:leftPad}\"" 63 | ] 64 | }, 65 | "variable": { 66 | "prefix": ["l", "let", "var"], 67 | "body": ["let ${1:x} = ${2:\"hello\"}"] 68 | }, 69 | "mutable variable": { 70 | "prefix": ["lm", "letm", "mvar"], 71 | "body": ["let ${1:x} = ref(${2:\"hello\"})"] 72 | }, 73 | "type": { 74 | "prefix": ["t", "tp", "type"], 75 | "body": ["type ${1:x} = ${2:int}"] 76 | }, 77 | "type with generic": { 78 | "prefix": ["tpg", "typeg"], 79 | "body": ["type ${1:x}<'${2:a}> = ${3:int}"] 80 | }, 81 | "type polimorphic variant": { 82 | "prefix": ["tpv", "typepv"], 83 | "body": ["type ${1:x} = [ #${2:one} | #${3:two} ]"] 84 | }, 85 | "inline functin": { 86 | "prefix": ["fn"], 87 | "body": ["let ${1:name} = (${2}) => ${0}"] 88 | }, 89 | "function": { 90 | "prefix": ["function"], 91 | "body": ["let ${1:doSomeStuff} = (${2}) => {", "\t${0}", "}"] 92 | }, 93 | "pipe functions": { 94 | "prefix": ["fnpp", "funcpp", "pipe"], 95 | "body": ["${1:firstFunction}", "\t->${2:secondFunction}"] 96 | }, 97 | "console.log": { 98 | "prefix": ["cl", "col"], 99 | "body": ["Js.log(${1:something})"] 100 | }, 101 | "console.info": { 102 | "prefix": ["ci", "coi"], 103 | "body": ["Js.info(${1:something})"] 104 | }, 105 | "console.warn": { 106 | "prefix": ["cw", "cow"], 107 | "body": ["Js.warn(${1:something})"] 108 | }, 109 | "console.error": { 110 | "prefix": ["ce", "cer"], 111 | "body": ["Js.error(${1:something})"] 112 | }, 113 | "console.trace": { 114 | "prefix": ["ct", "ctr"], 115 | "body": ["Js.trace(${1:something})"] 116 | }, 117 | "console.timeStart": { 118 | "prefix": ["cts"], 119 | "body": ["Js.timeStart(${1:something})"] 120 | }, 121 | "console.timeEnd": { 122 | "prefix": ["cte"], 123 | "body": ["Js.timeEnd(${1:something})"] 124 | }, 125 | "Belt. fromString": { 126 | "prefix": ["bfs", "bfstr"], 127 | "body": ["Belt.Int.fromString(${1:10})"] 128 | }, 129 | "Belt. toString": { 130 | "prefix": ["bts", "btstr"], 131 | "body": ["Belt.Int.toString(${1:10})"] 132 | }, 133 | "if inline": { 134 | "prefix": ["ifi"], 135 | "body": ["if ${1:a} {${2:b}} else {${3:c}}"] 136 | }, 137 | "Ternary operator": { 138 | "prefix": ["to"], 139 | "body": ["${1:a} ? ${2:b} : ${3:c}"] 140 | }, 141 | "Object destructuring": { 142 | "prefix": ["dob"], 143 | "body": ["let {${1:a}} = ${2:data}"] 144 | }, 145 | "Array destructuring": { 146 | "prefix": ["dar"], 147 | "body": ["let [${1:a}] = ${2:data}"] 148 | }, 149 | "Raise exception": { 150 | "prefix": ["rs", "raise"], 151 | "body": ["raise(${1:SomeError}(${2:// write your text}))"] 152 | }, 153 | "@genType": { 154 | "prefix": ["gt"], 155 | "body": ["@genType"] 156 | }, 157 | "@genType import": { 158 | "prefix": ["gti"], 159 | "body": ["@genType.import(\"${1:./MyMath}\")"] 160 | }, 161 | "@genType alias": { 162 | "prefix": ["gta"], 163 | "body": ["@genType.as(\"${1:CB}\")"] 164 | }, 165 | "@@warning": { 166 | "prefix": ["@w"], 167 | "body": ["@@warning(\"${1:-27}\")"] 168 | }, 169 | "alias": { 170 | "prefix": ["@a"], 171 | "body": ["@as(\"${1:aria-label}\")"] 172 | }, 173 | "compiler deprecation warn": { 174 | "prefix": ["@dw"], 175 | "body": [ 176 | "@deprecated(\"${1:This field deprecated}. Use ${2:something} instead\")" 177 | ] 178 | }, 179 | "Top level js embed": { 180 | "prefix": ["tle", "tlr"], 181 | "body": ["%%raw(`", "\t${1://js code}", "`)"] 182 | }, 183 | "expression level js embed": { 184 | "prefix": ["ele", "exe", "elr"], 185 | "body": ["%raw(\"${1://js expression}\")"] 186 | }, 187 | "js debugger": { 188 | "prefix": ["dbg"], 189 | "body": ["%%debugger"] 190 | }, 191 | "React Component": { 192 | "prefix": ["react.component", "@react"], 193 | "body": ["@react.component", "let make = (${1}) => {", "\t${2}", "}"] 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /snippets/rmarkdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "YAML Header": { 3 | "prefix": "---", 4 | "body": [ 5 | "---", 6 | "title: ${1:title}", 7 | "date: ${2:\"`r Sys.Date()`\"}", 8 | "output: ${4:pdf_document}", 9 | "---" 10 | ] 11 | }, 12 | "Insert Block Chunck": { 13 | "prefix": "```", 14 | "body": ["```{r}", "${1}", "```"] 15 | }, 16 | "Insert Inline Chunck": { 17 | "prefix": "`", 18 | "body": "`r ${0}`" 19 | }, 20 | "Insert Code Language": { 21 | "prefix": "```", 22 | "body": ["```{${1:lang}}", "${0}", "```"] 23 | }, 24 | "Insert Block Equation": { 25 | "prefix": "$$", 26 | "body": ["\\$$", "${0}", "\\$$"] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /snippets/rst.json: -------------------------------------------------------------------------------- 1 | { 2 | "main title": { 3 | "prefix": ["main title", "="], 4 | "body": ["============================\n${0}\n============================\n\n"], 5 | "description": "Add main title" 6 | }, 7 | "title": { 8 | "prefix": ["title", "="], 9 | "body": ["${0}\n============================\n\n"], 10 | "description": "Add title" 11 | }, 12 | "section": { 13 | "prefix": ["section", "-"], 14 | "body": ["${0}\n------------\n\n"], 15 | "description": "Add section" 16 | }, 17 | "Links": { 18 | "prefix": ["l", "link", "hyperlink"], 19 | "body": ["${1:text}_\n.. _${1:text} ${2:url}${0}"], 20 | "description": "Add links" 21 | }, 22 | "URLS": { 23 | "prefix": ["u", "url"], 24 | "body": ["<${1}> ${0}"], 25 | "description": "Add urls" 26 | }, 27 | "Images": { 28 | "prefix": "img", 29 | "body": [".. image:: ${1:path}${0}"], 30 | "description": "Add images" 31 | }, 32 | "Insert strong emphasized text": { 33 | "prefix": ["bold", "b", "strong emphasis"], 34 | "body": "**${1}** $0", 35 | "description": "Insert bold text" 36 | }, 37 | "Insert emphasized text": { 38 | "prefix": ["i", "italic", "emphasis"], 39 | "body": "*${1}* $0", 40 | "description": "Insert italic text" 41 | }, 42 | "Insert quoted text": { 43 | "prefix": "quote", 44 | "body": "::\n\n ${1}", 45 | "description": "Insert quoted text" 46 | }, 47 | "Insert code": { 48 | "prefix": ["code", "literal"], 49 | "body": "`${1}` $0", 50 | "description": "Insert code" 51 | }, 52 | "Insert code block": { 53 | "prefix": "codeblock", 54 | "body": ["::\n $0"], 55 | "description": "Insert code block" 56 | }, 57 | "Insert unordered list": { 58 | "prefix": "unordered list", 59 | "body": ["- ${1:first}", "- ${2:second}", "- ${3:third}", "$0"], 60 | "description": "Insert unordered list" 61 | }, 62 | "Insert ordered list": { 63 | "prefix": "ordered list", 64 | "body": ["1. ${1:first}", "2. ${2:second}", "3. ${3:third}", "$0"], 65 | "description": "Insert ordered list" 66 | }, 67 | "Insert transition": { 68 | "prefix": ["horizontal rule", "transition"], 69 | "body": "----------\n\n", 70 | "description": "Insert transition rule" 71 | }, 72 | "Insert task list": { 73 | "prefix": "task", 74 | "body": ["- [${1| ,x|}] ${2:text}", "${0}"], 75 | "description": "Insert task list" 76 | }, 77 | "Insert task list 2": { 78 | "prefix": "task2", 79 | "body": ["- [${1| ,x|}] ${2:text}", "- [${3| ,x|}] ${4:text}", "${0}"], 80 | "description": "Insert task list with 2 tasks" 81 | }, 82 | "Insert task list 3": { 83 | "prefix": "task3", 84 | "body": [ 85 | "- [${1| ,x|}] ${2:text}", 86 | "- [${3| ,x|}] ${4:text}", 87 | "- [${5| ,x|}] ${6:text}", 88 | "${0}" 89 | ], 90 | "description": "Insert task list with 3 tasks" 91 | }, 92 | "Insert task list 4": { 93 | "prefix": "task4", 94 | "body": [ 95 | "- [${1| ,x|}] ${2:text}", 96 | "- [${3| ,x|}] ${4:text}", 97 | "- [${5| ,x|}] ${6:text}", 98 | "- [${7| ,x|}] ${8:text}", 99 | "${0}" 100 | ], 101 | "description": "Insert task list with 4 tasks" 102 | }, 103 | "Insert task list 5": { 104 | "prefix": "task5", 105 | "body": [ 106 | "- [${1| ,x|}] ${2:text}", 107 | "- [${3| ,x|}] ${4:text}", 108 | "- [${5| ,x|}] ${6:text}", 109 | "- [${7| ,x|}] ${8:text}", 110 | "- [${9| ,x|}] ${10:text}", 111 | "${0}" 112 | ], 113 | "description": "Insert task list with 5 tasks" 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /snippets/scala.json: -------------------------------------------------------------------------------- 1 | { 2 | "object": { 3 | "prefix": "object", 4 | "body": [ 5 | "object ${1:ObjectName} {", 6 | "\t${2:println(\"Hello, world!\")}", 7 | "}" 8 | ], 9 | "description": "Object" 10 | }, 11 | "class": { 12 | "prefix": "class", 13 | "body": [ 14 | "class ${1:ClassName} {", 15 | "\t${2:println(\"Hello, world!\")}", 16 | "}" 17 | ], 18 | "description": "Class" 19 | }, 20 | "case_class": { 21 | "prefix": "case_class", 22 | "body": "case class ${1:CaseClassName}(${2:argName}: ${3:ArgType})", 23 | "description": "Case class" 24 | }, 25 | "trait": { 26 | "prefix": "trait", 27 | "body": ["trait ${1:TraitName} {", "\t${2:}", "}"], 28 | "description": "Trait" 29 | }, 30 | "main_object": { 31 | "prefix": "obj_main", 32 | "body": [ 33 | "object ${1:ObjectName} {", 34 | "\tdef main(args: Array[String]): Unit = {", 35 | "\t\t${2:println(\"Hello, world!\")}", 36 | "\t}", 37 | "}" 38 | ], 39 | "description": "Object with main method" 40 | }, 41 | "app": { 42 | "prefix": "app", 43 | "body": [ 44 | "object ${1:App} extends App {", 45 | "\t${2:println(\"Hello, world!\")}", 46 | "}" 47 | ], 48 | "description": "Object extending App" 49 | }, 50 | "def": { 51 | "prefix": "def", 52 | "body": [ 53 | "def ${1:methodName}(${2:argName}: ${3:ArgType}): ${4:ReturnType} = {", 54 | "\t${5:println(\"Hello, world!\")}", 55 | "}" 56 | ], 57 | "description": "Method" 58 | }, 59 | "def_short": { 60 | "prefix": "def_short", 61 | "body": "def ${1:methodName}(${2:argName}: ${3:ArgType}): ${4:ReturnType} = ${5:println(\"Hello, world!\")}", 62 | "description": "Method as one-liner" 63 | }, 64 | "for": { 65 | "prefix": "for", 66 | "body": [ 67 | "for (${1:element} <- elements) {", 68 | "\t${2:println(element.toString)}", 69 | "}" 70 | ], 71 | "description": "For loop" 72 | }, 73 | "while": { 74 | "prefix": "while", 75 | "body": [ 76 | "while(${1:condition}) {", 77 | "\t${2:println(\"Hello, world!\")}", 78 | "}" 79 | ], 80 | "description": "While loop" 81 | }, 82 | "ifelse": { 83 | "prefix": "ifelse", 84 | "body": [ 85 | "if (${1:condition}) {", 86 | "\t${2:println(\"Hello, world!\")}", 87 | "} else {", 88 | "\t${2:println(\"Hello, world!\")}", 89 | "}" 90 | ], 91 | "description": "Branch based on conditions using if/else" 92 | }, 93 | "match": { 94 | "prefix": "match", 95 | "body": [ 96 | "${1:x} match {", 97 | "\tcase ${2:0} => ${3:\"zero\"}", 98 | "\tcase ${4:1} => ${5:\"one\"}", 99 | "}" 100 | ], 101 | "description": "Branch based on conditions using pattern matching" 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /snippets/shell/shell.json: -------------------------------------------------------------------------------- 1 | { 2 | "echo": { 3 | "prefix": "echo", 4 | "body": "echo \"${0:message}\"", 5 | "description": "Echo a message." 6 | }, 7 | "read": { 8 | "prefix": "read", 9 | "body": "read -r ${0:VAR}", 10 | "description": "Read input of ${VAR}." 11 | }, 12 | "if": { 13 | "prefix": "if", 14 | "body": "if [[ ${1:condition} ]]; then\n\t${0}\nfi", 15 | "description": "An IF statement." 16 | }, 17 | "elseif": { 18 | "prefix": "elseif", 19 | "body": "elif [[ ${1:condition} ]]; then\n\t${0}", 20 | "description": "Add an elseif to an if statement." 21 | }, 22 | "else": { 23 | "prefix": "else", 24 | "body": "else\n\t${0:command}", 25 | "description": "else" 26 | }, 27 | "for_in": { 28 | "prefix": "for_in", 29 | "body": "for ${1:VAR} in ${0:LIST}\ndo\n\techo \"\\$${1:VAR}\"\ndone\n", 30 | "description": "for loop in list" 31 | }, 32 | "for_i": { 33 | "prefix": "for_i", 34 | "body": "for ((${1:i} = 0; ${1:i} < ${0:10}; ${1:i}++)); do\n\techo \"\\$${1:i}\"\ndone\n", 35 | "description": "An index-based iteration for loop." 36 | }, 37 | "while": { 38 | "prefix": "while", 39 | "body": "while [[ ${1:condition} ]]; do\n\t${0}\ndone\n", 40 | "description": "A while loop by condition." 41 | }, 42 | "until": { 43 | "prefix": "until", 44 | "body": "until [[ ${1:condition} ]]; do\n\t${0}\ndone\n", 45 | "description": "until loop by condition" 46 | }, 47 | "function": { 48 | "prefix": "function", 49 | "body": "${1:name} ()\n{\n\t${0}\n}", 50 | "description": [ 51 | "This defines a function named name.\n", 52 | "The reserved word function is optional.\n", 53 | "If the function reserved word is supplied, the parentheses are optional.\n", 54 | "1. Recommended way:\n", 55 | "name() {}\n", 56 | "2. C-like-way:\nfunction name [()] {}" 57 | ] 58 | }, 59 | "case": { 60 | "prefix": "case", 61 | "body": "case \"\\$${1:VAR}\" in\n\t${2:1}) echo 1\n\t;;\n\t${3:2|3}) echo 2 or 3\n\t;;\n\t*) echo default\n\t;;\nesac\n", 62 | "description": [ 63 | "case word in [ [(] pattern [ | pattern ] ... ) list ;; ] ... esac\n", 64 | "A case command first expands word, and tries to match it against each pattern in turn." 65 | ] 66 | }, 67 | "break": { 68 | "prefix": "break", 69 | "body": "break ${0}", 70 | "description": [ 71 | "The break command tells Bash to leave the loop straight away.\n", 72 | "Enter the break or break (n) where n=number of loops." 73 | ] 74 | }, 75 | "expr": { 76 | "prefix": "expr", 77 | "body": "expr ${0:1 + 1}", 78 | "description": "Calculate numbers with Bash." 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /snippets/shell/shelldoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "shebang": { 3 | "prefix": "#!/usr/bin/env", 4 | "body": [ 5 | "#!/usr/bin/env ${1:sh}", 6 | "#", 7 | "# ${2:Description of the script.}$0" 8 | ], 9 | "description": [ 10 | "Shebang to specify what shell is going to run the script by default. It includes a description of the script. \n\nIt must be defined in the first line of the script.\n\nBy using #!/usr/bin/env we are making the shebang portable, meaning it is going to work correctly even if the interpreter is not located under /usr/bin" 11 | ] 12 | }, 13 | "comment": { 14 | "prefix": "###", 15 | "body": [ 16 | "#######################################", 17 | "# ${1:Description of the function.}$0", 18 | "# Globals:", 19 | "# ${3:MY_VAR}", 20 | "# Arguments:", 21 | "# ${4:None}", 22 | "# Outputs:", 23 | "# ${5:Output to STDOUT or STDERR.}", 24 | "# Returns:", 25 | "# ${2: Description of the returned value.}", 26 | "#######################################" 27 | ], 28 | "description": "A shell comment block for functions, including description, globals, arguments, outputs, and returns. For functions without I/O, use the simple version of this snippet instead.\n\nYou can delete 'Globals'/'Arguments'/'Outputs' in functions with no input/output.\n\nIt doesn't includes, but accepts the optional keywords:\n 'See'\n 'Raises'" 29 | }, 30 | "comment_simple": { 31 | "prefix": "##", 32 | "body": [ 33 | "#######################################", 34 | "# ${1:Description of the function.}$0", 35 | "#######################################" 36 | ], 37 | "description": "A simple shell comment block for functions, with a description. Useful when the user prefers to add the other documentation tags manually." 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /snippets/swift.json: -------------------------------------------------------------------------------- 1 | { 2 | "print": { 3 | "prefix": "print", 4 | "body": "print(\"$1\")\n$0", 5 | "description": "print(\"...\")" 6 | }, 7 | "print value": { 8 | "prefix": "printv", 9 | "body": "print(\"\\($1)\")\n$0", 10 | "description": "print(\"\\(...)\")" 11 | }, 12 | "while": { 13 | "prefix": "while", 14 | "body": ["while ${1:condition} {", "\t$0", "}"], 15 | "description": "while statement" 16 | }, 17 | "repeat-while": { 18 | "prefix": "repeat", 19 | "body": ["repeat {", "\t$0", "} while ${1:condition}"], 20 | "description": "repeat-while statement" 21 | }, 22 | "for": { 23 | "prefix": "for", 24 | "body": ["for ${1:item} in ${2:collection} {", "\t$0", "}"], 25 | "description": "for-in statement" 26 | }, 27 | "if": { 28 | "prefix": "if", 29 | "body": ["if ${1:condition} {", "\t$0", "}"], 30 | "description": "if statement" 31 | }, 32 | "else if": { 33 | "prefix": "elif", 34 | "body": ["else if ${1:condition} {", "\t$0", "}"], 35 | "description": "else clause with a nested if statement" 36 | }, 37 | "else": { 38 | "prefix": "else", 39 | "body": ["else {", "\t$0", "}"], 40 | "description": "else clause" 41 | }, 42 | "if let": { 43 | "prefix": "iflet", 44 | "body": ["if let ${1:value} = ${2:optional} {", "\t$0", "}"], 45 | "description": "if statement with optional binding" 46 | }, 47 | "guard": { 48 | "prefix": "guard", 49 | "body": ["guard ${1:condition} else {", "\t$0", "}"], 50 | "description": "guard statement" 51 | }, 52 | "guard let": { 53 | "prefix": "guardlet", 54 | "body": ["guard let ${1:value} = ${2:optional} else {", "\t$0", "}"], 55 | "description": "guard statement with optional binding" 56 | }, 57 | "switch": { 58 | "prefix": "switch", 59 | "body": [ 60 | "switch ${1:value} {", 61 | "case ${2:pattern}:", 62 | "\t$0", 63 | "default:", 64 | "\t", 65 | "}" 66 | ], 67 | "description": "switch statement" 68 | }, 69 | "do": { 70 | "prefix": "do", 71 | "body": ["do {", "\t$0", "} catch ${1:error} {", "\t$2", "}"], 72 | "description": "do statement" 73 | }, 74 | "func": { 75 | "prefix": "func", 76 | "body": ["func ${1:name}(${2:parameters}) -> ${3:Type} {", "\t$0", "}"], 77 | "description": "function declaration" 78 | }, 79 | "struct": { 80 | "prefix": "struct", 81 | "body": ["struct ${1:Name} {", "", "\t$0", "}"], 82 | "description": "struct declaration" 83 | }, 84 | "enum": { 85 | "prefix": "enum", 86 | "body": ["enum ${1:Name} {", "", "\tcase $0", "}"], 87 | "description": "enum declaration" 88 | }, 89 | "class": { 90 | "prefix": "class", 91 | "body": ["class ${1:Name} {", "", "\t$0", "}"], 92 | "description": "class declaration" 93 | }, 94 | "protocol": { 95 | "prefix": "protocol", 96 | "body": ["protocol ${1:Name} {", "", "\t$0", "}"], 97 | "description": "protocol declaration" 98 | }, 99 | "extension": { 100 | "prefix": "extension", 101 | "body": ["extension ${1:Type} {", "", "\t$0", "}"], 102 | "description": "extension declaration" 103 | }, 104 | "swiftui-view": { 105 | "prefix": "view", 106 | "body": [ 107 | "struct ${1:Name}: View {", 108 | "", 109 | "\tvar body: some View {", 110 | "\t\t$0", 111 | "\t}", 112 | "}" 113 | ], 114 | "description": "SwiftUI view declaration" 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /snippets/verilog.json: -------------------------------------------------------------------------------- 1 | { 2 | "if": { 3 | "prefix": "if", 4 | "body": ["if (${1}) begin", "\n${0}", "\nend"], 5 | "description": "If statement" 6 | }, 7 | "if-else": { 8 | "prefix": "ife", 9 | "body": [ 10 | "if (${1}) begin", 11 | "\n\t${2}", 12 | "\nend", 13 | "\nelse begin", 14 | "\n\t${3}", 15 | "\nend" 16 | ], 17 | "description": "If-else statement" 18 | }, 19 | "else-if": { 20 | "prefix": "eif", 21 | "body": ["else if (${1}) begin", "\n${0}", "\nend"], 22 | "description": "else-if statement" 23 | }, 24 | "else": { 25 | "prefix": "el", 26 | "body": ["else begin", "\n${0}", "\nend"], 27 | "description": "else-if statement" 28 | }, 29 | "while": { 30 | "prefix": "wh", 31 | "body": ["whlie (${1}) begin\n\t${0}\nend"], 32 | "description": "While loop" 33 | }, 34 | "repeat loop": { 35 | "prefix": "repeat (${1}) begin", 36 | "body": ["repeat (${1}) begin\n\t${0}\nend"], 37 | "description": "Repeat loop" 38 | }, 39 | "case statement": { 40 | "prefix": "case", 41 | "body": [ 42 | "case (${1:variable})\n\t${2: value}: begin\n\t\t${3}\n\tend\ndefault: begin\n\t${4}\n", 43 | "end", 44 | "endcase" 45 | ], 46 | "description": "Case Statement" 47 | }, 48 | "casez statement": { 49 | "prefix": "casez", 50 | "body": [ 51 | "casez (${1:variable})\n\t${2: value}: begin\n\t\t${3}\n\tend\ndefault: begin\n\t${4}\n", 52 | "end", 53 | "endcase" 54 | ], 55 | "description": "Casez Statement" 56 | }, 57 | "always block": { 58 | "prefix": "al", 59 | "body": ["always @(${1:Sensitive list}) begin\n", "\t${0}", "\nend"], 60 | "description": "Always block" 61 | }, 62 | "module block": { 63 | "prefix": "modu", 64 | "body": ["module ${1:FILENAME} (\n\t${2}\n);", "\t${0}", "\nendmodule"], 65 | "description": "Module Block" 66 | }, 67 | "for": { 68 | "prefix": "for", 69 | "body": [ 70 | "for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) begin", 71 | "\n\t${4}", 72 | "\nend" 73 | ], 74 | "description": "For loop" 75 | }, 76 | "forever": { 77 | "prefix": "forev", 78 | "body": ["forever begin\n\t${0}\nend"], 79 | "description": "Forever loop" 80 | }, 81 | "function": { 82 | "prefix": "fun", 83 | "body": [ 84 | "function ${1:void} ${2:name}(${3});", 85 | "\n\t${0}", 86 | "endfunction: $2" 87 | ], 88 | "description": "Function snippet" 89 | }, 90 | "task": { 91 | "prefix": "task", 92 | "body": ["task ${1:name}(${2});", "\n\t${0}", "\nendtask: $1"], 93 | "description": "Task snippet" 94 | }, 95 | "Initial Begin": { 96 | "prefix": "ini", 97 | "body": ["initial begin\n\t${0}\nend"], 98 | "description": "Initial Begin" 99 | }, 100 | "typedef struct packed": { 101 | "prefix": "tdsp", 102 | "body": [ 103 | "typedef struct packed {", 104 | "\n\tint ${2:data};", 105 | "\n${1:name}" 106 | ], 107 | "description": "Typedef struct packed" 108 | }, 109 | "typedef enum": { 110 | "prefix": "tde", 111 | "body": [ 112 | "typedef enum ${2:logic[15:0]} \n{", 113 | "\n${3:REG = 16'h0000}", 114 | "\n} ${1:my_dest_t};" 115 | ], 116 | "description": "Typedef enum" 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /snippets/zig.json: -------------------------------------------------------------------------------- 1 | { 2 | "Import": { 3 | "prefix": "import", 4 | "body": ["const ${1} = @import(\"${1}\");"], 5 | "description": "Importing Libraries" 6 | }, 7 | "CImport": { 8 | "prefix": "cimport", 9 | "body": ["const c = @cImport({", " @cDefine(\"${1}\");", "});"], 10 | "description": "Importing C Header Files" 11 | }, 12 | "buildExe": { 13 | "prefix": "bExe", 14 | "body": [ 15 | "const exe = b.addExecutable(.{", 16 | " .name = \"${1}\",", 17 | " .root_source_file = b.path(\"${2:path}\"),", 18 | " .target = target,", 19 | " .optimize = optimize,", 20 | "});", 21 | "b.installArtifact(exe);" 22 | ], 23 | "description": "Building an exe" 24 | } 25 | } 26 | --------------------------------------------------------------------------------
{{${1:model} | json}}
{{${1:model} | async | json}}