diff --git a/package-lock.json b/package-lock.json index d8dd7a4..f40f3ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -813,7 +813,8 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true }, "set-blocking": { "version": "2.0.0", @@ -964,29 +965,6 @@ } } }, - "vscode-jsonrpc": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz", - "integrity": "sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg==" - }, - "vscode-languageclient": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.2.1.tgz", - "integrity": "sha512-7jrS/9WnV0ruqPamN1nE7qCxn0phkH5LjSgSp9h6qoJGoeAKzwKz/PF6M+iGA/aklx4GLZg1prddhEPQtuXI1Q==", - "requires": { - "semver": "^5.5.0", - "vscode-languageserver-protocol": "3.14.1" - } - }, - "vscode-languageserver-protocol": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz", - "integrity": "sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g==", - "requires": { - "vscode-jsonrpc": "^4.0.0", - "vscode-languageserver-types": "3.14.0" - } - }, "vscode-languageserver-types": { "version": "3.14.0", "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz", diff --git a/package.json b/package.json index b350806..df7888c 100644 --- a/package.json +++ b/package.json @@ -1,235 +1,246 @@ { - "name": "adonisjs", - "displayName": "AdonisJS", - "description": "Official extension for AdonisJS framework", - "version": "0.0.1", - "engines": { - "vscode": "^1.39.0" - }, - "categories": [ - "Snippets", - "Other" - ], - "keywords": [ - "adonis", - "edge", - "template", - "snippet", - "formatter", - "autocompletion", - "commands" - ], - "activationEvents": [ - "onLanguage:edge", - "workspaceContains:**/.adonisrc.json" - ], - "main": "./out/extension.js", - "contributes": { - "languages": [ - { - "id": "edge", - "aliases": [ - "Edge Template", - "Edge", - "edge" - ], - "extensions": [ - ".edge", - ".edge.html" - ], - "configuration": "./src/syntaxes/edge/edge.configuration.jsonc" - } - ], - "grammars": [ - { - "language": "edge", - "scopeName": "text.html.edge", - "path": "./src/syntaxes/edge/edge.tmLanguage.json", - "embeddedLanguages": { - "source.css": "css", - "source.js": "javascript" - } - } - ], - "commands": [ - { - "title": "🚀 Adonis: Key Generate", - "command": "adonisjs.key.generate" - }, - { - "title": "🚀 Adonis: Make Controller", - "command": "adonisjs.make.controller" - }, - { - "title": "🚀 Adonis: Make Model", - "command": "adonisjs.make.model" - }, - { - "title": "🚀 Adonis: Make Trait", - "command": "adonisjs.make.trait" - }, - { - "title": "🚀 Adonis: Make View", - "command": "adonisjs.make.view" - }, - { - "title": "🚀 Adonis: Make Middleware", - "command": "adonisjs.make.middleware" - }, - { - "title": "🚀 Adonis: Make Command", - "command": "adonisjs.make.command" - }, - { - "title": "🚀 Adonis: Make Exception", - "command": "adonisjs.make.exception" - }, - { - "title": "🚀 Adonis: Make Hook", - "command": "adonisjs.make.hook" - }, - { - "title": "🚀 Adonis: Make Migration", - "command": "adonisjs.make.migration" - }, - { - "title": "🚀 Adonis: Make Listener", - "command": "adonisjs.make.listener" - }, - { - "title": "🚀 Adonis: Make Provider", - "command": "adonisjs.make.provider" - }, - { - "title": "🚀 Adonis: Make Exception Handler", - "command": "adonisjs.make.ehandler" - }, - { - "title": "🚀 Adonis: Make Seed", - "command": "adonisjs.make.seed" - }, - { - "title": "🚀 Adonis: Run Instructions", - "command": "adonisjs.run.instructions" - } - ], - "configuration": { - "type": "object", - "title": "AdonisJS", - "properties": { - "adonisjs.autocomplete.quickJump": { - "type": "boolean", - "default": true, - "description": "Quick jump between files using 'Ctrl' + Click" - }, - "adonisjs.autocomplete.folderTip": { - "type": "boolean", - "default": true, - "description": "Display file path name on hover" - }, - "adonisjs.autocomplete.maxLinesCount": { - "type": "integer", - "default": 1200, - "description": "Maximum lines of text to scan for autocompletion" - }, - "adonisjs.autocomplete.viewsDirectories": { - "type": "array", - "description": "Paths to the directory containing edge views", - "default": [ - "resources/views" - ] - }, - "adonisjs.autocomplete.viewsExtensions": { - "type": "array", - "description": "Supported file extension for view completion", - "default": [ - ".edge" - ] - }, - "adonisjs.autocomplete.viewsRegex": { - "type": "string", - "description": "Regular expression to match handle edge includes", - "default": "(?<=@include\\()(['\"])[^'\"]*\\1" - }, - "adonisjs.autocomplete.viewsCompletionRegex": { - "type": "string", - "description": "Regular expression to match handle edge includes", - "default": "(?<=@include\\()(['\"])[^'\"]*\\1" - }, - "adonisjs.autocomplete.controllersDirectories": { - "type": "array", - "description": "Paths to the directory containing AdonisJS controllers", - "default": [ - "app/controllers" - ] - }, - "adonisjs.autocomplete.controllersExtensions": { - "type": "array", - "description": "Supported file extension for controller completion", - "default": [ - "controller.js", - "controller.ts", - "Controller.js", - "Controller.ts" - ] - }, - "adonisjs.autocomplete.controllersRegex": { - "type": "string", - "description": "Regular expression to match handle route controllers", - "default": "(?<=Route\\.[a-zA-Z]*\\(['\"][^'\"]*['\"]\\s*,\\s*)(['\"])([^'\"]*)\\.?([^'\"]*)\\1" - }, - "adonisjs.autocomplete.controllersNameCompletionRegex": { - "type": "string", - "description": "Regular expression to match handle route controllers", - "default": "(?<=Route\\.[a-zA-Z]*\\(['\"][^'\"]*['\"]\\s*,\\s*)(['\"])([^\\.'\"]*)\\1" - }, - "adonisjs.autocomplete.controllersMethodCompletionRegex": { - "type": "string", - "description": "Regular expression to match handle route controllers", - "default": "(?<=Route\\.[a-zA-Z]*\\(['\"][^'\"]*['\"]\\s*,\\s*)(['\"])([^'\"]*)\\.([^'\"]*)\\1" - }, - "adonisjs.tasks.disableOptionalValuePrompts": { - "type": "boolean", - "description": "Disable showing of prompts for optional fields. All commands will be ran with default values", - "default": false - }, - "adonisjs.tasks.adonisExecutable": { - "type": "string", - "description": "Executable path for Adonis CLI", - "default": "adonis" - }, - "adonisjs.tasks.maxBuffer": { - "type": "integer", - "description": "Buffer size for stdout and stderr", - "default": 204800 - } - } - } - }, - "scripts": { - "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", - "watch": "tsc -watch -p ./", - "pretest": "npm run compile", - "test": "node ./out/test/runTest.js" - }, - "devDependencies": { - "@types/glob": "^7.1.1", - "@types/mocha": "^5.2.6", - "@types/node": "^10.12.21", - "@types/vscode": "^1.39.0", - "mocha": "^6.1.4", - "tslint": "^5.12.1", - "typescript": "^3.3.1", - "vscode-test": "^1.2.0" - }, - "dependencies": { - "@poppinss/module-methods-extractor": "^1.0.0", - "docblock": "^0.4.4", - "glob": "^7.1.5", - "strip-ansi": "^6.0.0", - "vscode-html-languageservice": "^3.0.3", - "vscode-languageclient": "^5.2.1", - "vscode-languageserver-types": "^3.14.0" - } + "name": "adonisjs", + "displayName": "AdonisJS", + "description": "Official extension for AdonisJS framework", + "version": "0.0.1", + "engines": { + "vscode": "^1.39.0" + }, + "categories": [ + "Snippets", + "Programming Languages", + "Formatters", + "Other" + ], + "keywords": [ + "adonis", + "edge", + "template", + "snippet", + "formatter", + "autocompletion", + "commands" + ], + "activationEvents": [ + "onLanguage:edge", + "workspaceContains:**/.adonisrc.json" + ], + "main": "./out/extension.js", + "contributes": { + "languages": [ + { + "id": "edge", + "aliases": [ + "Edge Template", + "Edge", + "edge" + ], + "extensions": [ + ".edge", + ".edge.html" + ], + "configuration": "./src/syntaxes/edge/edge.configuration.jsonc" + } + ], + "grammars": [ + { + "language": "edge", + "scopeName": "text.html.edge", + "path": "./src/syntaxes/edge/edge.tmLanguage.json", + "embeddedLanguages": { + "source.css": "css", + "source.js": "javascript" + } + } + ], + "snippets": [ + { + "language": "javascript", + "path": "./src/snippets/adonis.json" + }, + { + "language": "edge", + "path": "./src/snippets/edge.json" + } + ], + "commands": [ + { + "title": "🚀 Adonis: Key Generate", + "command": "adonisjs.key.generate" + }, + { + "title": "🚀 Adonis: Make Controller", + "command": "adonisjs.make.controller" + }, + { + "title": "🚀 Adonis: Make Model", + "command": "adonisjs.make.model" + }, + { + "title": "🚀 Adonis: Make Trait", + "command": "adonisjs.make.trait" + }, + { + "title": "🚀 Adonis: Make View", + "command": "adonisjs.make.view" + }, + { + "title": "🚀 Adonis: Make Middleware", + "command": "adonisjs.make.middleware" + }, + { + "title": "🚀 Adonis: Make Command", + "command": "adonisjs.make.command" + }, + { + "title": "🚀 Adonis: Make Exception", + "command": "adonisjs.make.exception" + }, + { + "title": "🚀 Adonis: Make Hook", + "command": "adonisjs.make.hook" + }, + { + "title": "🚀 Adonis: Make Migration", + "command": "adonisjs.make.migration" + }, + { + "title": "🚀 Adonis: Make Listener", + "command": "adonisjs.make.listener" + }, + { + "title": "🚀 Adonis: Make Provider", + "command": "adonisjs.make.provider" + }, + { + "title": "🚀 Adonis: Make Exception Handler", + "command": "adonisjs.make.ehandler" + }, + { + "title": "🚀 Adonis: Make Seed", + "command": "adonisjs.make.seed" + }, + { + "title": "🚀 Adonis: Run Instructions", + "command": "adonisjs.run.instructions" + } + ], + "configuration": { + "type": "object", + "title": "AdonisJS", + "properties": { + "adonisjs.autocomplete.quickJump": { + "type": "boolean", + "default": true, + "description": "Quick jump between files using 'Ctrl' + Click" + }, + "adonisjs.autocomplete.folderTip": { + "type": "boolean", + "default": true, + "description": "Display file path name on hover" + }, + "adonisjs.autocomplete.maxLinesCount": { + "type": "integer", + "default": 1200, + "description": "Maximum lines of text to scan for autocompletion" + }, + "adonisjs.autocomplete.viewsDirectories": { + "type": "array", + "description": "Paths to the directory containing edge views", + "default": [ + "resources/views" + ] + }, + "adonisjs.autocomplete.viewsExtensions": { + "type": "array", + "description": "Supported file extension for view completion", + "default": [ + ".edge" + ] + }, + "adonisjs.autocomplete.viewsRegex": { + "type": "string", + "description": "Regular expression to match handle edge includes", + "default": "(?<=@include\\()(['\"])[^'\"]*\\1" + }, + "adonisjs.autocomplete.viewsCompletionRegex": { + "type": "string", + "description": "Regular expression to match handle edge includes", + "default": "(?<=@include\\()(['\"])[^'\"]*\\1" + }, + "adonisjs.autocomplete.controllersDirectories": { + "type": "array", + "description": "Paths to the directory containing AdonisJS controllers", + "default": [ + "app/controllers" + ] + }, + "adonisjs.autocomplete.controllersExtensions": { + "type": "array", + "description": "Supported file extension for controller completion", + "default": [ + "controller.js", + "controller.ts", + "Controller.js", + "Controller.ts" + ] + }, + "adonisjs.autocomplete.controllersRegex": { + "type": "string", + "description": "Regular expression to match handle route controllers", + "default": "(?<=Route\\.[a-zA-Z]*\\(['\"][^'\"]*['\"]\\s*,\\s*)(['\"])([^'\"]*)\\.?([^'\"]*)\\1" + }, + "adonisjs.autocomplete.controllersNameCompletionRegex": { + "type": "string", + "description": "Regular expression to match handle route controllers", + "default": "(?<=Route\\.[a-zA-Z]*\\(['\"][^'\"]*['\"]\\s*,\\s*)(['\"])([^\\.'\"]*)\\1" + }, + "adonisjs.autocomplete.controllersMethodCompletionRegex": { + "type": "string", + "description": "Regular expression to match handle route controllers", + "default": "(?<=Route\\.[a-zA-Z]*\\(['\"][^'\"]*['\"]\\s*,\\s*)(['\"])([^'\"]*)\\.([^'\"]*)\\1" + }, + "adonisjs.tasks.disableOptionalValuePrompts": { + "type": "boolean", + "description": "Disable showing of prompts for optional fields. All commands will be ran with default values", + "default": false + }, + "adonisjs.tasks.adonisExecutable": { + "type": "string", + "description": "Executable path for Adonis CLI", + "default": "adonis" + }, + "adonisjs.tasks.maxBuffer": { + "type": "integer", + "description": "Buffer size for stdout and stderr", + "default": 204800 + } + } + } + }, + "scripts": { + "vscode:prepublish": "npm run compile", + "compile": "tsc -p ./ && node ./out/snippets/combine.js", + "watch": "tsc -watch -p ./", + "pretest": "npm run compile", + "test": "node ./out/test/runTest.js" + }, + "devDependencies": { + "@types/glob": "^7.1.1", + "@types/mocha": "^5.2.6", + "@types/node": "^10.12.21", + "@types/vscode": "^1.39.0", + "mocha": "^6.1.4", + "tslint": "^5.12.1", + "typescript": "^3.3.1", + "vscode-test": "^1.2.0" + }, + "dependencies": { + "@poppinss/module-methods-extractor": "^1.0.0", + "docblock": "^0.4.4", + "glob": "^7.1.5", + "strip-ansi": "^6.0.0", + "vscode-html-languageservice": "^3.0.3", + "vscode-languageserver-types": "^3.14.0" + } } \ No newline at end of file diff --git a/src/snippets/.gitkeep b/src/snippets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/snippets/adonis/ally.json b/src/snippets/adonis/ally.json new file mode 100644 index 0000000..3a13b35 --- /dev/null +++ b/src/snippets/adonis/ally.json @@ -0,0 +1,88 @@ +{ + "ally": { + "body": "ally.driver('${1:facebook}').${2|getUser,redirect,getRedirectUrl|}();", + "description": "Adonis Ally", + "prefix": "ally" + }, + "ally: redirect": { + "body": "ally.driver('${1:facebook}').redirect();", + "description": "Adonis Ally: Redirect user to the 3rd party website", + "prefix": "ally-redirect" + }, + "ally: get redirect url": { + "body": "ally.driver('${1:facebook}').getRedirectUrl();", + "description": "Adonis Ally: Get redirect URL back as a string", + "prefix": "ally-get-redirect-url" + }, + "ally: with scope": { + "body": "ally.driver('${1:facebook}').scope(['$2',$3]).${4|getUser,redirect,getRedirectUrl|}();", + "description": "Adonis Ally: Define runtime scopes before redirecting the user", + "prefix": "ally-scope" + }, + "ally: with fields": { + "body": "ally.driver('${1:facebook}').fields(['$2',$3]).${4|getUser,redirect,getRedirectUrl|}();", + "description": "Adonis Ally: Fields to be fetched when getting the authenticated user profile", + "prefix": "ally-fields" + }, + "ally: get user": { + "body": "ally.driver('${1:facebook}').fields(['$2',$3]).getUser();", + "description": "Adonis Ally: Get the user profile of an authenticated user (returns an AllyUser instance)", + "prefix": "ally-get-user" + }, + "ally: by access token": { + "body": "ally.getUserByToken($1);", + "description": "Adonis Ally: Get the user details using the accessToken", + "prefix": "ally-by-token" + }, + // Ally user API + "ally: user": { + "body": "${1:user}.${2|getName,getEmail,getNickname,getAvatar,getAccessToken,getRefreshToken,getExpires,getTokenSecret,getOriginal|}();", + "description": "Adonis Ally User", + "prefix": "ally-user" + }, + "ally: get name for user": { + "body": "${1:user}.getName()", + "description": "Adonis Ally User: Get the user name", + "prefix": "ally-user-name" + }, + "ally: get email for user": { + "body": "${1:user}.getEmail()", + "description": "Adonis Ally User: Get the user email", + "prefix": "ally-user-email" + }, + "ally: get nickname for user": { + "body": "${1:user}.getNickname()", + "description": "Adonis Ally User: Get the nickname / display name of the user", + "prefix": "ally-user-nickname" + }, + "ally: get avatar for user": { + "body": "${1:user}.getAvatar()", + "description": "Adonis Ally User: Get the public URL to the user’s profile picture", + "prefix": "ally-user-avatar" + }, + "ally: get access token for user": { + "body": "${1:user}.getAccessToken()", + "description": "Adonis Ally User: Get the access token which may be used later to update the user profile", + "prefix": "ally-user-token" + }, + "ally: get refresh token for user": { + "body": "${1:user}.getRefreshToken()", + "description": "Adonis Ally User: Get token to be used when access token expires", + "prefix": "ally-user-rtoken" + }, + "ally: get expires for user": { + "body": "${1:user}.getExpires()", + "description": "Adonis Ally User: Access token expiry data", + "prefix": "ally-user-expires" + }, + "ally: get token secret for user": { + "body": "${1:user}.getTokenSecret()", + "description": "Adonis Ally User: ", + "prefix": "ally-user-stoken" + }, + "ally: get original 3rd party payload for user": { + "body": "${1:user}.getOriginal()", + "description": "Adonis Ally User: Get original payload returned by the 3rd party provider", + "prefix": "ally-user-original" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/antl.json b/src/snippets/adonis/antl.json new file mode 100644 index 0000000..ef8f154 --- /dev/null +++ b/src/snippets/adonis/antl.json @@ -0,0 +1,72 @@ +{ + "Antl": { + "body": "${1:Antl}.${2|currentLocale,defaultLocale,formatMessage,formatNumber,formatAmount,formatDate,formatRelative,forLocale,bootLoader,loader,switchLocale|}($3)", + "description": "Adonis Antl", + "prefix": "antl" + }, + "antl: current locale": { + "body": "${1:Antl}.currentLocale()", + "description": "Adonis Antl: Get the current locale of antl", + "prefix": "antl-locale-current" + }, + "antl: default locale": { + "body": "${1:Antl}.defaultLocale()", + "description": "Adonis Antl: Get the default locale of antl", + "prefix": "antl-locale" + }, + "antl: format message": { + "body": "${1:Antl}.formatMessage(${2:key}, ${3:data}, ${4:format})", + "description": "Adonis Antl: format a message usign the default locale", + "prefix": "antl-fmessage" + }, + "antl: format number": { + "body": "${1:Antl}.formatNumber(${2:value}, ${3:options = {\\}})", + "description": "Adonis Antl: Format value as a number (accepts NumberFormat options as defined [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat))", + "prefix": "antl-fnumber" + }, + "antl: format amount": { + "body": "${1:Antl}.formatAmount(${2:value}, ${3:currency}, ${4:options = {\\}})", + "description": "Adonis Antl: Format value with style set to currency", + "prefix": "antl-famount" + }, + "antl: format date": { + "body": "${1:Antl}.formatDate(${2:value}, ${3:options = {\\}})", + "description": "Adonis Antl: Format value as date (accepts DateTimeFormat options as defined [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat))", + "prefix": "antl-fdate" + }, + "antl: format relative": { + "body": "${1:Antl}.formatRelative(${2:value}, ${3:options = {\\}})", + "description": "Adonis Antl: Format a date relative to the current date/time (accepts RelativeFormat options as defined [here](https://github.com/yahoo/intl-relativeformat#custom-options))", + "prefix": "antl-frelative" + }, + "antl: for locale": { + "body": "${1:Antl}.forLocale('${2:fr}')", + "description": "Adonis Antl: Switch locale format at runtime", + "prefix": "antl-for-locale" + }, + "antl: boot loader": { + "body": "await ${1:Antl}.bootLoader()", + "description": "Adonis Antl: Initialize the bootlader", + "prefix": "antl-boot-loader" + }, + "antl: loader": { + "body": "${1:Antl}.loader(${2:loader})", + "description": "Adonis Antl: Switch between loaders at runtime. Always call `await Antl.bootLoader()` before Antl.loader (you only need to call bootLoader once)", + "prefix": "antl-loader" + }, + "antl: switch locale for view": { + "body": "${1:antl}.switchLocale(${2:key}, ${3:data}, ${4:format})", + "description": "Adonis Antl: Switch locale for view", + "prefix": "antl-switch-locale" + }, + "antl: add format": { + "body": [ + "${1:Format}.add(${2:key}, {", + " style: '$3'", + " ${4:currency}: '$5'}", + "\\})$0" + ], + "description": "Adonis Antl: Add a new localisation format", + "prefix": "antl-format-add" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/assert.json b/src/snippets/adonis/assert.json new file mode 100644 index 0000000..61e47b2 --- /dev/null +++ b/src/snippets/adonis/assert.json @@ -0,0 +1,412 @@ +{ + "assert: fail": { + "body": "${1:assert}.fail(${2:actual}, ${3:expected}, ${4:[message]}, ${5:[operator]})", + "description": "Adonis Assert: Throw a failure. Node.js assert module-compatible.", + "prefix": "assert-fail" + }, + "assert: is ok": { + "body": "${1:assert}.isOk(${2:object}, ${3:[message]})", + "description": "Adonis Assert: Asserts that object is truthy.", + "prefix": "assert-ok" + }, + "assert: is not ok": { + "body": "${1:assert}.isNotOk(${2:object}, ${3:[message]})", + "description": "Adonis Assert: Asserts that object is falsy.", + "prefix": "assert-not-ok" + }, + "assert: equal": { + "body": "${1:assert}.equal(${2:actual}, ${3:expected}, ${4:[message]})", + "description": "Adonis Assert: Asserts non-strict equality (==) of actual and expected.", + "prefix": "assert-equal" + }, + "assert: not equal": { + "body": "${1:assert}.notEqual(${2:actual}, ${3:expected}, ${4:[message]})", + "description": "Adonis Assert: Asserts non-strict inequality (!=) of actual and expected.", + "prefix": "assert-not-equal" + }, + "assert: strict equal": { + "body": "${1:assert}.strictEqual(${2:actual}, ${3:expected}, ${4:[message]})", + "description": "Adonis Assert: Asserts strict equality (===) of actual and expected.", + "prefix": "assert-strict-equal" + }, + "assert: not strict equal": { + "body": "${1:assert}.notStrictEqual(${2:actual}, ${3:expected}, ${4:[message]})", + "description": "Adonis Assert: Asserts strict inequality (!==) of actual and expected.", + "prefix": "assert-not-strict-equal" + }, + "assert: deep equal": { + "body": "${1:assert}.deepEqual(${2:actual}, ${3:expected}, ${4:[message]})", + "description": "Adonis Assert: Asserts that actual is deeply equal to expected.", + "prefix": "assert-deep-equal" + }, + "assert: not deep equal": { + "body": "${1:assert}.notDeepEqual(${2:actual}, ${3:expected}, ${4:[message]})", + "description": "Adonis Assert: Asserts that actual is deeply equal to expected.", + "prefix": "assert-not-deep-equal" + }, + "assert: is above": { + "body": "${1:assert}.isAbove(${2:valueToCheck}, ${3:valueToBeAbove}, ${4:[message]})", + "description": "Adonis Assert: Asserts valueToCheck is strictly greater than (>) valueToBeAbove.", + "prefix": "assert-above" + }, + "assert: is at least": { + "body": "${1:assert}.isAtLeast(${2:valueToCheck}, ${3:valueToBeAtLeast}, ${4:[message]})", + "description": "Adonis Assert: Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast.", + "prefix": "assert-at-Least" + }, + "assert: is below": { + "body": "${1:assert}.isBelow(${2:valueToCheck}, ${3:valueToBeBelow}, ${4:[message]})", + "description": "Adonis Assert: Asserts valueToCheck is strictly less than (<) valueToBeBelow.", + "prefix": "assert-below" + }, + "assert: is at most": { + "body": "${1:assert}.isAtMost(${2:valueToCheck}, ${3:valueToBeAtMost}, ${4:[message]})", + "description": "Adonis Assert: Asserts valueToCheck is less than or equal to (<=) valueToBeAtMost.", + "prefix": "assert-at-most" + }, + "assert: is true": { + "body": "${1:assert}.isTrue(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is true.", + "prefix": "assert-true" + }, + "assert: is not true": { + "body": "${1:assert}.isNotTrue(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is not true.", + "prefix": "assert-not-true" + }, + "assert: is false": { + "body": "${1:assert}.isFalse(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is false.", + "prefix": "assert-false" + }, + "assert: is not false": { + "body": "${1:assert}.isNotFalse(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is not false.", + "prefix": "assert-not-false" + }, + "assert: is null": { + "body": "${1:assert}.isNull(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is null.", + "prefix": "assert-null" + }, + "assert: is not null": { + "body": "${1:assert}.isNotNull(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is not null.", + "prefix": "assert-not-null" + }, + "assert: is NaN": { + "body": "${1:assert}.isNaN(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is NaN.", + "prefix": "assert-nan" + }, + "assert: is not NaN": { + "body": "${1:assert}.isNotNaN(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is not NaN.", + "prefix": "assert-not-nan" + }, + "assert: exists": { + "body": "${1:assert}.exists(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that the target is neither null nor undefined.", + "prefix": "assert-exists" + }, + "assert: not exists": { + "body": "${1:assert}.notExists(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that the target is either null or undefined.", + "prefix": "assert-not-exists" + }, + "assert: is undefined": { + "body": "${1:assert}.isUndefined(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is undefined.", + "prefix": "assert-undefined" + }, + "assert: is defined": { + "body": "${1:assert}.isDefined(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is not undefined.", + "prefix": "assert-defined" + }, + "assert: is function": { + "body": "${1:assert}.isFunction(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is a function.", + "prefix": "assert-function" + }, + "assert: is not function": { + "body": "${1:assert}.isNotFunction(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is not a function.", + "prefix": "assert-not-function" + }, + "assert: is object": { + "body": "${1:assert}.isObject(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is an object of type ‘Object’ (as revealed by Object.prototype.toString). The assertion does not match subclassed objects.", + "prefix": "assert-object" + }, + "assert: is not object": { + "body": "${1:assert}.isNotObject(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is not an object of type ‘Object’ (as revealed by Object.prototype.toString).", + "prefix": "assert-not-object" + }, + "assert: is array": { + "body": "${1:assert}.isArray(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is an array.", + "prefix": "assert-array" + }, + "assert: is not array": { + "body": "${1:assert}.isNotArray(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is not an array.", + "prefix": "assert-not-array" + }, + "assert: is string": { + "body": "${1:assert}.isString(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is a string.", + "prefix": "assert-string" + }, + "assert: is not string": { + "body": "${1:assert}.isNotString(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is not a string.", + "prefix": "assert-not-string" + }, + "assert: is number": { + "body": "${1:assert}.isNumber(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is a number.", + "prefix": "assert-number" + }, + "assert: is not number": { + "body": "${1:assert}.isNotNumber(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is not a number.", + "prefix": "assert-not-number" + }, + "assert: is finite": { + "body": "${1:assert}.isFinite(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is a finite number. Unlike .isNumber, this will fail for NaN and Infinity.", + "prefix": "assert-finite" + }, + "assert: is boolean": { + "body": "${1:assert}.isBoolean(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is a boolean.", + "prefix": "assert-boolean" + }, + "assert: is not boolean": { + "body": "${1:assert}.isNotBoolean(${2:value}, ${3:[message]})", + "description": "Adonis Assert: Asserts that value is not a boolean.", + "prefix": "assert-not-boolean" + }, + "assert: type of": { + "body": "${1:assert}.typeOf(${2:value}, ${3:name}, ${4:[message]})", + "description": "Adonis Assert: Asserts that value’s type is name, as determined by Object.prototype.toString.", + "prefix": "assert-typeof" + }, + "assert: not type of": { + "body": "${1:assert}.notTypeOf(${2:value}, ${3:name}, ${4:[message]})", + "description": "Adonis Assert: Asserts that value’s type is not name, as determined by Object.prototype.toString.", + "prefix": "assert-not-typeof" + }, + "assert: instance of": { + "body": "${1:assert}.instanceOf(${2:object}, ${3:constructor}, ${4:[message]})", + "description": "Adonis Assert: Asserts that value is an instance of constructor.", + "prefix": "assert-instanceof" + }, + "assert: not instance of": { + "body": "${1:assert}.notInstanceOf(${2:object}, ${3:constructor}, ${4:[message]})", + "description": "Adonis Assert: Asserts value is not an instance of constructor.", + "prefix": "assert-not-instanceof" + }, + "assert: include": { + "body": "${1:assert}.include(${2:haystack}, ${3:needle}, ${4:[message]})", + "description": "Adonis Assert: Asserts that haystack includes needle. Can be used to assert the inclusion of a value in an array, a substring in a string, or a subset of properties in an object.", + "prefix": "assert-include" + }, + "assert: not include": { + "body": "${1:assert}.notInclude(${2:haystack}, ${3:needle}, ${4:[message]})", + "description": "Adonis Assert: Asserts that haystack does not include needle. Can be used to assert the absence of a value in an array, a substring in a string, or a subset of properties in an object.", + "prefix": "assert-not-include" + }, + "assert: deep include": { + "body": "${1:assert}.deepInclude(${2:haystack}, ${3:needle}, ${4:[message]})", + "description": "Adonis Assert: Asserts that haystack includes needle. Can be used to assert the inclusion of a value in an array or a subset of properties in an object. Deep equality is used.", + "prefix": "assert-deep-include" + }, + "assert: not deep include": { + "body": "${1:assert}.notDeepInclude(${2:haystack}, ${3:needle}, ${4:[message]})", + "description": "Adonis Assert: Asserts that haystack does not include needle. Can be used to assert the absence of a value in an array or a subset of properties in an object. Deep equality is used.", + "prefix": "assert-not-deep-include" + }, + "assert: nested include": { + "body": "${1:assert}.nestedInclude(${2:haystack}, ${3:needle}, ${4:[message]})", + "description": "Adonis Assert: Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object. Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.", + "prefix": "assert-nested-include" + }, + "assert: not nested include": { + "body": "${1:assert}.notNestedInclude(${2:haystack}, ${3:needle}, ${4:[message]})", + "description": "Adonis Assert: Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object. Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.", + "prefix": "assert-not-nested-include" + }, + "assert: deep nested include": { + "body": "${1:assert}.deepNestedInclude(${2:haystack}, ${3:needle}, ${4:[message]})", + "description": "Adonis Assert: Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while checking for deep equality. Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.", + "prefix": "assert-deep-nested-include" + }, + "assert: not deep nested include": { + "body": "${1:assert}.notDeepNestedInclude(${2:haystack}, ${3:needle}, ${4:[message]})", + "description": "Adonis Assert: Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object while checking for deep equality. Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.", + "prefix": "assert-not-deep-nested-include" + }, + "assert: own include": { + "body": "${1:assert}.ownInclude(${2:haystack}, ${3:needle}, ${4:[message]})", + "description": "Adonis Assert: Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties.", + "prefix": "assert-own-include" + }, + "assert: not own include": { + "body": "${1:assert}.notOwnInclude(${2:haystack}, ${3:needle}, ${4:[message]})", + "description": "Adonis Assert: Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties.", + "prefix": "assert-not-own-include" + }, + "assert: deep own include": { + "body": "${1:assert}.deepOwnInclude(${2:haystack}, ${3:needle}, ${4:[message]})", + "description": "Adonis Assert: Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties and checking for deep equality.", + "prefix": "assert-deep-own-include" + }, + "assert: not deep own include": { + "body": "${1:assert}.notDeepOwnInclude(${2:haystack}, ${3:needle}, ${4:[message]})", + "description": "Adonis Assert: Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties and checking for deep equality.", + "prefix": "assert-not-deep-own-include" + }, + "assert: match": { + "body": "${1:assert}.match(${2:value}, ${3:regexp}, ${4:[message]})", + "description": "Adonis Assert: Asserts that value matches the regular expression regexp.", + "prefix": "assert-match" + }, + "assert: not match": { + "body": "${1:assert}.notMatch(${2:value}, ${3:regexp}, ${4:[message]})", + "description": "Adonis Assert: Asserts that value does not match the regular expression regexp.", + "prefix": "assert-not-match" + }, + "assert: property": { + "body": "${1:assert}.property(${2:object}, ${3:property}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object has a direct or inherited property named by property.", + "prefix": "assert-property" + }, + "assert: not property": { + "body": "${1:assert}.notProperty(${2:object}, ${3:property}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object does not have a direct or inherited property named by property.", + "prefix": "assert-not-property" + }, + "assert: property val": { + "body": "${1:assert}.propertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})", + "description": "Adonis Assert: Asserts that object has a direct or inherited property named by property with a value given by value. Uses a strict equality check (===).", + "prefix": "assert-property-val" + }, + "assert: not property val": { + "body": "${1:assert}.notPropertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})", + "description": "Adonis Assert: Asserts that object does not have a direct or inherited property named by property with value given by value. Uses a strict equality check (===).", + "prefix": "assert-not-property-val" + }, + "assert: deep property val": { + "body": "${1:assert}.deepPropertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})", + "description": "Adonis Assert: Asserts that object has a direct or inherited property named by property with a value given by value. Uses a deep equality check.", + "prefix": "assert-deep-property-val" + }, + "assert: not deep property val": { + "body": "${1:assert}.notDeepPropertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})", + "description": "Adonis Assert: Asserts that object does not have a direct or inherited property named by property with value given by value. Uses a deep equality check.", + "prefix": "assert-not-deepPropertyVal" + }, + "assert: nested property": { + "body": "${1:assert}.nestedProperty(${2:object}, ${3:property}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object has a direct or inherited property named by property, which can be a string using dot- and bracket-notation for nested reference.", + "prefix": "assert-nested-property" + }, + "assert: not nested property": { + "body": "${1:assert}.notNestedProperty(${2:object}, ${3:property}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object does not have a property named by property, which can be a string using dot- and bracket-notation for nested reference. The property cannot exist on the object nor anywhere in its prototype chain.", + "prefix": "assert-not-nested-property" + }, + "assert: nested property val": { + "body": "${1:assert}.nestedPropertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})", + "description": "Adonis Assert: Asserts that object has a property named by property with value given by value. property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).", + "prefix": "assert-nested-property-val" + }, + "assert: not nested property val": { + "body": "${1:assert}.notNestedPropertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})", + "description": "Adonis Assert: Asserts that object does not have a property named by property with value given by value. property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).", + "prefix": "assert-not-nested-property-val" + }, + "assert: deep nested property val": { + "body": "${1:assert}.deepNestedPropertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})", + "description": "Adonis Assert: Asserts that object has a property named by property with a value given by value. property can use dot- and bracket-notation for nested reference. Uses a deep equality check.", + "prefix": "assert-deep-nested-property-val" + }, + "assert: not deep nested property val": { + "body": "${1:assert}.notDeepNestedPropertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})", + "description": "Adonis Assert: Asserts that object does not have a property named by property with value given by value. property can use dot- and bracket-notation for nested reference. Uses a deep equality check.", + "prefix": "assert-not-deep-nested-property-val" + }, + "assert: length of": { + "body": "${1:assert}.lengthOf(${2:object}, ${3:length}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object has a length or size with the expected value.", + "prefix": "assert-length-of" + }, + "assert: has any keys": { + "body": "${1:assert}.hasAnyKeys(${2:object}, ${3:keys}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object has at least one of the keys provided. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.", + "prefix": "assert-has-any-keys" + }, + "assert: has all keys": { + "body": "${1:assert}.hasAllKeys(${2:object}, ${3:keys}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object has all and only all of the keys provided. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.", + "prefix": "assert-has-all-keys" + }, + "assert: contains all keys": { + "body": "${1:assert}.containsAllKeys(${2:object}, ${3:keys}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object has all of the keys provided but may have more keys not listed. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.", + "prefix": "assert-contains-all-keys" + }, + "assert: does not have any keys": { + "body": "${1:assert}.doesNotHaveAnyKeys(${2:object}, ${3:keys}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object has none of the keys provided. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.", + "prefix": "assert-does-not-have-any-keys" + }, + "assert: does not have all keys": { + "body": "${1:assert}.doesNotHaveAllKeys(${2:object}, ${3:keys}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object does not have at least one of the keys provided. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.", + "prefix": "assert-does-not-have-all-keys" + }, + "assert: has any deep keys": { + "body": "${1:assert}.hasAnyDeepKeys(${2:object}, ${3:keys}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object has at least one of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.", + "prefix": "assert-hasAnyDeepKeys" + }, + "assert: has all deep keys": { + "body": "${1:assert}.hasAllDeepKeys(${2:object}, ${3:keys}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object has all and only all of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.", + "prefix": "assert-hasAllDeepKeys" + }, + "assert: contains all deep keys": { + "body": "${1:assert}.containsAllDeepKeys(${2:object}, ${3:keys}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object contains all of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.", + "prefix": "assert-containsAllDeepKeys" + }, + "assert: does not have any deep keys": { + "body": "${1:assert}.doesNotHaveAnyDeepKeys(${2:object}, ${3:keys}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object has none of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.", + "prefix": "assert-does-not-have-any-deep-keys" + }, + "assert: does not have all deep keys": { + "body": "${1:assert}.doesNotHaveAllDeepKeys(${2:object}, ${3:keys}, ${4:[message]})", + "description": "Adonis Assert: Asserts that object does not have at least one of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.", + "prefix": "assert-does-not-have-all-deep-keys" + }, + "assert: throws": { + "body": "${1:assert}.throws(${2:fn}, ${3:errorLike/string/regexp}, ${4:string/regexp}, ${5:[message]})", + "description": "Adonis Assert: If errorLike is an Error constructor, asserts that fn will throw an error that is an instance of errorLike. If errorLike is an Error instance, asserts that the error thrown is the same instance as errorLike. If errMsgMatcher is provided, it also asserts that the error thrown will have a message matching errMsgMatcher.", + "prefix": "assert-throws" + }, + "assert: does not throw": { + "body": "${1:assert}.doesNotThrow(${2:fn}, ${3:errorLike/string/regexp}, ${4:string/regexp}, ${5:[message]})", + "description": "Adonis Assert: If errorLike is an Error constructor, asserts that fn will not throw an error that is an instance of errorLike. If errorLike is an Error instance, asserts that the error thrown is not the same instance as errorLike. If errMsgMatcher is provided, it also asserts that the error thrown will not have a message matching errMsgMatcher.", + "prefix": "assert-does-not-throw" + }, + "assert: operator": { + "body": "${1:assert}.operator(${2:val1}, ${3:operator}, ${4:val2}, ${5:[message]})", + "description": "Compares two values using operator.", + "prefix": "assert-operator" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/auth.json b/src/snippets/adonis/auth.json new file mode 100644 index 0000000..9c124b3 --- /dev/null +++ b/src/snippets/adonis/auth.json @@ -0,0 +1,84 @@ +{ + "auth:": { + "body": "${1:auth}.${2|attempt,login,loginViaId,remember,check,getUser,logout,generate,withRefreshToken,generateForRefreshToken,newRefreshToken,listTokens,authenticator,revokeTokens,revokeTokensForUser|}($3)", + "description": "Adonis Authentication", + "prefix": "auth" + }, + // Session methods + "auth: attempt login via session": { + "body": "${1:auth}.attempt(${2:uid}, ${3:password})", + "description": "Adonis Auth: Login via uid and password, throwing an exception if no user is found or the password is invalid:", + "prefix": "auth-attempt" + }, + "auth: attempt to login": { + "body": "${1:auth}.login(${2:user})", + "description": "Adonis Auth: Login via user model instance, not verify anything but simply marking the user as logged in", + "prefix": "auth-login" + }, + "auth: login a user via id": { + "body": "${1:auth}.loginViaId(${2:id})", + "description": "Adonis Auth: Login a via user id, querying the database to ensure the user exists", + "prefix": "auth-via-id" + }, + "auth: remember user session": { + "body": "${1:auth}.remember(${2:true}).$5attempt(${3:email}, ${4:password})", + "description": "Adonis Auth: When calling methods like attempt, login or loginViaId, chain the remember method to ensure users stay logged in after closing their browser", + "prefix": "auth-remember" + }, + "auth: check if logged in": { + "body": "${1:auth}.check()", + "description": "Adonis Auth: Check if a user is already logged in by reading their session", + "prefix": "auth-check" + }, + "auth: get logged in user": { + "body": "${1:auth}.getUser()", + "description": "Adonis Auth: Get the logged in user instance (via the check method)", + "prefix": "auth-get-user" + }, + "auth: logout user": { + "body": "${1:auth}.logout()", + "description": "Adonis Auth: Log out the currently logged in user", + "prefix": "auth-logout" + }, + // JWT methods + "auth: generate jwt token": { + "body": "${1:auth}.generate(${2:user}, ${3:jwtPayload}, ${4:jwtOptions})", + "description": "Adonis Auth: Generate JWT token for a given user", + "prefix": "auth-generate" + }, + "auth: authenticate and generate refresh token": { + "body": "${1:auth}.withRefreshToken().$4attempt(${2:uid}, ${3:password})", + "description": "Adonis Auth: Instruct the JWT authenticator to generate a refresh token as well", + "prefix": "auth-with-rtoken" + }, + "auth: generate token from refresh token": { + "body": "${1:auth}.generateForRefreshToken(${2:refreshToken}, ${3:jwtPayload})", + "description": "Adonis Auth: Generate a new JWT token using the refresh token. Passing jwtPayload=true encodes the user object within the token.", + "prefix": "auth-generate-from-rtoken" + }, + "auth: forcefully generate new token": { + "body": "${1:auth}.newRefreshToken().$4generateForRefreshToken(${2:refreshToken}, ${3:jwtPayload})", + "description": "Adonis Auth: When generating a new jwt token, the auth provider does not reissue a new refresh token and instead uses the old one. If you want, you can also regenerate a new refresh token:", + "prefix": "auth-new-rtoken" + }, + "auth: get all refresh token for auth user": { + "body": "${1:auth}.listTokens()", + "description": "Adonis Auth: List all tokens for the user (either JWT or API)", + "prefix": "auth-list-tokens" + }, + "auth: authenticator": { + "body": "${1:auth}.authenticator(${2:authenticator})", + "description": "Adonis Auth: authenticator", + "prefix": "auth-authenticator" + }, + "auth: revoke API tokens for auth user": { + "body": "${1:auth}.revokeTokens(${2:tokens = []}, ${3:delete = false})", + "description": "Adonis Auth: Revoke all authenticated user API tokens by setting a flag in the tokens table", + "prefix": "auth-revoke-tokens" + }, + "auth: revoke API tokens for specified user": { + "body": "${1:auth}.revokeTokensForUser(${2:user}, ${3:tokens}, ${4:delete = false})", + "description": "Adonis Auth: Revoke all specified user API tokens.", + "prefix": "auth-revoke-user-tokens" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/database.json b/src/snippets/adonis/database.json new file mode 100644 index 0000000..4b91a1b --- /dev/null +++ b/src/snippets/adonis/database.json @@ -0,0 +1,490 @@ +{ + "database:": { + "body": "${1:Database}.${2|table,connection,close,withOutPrefix,on|}($3)", + "description": "Adonis Database", + "prefix": "db" + }, + "database: get table": { + "body": "${4:await }${1:Database}.table('${2:name}')$3", + "description": "Adonis Database: Select a database table.", + "prefix": "db-table" + }, + "database: set connection": { + "body": "${1:Database}.connection('${2:mysql}').${3:table}($4)", + "description": "Adonis Database: Set the db connection to use for query.", + "prefix": "db-conn" + }, + "database: close specified connection": { + "body": "${1:Database}.close(['${2:mysql}', $3])", + "description": "Adonis Database: Close the specified db connection.", + "prefix": "db-close" + }, + "database: without prefix": { + "body": "${1:Database}.withOutPrefix()", + "description": "Adonis Database: without prefix", + "prefix": "db-without-prefix" + }, + "database: on": { + "body": "${1:Database}.on('${2:query}', ${3:(param) => {\\}})", + "description": "Adonis Database: on", + "prefix": "db-on" + }, + "database: select": { + "body": "${5:await }${1:Database}.table('${2:name}').select($3)$4", + "description": "Adonis Database: Defines the fields to be selected for a given query", + "prefix": "db-select" + }, + // Where conditions + "database: where": { + "body": "${5:await }${1:Database}.table('${2:name}').where($3)$4", + "description": "Adonis Database: sql where", + "prefix": "db-where" + }, + "database: or Where": { + "body": "${6:await }${1:Database}.table('${2:name}').where($3).orWhere($4)$5", + "description": "Adonis Database: sql where or where", + "prefix": "db-or-where" + }, + "database: where not": { + "body": "${5:await }${1:Database}.table('${2:name}').whereNot($3)$4", + "description": "Adonis Database: sql where not", + "prefix": "db-where-not" + }, + "database: where in": { + "body": "${6:await }${1:Database}.table('${2:name}').whereIn($3, ${4:ids = []})$5", + "description": "Adonis Database: sql where in", + "prefix": "db-where-in" + }, + "database: where not in": { + "body": "${6:await }${1:Database}.table('${2:name}').whereNotIn($3, ${4:ids = []})$5", + "description": "Adonis Database: sql where not in", + "prefix": "db-where-not-in" + }, + "database: where null": { + "body": "${5:await }${1:Database}.table('${2:name}').whereNull($3)$4", + "description": "Adonis Database: sql where null", + "prefix": "db-where-null" + }, + "database: where not null": { + "body": "${5:await }${1:Database}.table('${2:name}').whereNotNull($3)$4", + "description": "Adonis Database: sql where not null", + "prefix": "db-where-not-null" + }, + "database: where exists": { + "body": [ + "${6:await }${1:Database}.table('${2:name}').whereExists(function () {", + " this.from('$3').where($4)$5", + "\\})" + ], + "description": "Adonis Database: sql where exists", + "prefix": "db-where-exists" + }, + "database: where not exists": { + "body": [ + "${6:await }${1:Database}.table('${2:name}').whereNotExists(function () {", + " this.from('$3').where($4)$5", + "\\})" + ], + "description": "Adonis Database: sql where not exists", + "prefix": "db-where-not-exists" + }, + "database: where between": { + "body": "${5:await }${1:Database}.table('${2:name}').whereBetween($3)$4", + "description": "Adonis Database: sql where between", + "prefix": "db-where-between" + }, + "database: where not between": { + "body": "${5:await }${1:Database}.table('${2:name}').whereNotBetween($3)$4", + "description": "Adonis Database: sql where not between", + "prefix": "db-where-not-between" + }, + "database: where raw": { + "body": "${5:await }${1:Database}.table('${2:name}').whereRaw($3)$4", + "description": "Adonis Database: sql where raw", + "prefix": "db-where-raw" + }, + // Join conditions + "database: inner join": { + "body": "${7:await }${1:Database}.table('${2:name}').innerJoin($3, $4, $5)$6", + "description": "Adonis Database: sql inner join", + "prefix": "db-inner-join" + }, + "database: left join": { + "body": "${8:await }${1:Database}.select(${2:fields}).from('${3:table}').leftJoin($4, $5, $6)$7", + "description": "Adonis Database: sql left join", + "prefix": "db-left-join" + }, + "database: left outer join": { + "body": "${8:await }${1:Database}.select(${2:fields}).from('${3:table}').leftOuterJoin($4, $5, $6)$7", + "description": "Adonis Database: sql left outer join", + "prefix": "db-left-outer-join" + }, + "database: right join": { + "body": "${8:await }${1:Database}.select(${2:fields}).from('${3:table}').rightJoin($4, $5, $6)$7", + "description": "Adonis Database: sql right join", + "prefix": "db-right-join" + }, + "database: right outer join": { + "body": "${8:await }${1:Database}.select(${2:fields}).from('${3:table}').rightOuterJoin($4, $5, $6)$7", + "description": "Adonis Database: sql right outer join", + "prefix": "db-right-outer-join" + }, + "database: outer join": { + "body": "${8:await }${1:Database}.select(${2:fields}).from('${3:table}').outerJoin($4, $5, $6)$7", + "description": "Adonis Database: sql right outer join", + "prefix": "db-right-outer-join" + }, + "database: full outer join": { + "body": "${8:await }${1:Database}.select(${2:fields}).from('${3:table}').fullOuterJoin($4, $5, $6)$7", + "description": "Adonis Database: sql full outer join", + "prefix": "db-full-outer-join" + }, + "database: cross join": { + "body": "${8:await }${1:Database}.select(${2:fields}).from('${3:table}').crossJoin($4, $5, $6)$7", + "description": "Adonis Database: sql cross join", + "prefix": "db-cross-join" + }, + "database: join raw": { + "body": "${6:await }${1:Database}.select(${2:fields}).from('${3:table}').joinRaw($4)$5", + "description": "Adonis Database: sql right outer join", + "prefix": "db-join-raw" + }, + // Ordering and limits + "database: distinct": { + "body": "${5:await }${1:Database}.table('${2:name}').distinct($3)$4", + "description": "Adonis Database: sql distinct", + "prefix": "db-distinct" + }, + "database: group by": { + "body": "${5:await }${1:Database}.table('${2:name}').groupBy($3)$4", + "description": "Adonis Database: sql group by", + "prefix": "db-group-by" + }, + "database: group by raw": { + "body": "${6:await }${1:Database}.table('${2:name}').groupByRaw($3, $4)$5", + "description": "Adonis Database: sql group by raw", + "prefix": "db-group-by-raw" + }, + "database: order by": { + "body": "${6:await }${1:Database}.table('${2:name}').orderBy(${3:column}, '${4:|asc,desc|}')$5", + "description": "Adonis Database: sql order by", + "prefix": "db-order-by" + }, + "database: order by raw": { + "body": "${5:await }${1:Database}.table('${2:name}').orderByRaw(${3:raw})$4", + "description": "Adonis Database: sql order by raw", + "prefix": "db-order-by-raw" + }, + "database: having": { + "body": [ + "${8:await }${1:Database}", + " .table('${2:name}')", + " .groupBy(${3:column})", + " .having(${4:column}, ${5:operator}, ${6:value})$7" + ], + "description": "Adonis Database: sql having (N.B. `groupBy()` must be called before `having()` ).", + "prefix": "db-having" + }, + "database: offset and limit": { + "body": [ + "await ${1:Database}", + " .table('${2:name}')", + " .offset(${3:number})", + " .limit(${4:number})$5" + ], + "description": "Adonis Database: sql offset and limit.", + "prefix": "db-offset-and-limit" + }, + // Inserts + "database: insert": { + "body": [ + "await ${1:Database}", + " .table('${2:name}')", + " .insert(${3:values})$4" + ], + "description": "Adonis Database: Create a row and return its newly created `id`.", + "prefix": "db-insert" + }, + "database: insert into": { + "body": [ + "await ${1:Database}", + " .insert(${2:values})", + " .into('${3:table}')$4" + ], + "description": "Adonis Database: Create a row and return its newly created `id`.", + "prefix": "db-insert-into" + }, + "database: PostreSQL - insert into and return column value": { + "body": [ + "await ${1:Database}", + " .insert(${2:values})", + " .into('${3:table}')", + " .returning('${4:column}')$5" + ], + "description": "Adonis Database: PostgreSQL - sql insert into and return column value.", + "prefix": "db-insert-into-return" + }, + // Updates + "database: update where": { + "body": [ + "await ${1:Database}", + " .table(${2:name})", + " .where(${3:query})", + " .update(${4:data})$5" + ], + "description": "Adonis Database: sql update where.", + "prefix": "db-update" + }, + // Deletes + "database: delete where": { + "body": [ + "await ${1:Database}", + " .table(${2:name})", + " .where(${3:query})", + " .delete()" + ], + "description": "Adonis Database: Delete operations also return the number of affected rows.", + "prefix": "db-delete" + }, + "database: truncate": { + "body": "await ${1:Database}.truncate(${2:table})", + "description": "Adonis Database: sql delete where.", + "prefix": "db-truncate" + }, + // Pagination + "database: for page": { + "body": [ + "await ${1:Database}", + " .from(${2:table})", + " .forPage(${3:page}, ${4:[limit=20]})" + ], + "description": "Adonis Database: paginate for page.", + "prefix": "db-for-page" + }, + "database: paginate": { + "body": [ + "await ${1:Database}", + " .from(${2:table})", + " .paginate(${3:page}, ${4:[limit=20]})" + ], + "description": "Adonis Database: paginate.", + "prefix": "db-paginate" + }, + // Database Transactions + "database: begin transaction": { + "body": "await ${1:Database}.beginTransaction()", + "description": "Adonis Database: sql begin transaction.", + "prefix": "db-trx-begin" + }, + "database: insert using transaction": { + "body": "await ${1:trx}.insert(${2:data}).into(${3:table})", + "description": "Adonis Database: sql insert using transaction.", + "prefix": "db-trx-insert" + }, + "database: commit transaction": { + "body": "await ${1:trx}.commit()", + "description": "Adonis Database: sql commit transaction.", + "prefix": "db-trx-commit" + }, + "database: rollback transaction": { + "body": "await ${1:trx}.rollback()", + "description": "Adonis Database: sql rollback transaction.", + "prefix": "db-trx-rollback" + }, + // Aggregate + "database: count": { + "body": [ + "await ${1:Database}", + " .from(${2:table})", + " .count('${3:*} as ${4:total}')[0]", + " .${4:total}" + ], + "description": "Adonis Database: count.", + "prefix": "db-count" + }, + "database: count distinct": { + "body": [ + "await ${1:Database}", + " .from(${2:table})", + " .countDistinct('${3:*} as ${4:total}')[0]", + " .${4:total}" + ], + "description": "Adonis Database: count distinct.", + "prefix": "db-count-distinct" + }, + "database: get minimum": { + "body": "await ${1:Database}.from(${2:table}).min(${3:column})", + "description": "Adonis Database: sql get minimum value.", + "prefix": "db-min" + }, + "database: get maximum": { + "body": "await ${1:Database}.from(${2:table}).max(${3:column})", + "description": "Adonis Database: sql get maximum value.", + "prefix": "db-max" + }, + "database: sum": { + "body": "await ${1:Database}.from(${2:table}).sum(${3:column})", + "description": "Adonis Database: sql sum column.", + "prefix": "db-sum" + }, + "database: sum distinct": { + "body": "await ${1:Database}.from(${2:table}).sumDistinct(${3:column})", + "description": "Adonis Database: sql sum distinct.", + "prefix": "db-sum-distinct" + }, + "database: avg": { + "body": "await ${1:Database}.from(${2:table}).avg(${3:column})", + "description": "Adonis Database: sql average.", + "prefix": "db-avg" + }, + "database: avg distinct": { + "body": "await ${1:Database}.from(${2:table}).avgDistinct(${3:column})", + "description": "Adonis Database: sql average distinct.", + "prefix": "db-avg-distinct" + }, + "database: increment column by value": { + "body": [ + "await ${1:Database}", + " .table(${2:name})", + " .where(${3:query})", + " .increment(${4:column}, ${5:value})" + ], + "description": "Adonis Database: Increment column by value.", + "prefix": "db-increment" + }, + "database: decrement column by value": { + "body": [ + "await ${1:Database}", + " .table(${2:name})", + " .where(${3:query})", + " .decrement(${4:column}, ${5:value})" + ], + "description": "Adonis Database: decrement column by value.", + "prefix": "db-decrement" + }, + // Aggregate Helpers + "database: query builder - get count": { + "body": [ + "await ${1:Database}", + " .from(${2:table})", + " .getCount(${3:columnName = '*'})" + ], + "description": "Adonis Database: Query Builder - count.", + "prefix": "db-get-count" + }, + "database: query builder - get count distinct": { + "body": [ + "await ${1:Database}", + " .from(${2:table})", + " .getCountDistinct(${3:columnName = '*'})" + ], + "description": "Adonis Database: Query Builder - count distinct.", + "prefix": "db-get-count-distinct" + }, + "database: query builder - get min": { + "body": [ + "await ${1:Database}", + " .from(${2:table})", + " .getMin(${3:columnName = '*'})" + ], + "description": "Adonis Database: Query Builder - min.", + "prefix": "db-get-min" + }, + "database: query builder - get max": { + "body": [ + "await ${1:Database}", + " .from(${2:table})", + " .getMax(${3:columnName = '*'})" + ], + "description": "Adonis Database: Query Builder - max.", + "prefix": "db-get-max" + }, + "database: query builder - get sum": { + "body": [ + "await ${1:Database}", + " .from(${2:table})", + " .getSum(${3:columnName = '*'})" + ], + "description": "Adonis Database: Query Builder - sum.", + "prefix": "db-get-sum" + }, + "database: query builder - get sum distinct": { + "body": [ + "await ${1:Database}", + " .from(${2:table})", + " .getSumDistinct(${3:columnName = '*'})" + ], + "description": "Adonis Database: Query Builder - sum distinct.", + "prefix": "db-get-sum-distinct" + }, + "database: query builder - get average": { + "body": [ + "await ${1:Database}", + " .from(${2:table})", + " .getAvg(${3:columnName = '*'})" + ], + "description": "Adonis Database: Query Builder - average", + "prefix": "db-get-avg" + }, + "database: query builder - get average distinct": { + "body": [ + "await ${1:Database}", + " .from(${2:table})", + " .getAvgDistinct(${3:columnName = '*'})" + ], + "description": "Adonis Database: Query Builder - average distinct.", + "prefix": "db-get-avg-distinct" + }, + // Database Helpers + "database: pluck": { + "body": "await ${1:Database}.from(${2:table}).pluck(${3:column})", + "description": "Adonis Database: Get an array of values for the selected column.", + "prefix": "db-pluck" + }, + "database: first": { + "body": "await ${1:Database}.from(${2:table}).first()", + "description": "Adonis Database: Get first item in table by adding a limit 1 clause to the query.", + "prefix": "db-first" + }, + "database: clone": { + "body": [ + "${4:await }${1:Database}", + " .from(${2:table})", + " .where($3)", + " .clone()" + ], + "description": "Adonis Database: Clones the current query chain for later usage.", + "prefix": "db-clone" + }, + "database: get column information": { + "body": [ + "await ${1:Database}", + " .table(${2:table})", + " .columnInfo(${3:column})" + ], + "description": "Adonis Database: Get information for a given column", + "prefix": "db-column-info" + }, + // Subqueries + "database: sub-query": { + "body": [ + "${5:await }${1:Database}", + " .from(${2:table})", + " .whereIn(${3:column}, ${4:subquery})" + ], + "description": "Adonis Database: sql sub-query", + "prefix": "db-subquery" + }, + // Raw Queries + "database: raw queries": { + "body": "await ${1:Database}.raw(${2:sql}, [${3:values}])", + "description": "Adonis Database: sql raw queries", + "prefix": "db-raw" + }, + // Close Connection + "database: close connections": { + "body": "${1:Database}.close(${2:['${3:mysql}']})", + "description": "Adonis Database: Close database connectionn for specified connection names. If no connection is provided, all connections are closed by default.", + "prefix": "db-close" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/drive.json b/src/snippets/adonis/drive.json new file mode 100644 index 0000000..ff30acd --- /dev/null +++ b/src/snippets/adonis/drive.json @@ -0,0 +1,73 @@ +{ + "drive:": { + "body": "${1:Drive}.${2|exists,get,getStream,put,prepend,append,delete,move,copy|}($3)", + "description": "Adonis Drive", + "prefix": "drive" + }, + "drive: exists": { + "body": "${1:Drive}.exists(${2:relativePath})", + "description": "Adonis Drive: Find if a file/directory exists or not.", + "prefix": "drive-exists" + }, + "drive: get": { + "body": "${1:Drive}.get(${2:relativePath}, ${3:encoding = utf-8})", + "description": "Adonis Drive: Get file contents as a buffer or string.", + "prefix": "drive-get" + }, + "drive: get stream": { + "body": "${1:Drive}.getStream(${2:relativePath})", + "description": "Adonis Drive: Get file as a stream.", + "prefix": "drive-get-stream" + }, + "drive: put": { + "body": "${1:Drive}.put(${2:relativePath}, ${3:content}, ${4:options = {\\}})", + "description": "Adonis Drive: Create a new file with given contents (creates any missing directories).", + "prefix": "drive-put" + }, + "drive: prepend": { + "body": "${1:Drive}.prepend(${2:relativePath}, ${3:content}, ${4:options = {\\}})", + "description": "Adonis Drive: Prepend content to a file (creates a new file if path doesn’t exist).", + "prefix": "drive-prepend" + }, + "drive: append": { + "body": "${1:Drive}.append(${2:relativePath}, ${3:content}, ${4:options = {\\}})", + "description": "Adonis Drive: Append content to a file (creates a new file if path doesn’t exist).", + "prefix": "drive-append" + }, + "drive: delete": { + "body": "${1:Drive}.delete(${2:relativePath})", + "description": "Adonis Drive: Remove existing file.", + "prefix": "drive-delete" + }, + "drive: move": { + "body": "${1:Drive}.move(${2:relativePath}, ${3:content}, ${4:options = {\\}})", + "description": "Adonis Drive: Move file from one directory to another.", + "prefix": "drive-move" + }, + "drive: copy": { + "body": "${1:Drive}.copy(${2:relativePath}, ${3:content}, ${4:options = {\\}})", + "description": "Adonis Drive: Copy file from one directory to another.", + "prefix": "drive-copy" + }, + // Amazon S3 specific APIs + "drive: S3": { + "body": "${1:Drive}.disk('s3').${2|getObject,getUrl,getSignedUrl|}($3)", + "description": "Adonis Drive: S3 API", + "prefix": "s3" + }, + "drive: get object from S3": { + "body": "${1:Drive}.disk('s3').getObject(${2:location}, ${3:params})", + "description": "Adonis Drive: S3 - Get S3 object for a given file (for params info, see S3 params).", + "prefix": "s3-get-object" + }, + "drive: get url from S3": { + "body": "${1:Drive}.disk('s3').getUrl(${2:location}, ${3:bucket})", + "description": "Adonis Drive: S3 - Get url for a given file (accepts optional alternative bucket param).", + "prefix": "s3-get-url" + }, + "drive: get signed url from S3": { + "body": "${1:Drive}.disk('s3').getSignedUrl(${2:location}, ${3:expiry = 900}, ${4:params})", + "description": "Adonis Drive: S3 - Get signed url for a given file (expiry set to 15mins by default).", + "prefix": "s3-get-signed-url" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/encryption.json b/src/snippets/adonis/encryption.json new file mode 100644 index 0000000..216549b --- /dev/null +++ b/src/snippets/adonis/encryption.json @@ -0,0 +1,17 @@ +{ + "encryption": { + "body": "${1:Encryption}.${2|encrypt,decrypt|}($3)", + "description": "Adonis Encryption", + "prefix": "encryption" + }, + "encryption: decrypt string": { + "body": "${1:Encryption}.decrypt(${2:value})", + "description": "Adonis Encryption: Decrypt a plain text script.", + "prefix": "decrypt" + }, + "encryption: encrypt string ": { + "body": "${1:Encryption}.encrypt(${2:value})", + "description": "Adonis Encryption: Encrypt a plain text string.", + "prefix": "encrypt" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/event.json b/src/snippets/adonis/event.json new file mode 100644 index 0000000..d717489 --- /dev/null +++ b/src/snippets/adonis/event.json @@ -0,0 +1,72 @@ +{ + "event:": { + "body": "${1:Event}.${2|on,fire,when,once,onAny,times,emit,removeListener,off,removeAlllisteners,listenersCount,getListeners,hasListeners|}($3)", + "description": "Adonis Event", + "prefix": "event" + }, + "event: on": { + "body": "${1:Event}.on(${2:event}, ${3:listener})", + "description": "Adonis Event: Bind single or multiple listeners for a given event. The listener can be a closure function or reference to one (or many) IoC container bindings.", + "prefix": "event-on" + }, + "event: fire": { + "body": "${1:Event}.fire(${2:event}, ${3:data})", + "description": "Adonis Event: Emit an event with optional data (an alias to the `emit` method).", + "prefix": "event-fire" + }, + "event: when": { + "body": "${1:Event}.when(${2:event}, ${3:listener})", + "description": "Adonis Event: The when method aliases the on method.", + "prefix": "event-when" + }, + "event: once": { + "body": "${1:Event}.once(${2:event}, ${3:listener})", + "description": "Adonis Event: Same as on, but only called one time.", + "prefix": "event-once" + }, + "event: on any": { + "body": "${1:Event}.onAny(${2:listener})", + "description": "Adonis Event: Bind listener for any event.", + "prefix": "event-on-any" + }, + "event: times": { + "body": "${1:Event}.times(${2:times})", + "description": "Adonis Event: The times method is chained with `on` or `when` to limit the number of times the listener should be fired.", + "prefix": "event-times" + }, + "event: emit": { + "body": "${1:Event}.emit(${2:event}, ${3:data})", + "description": "Adonis Event: Emit an event with optional data.", + "prefix": "event-emit" + }, + "event: remove listener": { + "body": "${1:Event}.removeListener(${2:event}, ${3:listener})", + "description": "Adonis Event: Remove listener(s) for a given event.", + "prefix": "event-remove-listener" + }, + "event: off": { + "body": "${1:Event}.off(${2:event}, ${3:listener})", + "description": "Adonis Event: Remove all listeners for a given event.", + "prefix": "event-off" + }, + "event: remove all listeners": { + "body": "${1:Event}.removeAlllisteners(${2:event})", + "description": "Adonis Event: Remove all listeners for a given event.", + "prefix": "event-remove-all-listeners" + }, + "event: count listeners": { + "body": "${1:Event}.listenersCount(${2:event})", + "description": "Adonis Event: Get the number of listeners for a given event.", + "prefix": "event-listeners-count" + }, + "event: get listeners": { + "body": "${1:Event}.getListeners(${2:event})", + "description": "Adonis Event: Get an array of listeners for a given event.", + "prefix": "event-get-listeners" + }, + "event: check if isteners exist for event": { + "body": "${1:Event}.hasListeners(${2:event})", + "description": "Adonis Event: Get a boolean indicating whether there are any listeners for a given event.", + "prefix": "event-has-listeners" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/factory.json b/src/snippets/adonis/factory.json new file mode 100644 index 0000000..01c1682 --- /dev/null +++ b/src/snippets/adonis/factory.json @@ -0,0 +1,58 @@ +{ + "factory": { + "body": "${1:Factory}.${2|model,blueprint,get|}($3)", + "description": "Adonis Factory", + "prefix": "factory" + }, + "factory: create model instance": { + "body": "${1:Factory}.model(${2:name}).create()", + "description": "Adonis Factory: Persist and return model instance.", + "prefix": "factory-create" + }, + "factory: create many model instances": { + "body": "${1:Factory}.model(${2:name}).createMany(${3:3})", + "description": "Adonis Factory: Persist and return many model instances.", + "prefix": "factory-create-many" + }, + "factory: make un-persisted model": { + "body": "${1:Factory}.model(${2:name}).make()", + "description": "Adonis Factory: Get model instance but do not persist it to the database.", + "prefix": "factory-make" + }, + "factory: make many un-persisted model": { + "body": "${1:Factory}.model(${2:name}).makeMany(${3:3})", + "description": "Adonis Factory: Get array of model instances but do not persist them to the database.", + "prefix": "factory-make-many" + }, + "factory: create model factory blueprint": { + "body": [ + "${1:Factory}.blueprint(${2:table}, (faker) => {", + " return {", + " $3", + " }", + "\\})" + ], + "description": "Adonis Factory: Define a factory blueprint for a database table.", + "prefix": "factory-blueprint" + }, + "factory: change table without lucid": { + "body": "${1:Factory}.get(${2:table}).table(${3:newTableName}).create()", + "description": "Adonis Factory: Define a different table name at runtime.", + "prefix": "factory-table" + }, + "factory: returning without lucid": { + "body": "${1:Factory}.get(${2:table}).returning(${3:column}).create()", + "description": "Adonis Factory: For PostgreSQL, define a returning column.", + "prefix": "factory-return" + }, + "factory: change connection without lucid": { + "body": "${1:Factory}.get(${2:table}).connection('${3:myql}')", + "description": "Adonis Factory: Choose a different connection at runtime.", + "prefix": "factory-conn" + }, + "factory: create many without lucid": { + "body": "${1:Factory}.get(${2:table}).creatMany(${3:3})", + "description": "Adonis Factory: Create multiple records.", + "prefix": "factory-create-many" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/hash.json b/src/snippets/adonis/hash.json new file mode 100644 index 0000000..ad1206c --- /dev/null +++ b/src/snippets/adonis/hash.json @@ -0,0 +1,17 @@ +{ + "hash": { + "body": "${1:Encryption}.${2|make,verify|}($3)", + "description": "Adonis Hashing", + "prefix": "hash" + }, + "hash: make hash from plain string": { + "body": "${1:Encryption}.make(${2:value}, ${3:config = {\\}})", + "description": "Adonis Hashing: Hash a plain string value.", + "prefix": "hash" + }, + "hash: verify hash string": { + "body": "${1:Encryption}.verify(${2:value}, ${3:hashedValue})", + "description": "Adonis Hashing: Verify the input value against the previously hashed value.", + "prefix": "hash-verify" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/helpers.json b/src/snippets/adonis/helpers.json new file mode 100644 index 0000000..ea86dc5 --- /dev/null +++ b/src/snippets/adonis/helpers.json @@ -0,0 +1,62 @@ +{ + "helper": { + "body": "${1:Helper}.${2|appRoot,publicPath,configPath,resourcesPath,migrationsPath,seedsPath,databasePath,viewsPath,tmpPath,promisify,isAceCommand|}($3)", + "description": "Adonis Helper", + "prefix": "help" + }, + "helper: get app root": { + "body": "${1:Helper}.appRoot()", + "description": "Adonis Helper: Get path to the application root.", + "prefix": "help-app-root" + }, + "helper: get public directory path": { + "body": "${1:Helper}.publicPath(${2:toFile = optional})", + "description": "Adonis Helper: Get path to the public directory or file inside the directory.", + "prefix": "help-public-path" + }, + "helper: get path to config directory": { + "body": "${1:Helper}.configPath(${2:toFile = optional})", + "description": "Adonis Helper: Get path to the config directory or file inside the directory.", + "prefix": "help-config-path" + }, + "helper: get path to resources directory": { + "body": "${1:Helper}.resourcesPath(${2:toFile = optional})", + "description": "Adonis Helper: Get path to the resources directory or file inside the directory.", + "prefix": "help-resources-path" + }, + "helper: get path to migrations directory": { + "body": "${1:Helper}.migrationsPath(${2:toFile = optional})", + "description": "Adonis Helper: Get path to the migrations directory or file inside the directory.", + "prefix": "help-migrations-path" + }, + "helper: get path to seeds directory": { + "body": "${1:Helper}.seedsPath(${2:toFile = optional})", + "description": "Adonis Helper: Get path to the seeds directory or file inside the directory.", + "prefix": "help-seeds-path" + }, + "helper: get path to database directory": { + "body": "${1:Helper}.databasePath(${2:toFile = optional})", + "description": "Adonis Helper: Get path to the database directory or file inside the directory.", + "prefix": "help-database-path" + }, + "helper: get path to views directory": { + "body": "${1:Helper}.viewsPath(${2:toFile = optional})", + "description": "Adonis Helper: Get path to the views directory or file inside the directory.", + "prefix": "help-views-path" + }, + "helper: get path to `tmp` directories": { + "body": "${1:Helper}.tmpPath(${2:toFile = optional})", + "description": "Adonis Helper: Get path to the tmp directory or file inside the directory.", + "prefix": "help-tmp-path" + }, + "helper: get promisified callback callback": { + "body": "${1:Helper}.promisify(${2:item})", + "description": "Adonis Helper: Get promisified callback functions.", + "prefix": "help-promisify" + }, + "helper: check if ace command started current process": { + "body": "${1:Helper}.isAceCommand()", + "description": "Adonis Helper: Get whether the process was started as the ace command or not.", + "prefix": "help-is-ace" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/logger.json b/src/snippets/adonis/logger.json new file mode 100644 index 0000000..8bcea76 --- /dev/null +++ b/src/snippets/adonis/logger.json @@ -0,0 +1,57 @@ +{ + "logger": { + "body": "${1:Logger}.${2|emerg,alert,crit,error,warning,notice,info,debug|}(${3:msg}, ${4:...data})", + "description": "Adonis Logger", + "prefix": "log" + }, + "logger: debug": { + "body": "${1:Logger}.debug(${2:msg}, ${3:...data})", + "description": "Adonis Logger: Debug", + "prefix": "log-debug" + }, + "logger: info": { + "body": "${1:Logger}.info(${2:msg}, ${3:...data})", + "description": "Adonis Logger: Info", + "prefix": "log-info" + }, + "logger: notice": { + "body": "${1:Logger}.notice(${2:msg}, ${3:...data})", + "description": "Adonis Logger: Notice", + "prefix": "log-notice" + }, + "logger: warning": { + "body": "${1:Logger}.warning(${2:msg}, ${3:...data})", + "description": "Adonis Logger: Warning", + "prefix": "log-warning" + }, + "logger: error": { + "body": "${1:Logger}.error(${2:msg}, ${3:...data})", + "description": "Adonis Logger: Error", + "prefix": "log-error" + }, + "logger: critical": { + "body": "${1:Logger}.crit(${2:msg}, ${3:...data})", + "description": "Adonis Logger: Critical", + "prefix": "log-crit" + }, + "logger: alert": { + "body": "${1:Logger}.alert(${2:msg}, ${3:...data})", + "description": "Adonis Logger: Alert", + "prefix": "log-alert" + }, + "logger: emergency": { + "body": "${1:Logger}.emerg(${2:msg}, ${3:...data})", + "description": "Adonis Logger: Emergency", + "prefix": "log-emerg" + }, + "logger: switch transport": { + "body": "${1:Logger}.transport(${2:transport}).${3|emerg,alert,crit,error,warning,notice,info,debug|}(${4:msg}, ${5:...data})", + "description": "Adonis Logger: Switch log transport.", + "prefix": "log-transport" + }, + "logger: change log level": { + "body": "${1:Logger}.level = '${2|emerg,alert,crit,error,warning,notice,info,debug|}'", + "description": "Adonis Logger: Change log level.", + "prefix": "log-level" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/mail.json b/src/snippets/adonis/mail.json new file mode 100644 index 0000000..e481995 --- /dev/null +++ b/src/snippets/adonis/mail.json @@ -0,0 +1,94 @@ +{ + "mail": { + "body": "${1:Mail}.${2|send,raw,connection|}($3)", + "description": "Adonis Mail: ", + "prefix": "mail" + }, + "mail: send message": { + "body": [ + "await ${1:Mail}.send(${2:views = []}, ${3:data}, (${4:message}) => {", + " ${4:message}$0", + "\\})$5" + ], + "description": "Adonis Mail: Send email using one or many Edge views.", + "prefix": "mail-send" + }, + "mail: send raw text": { + "body": [ + "await ${1:Mail}.raw(${2:views = []}, (${3:message}) => {", + " ${3:message}$0", + "\\})$4" + ], + "description": "Adonis Mail: Use a raw string to send the mail (when the string is HTML the email HTML body will be set, otherwise just a plain text email will be sent).", + "prefix": "mail-send-raw" + }, + "mail: switch connection": { + "body": [ + "await ${1:Mail}", + " .connection(${2:name})", + " .${3|send,raw|}($4)" + ], + "description": "Adonis Mail: Switch the mail driver.", + "prefix": "mail-connection" + }, + "mail: set `to` address": { + "body": "${1:message}.to(${2:email}, ${3:optionalName})", + "description": "Adonis Mail: Set `to` address.", + "prefix": "mail-msg-to" + }, + "mail: set `from` address": { + "body": "${1:message}.from(${2:email}, ${3:optionalName})", + "description": "Adonis Mail: Set `from` address.", + "prefix": "mail-msg-from" + }, + "mail: set `cc` address": { + "body": "${1:message}.cc(${2:email}, ${3:optionalName})", + "description": "Adonis Mail: Add `cc` address to the email.", + "prefix": "mail-msg-cc" + }, + "mail: set `bcc` address": { + "body": "${1:message}.bcc(${2:email}, ${3:optionalName})", + "description": "Adonis Mail: Add `bcc` address to the email.", + "prefix": "mail-msg-bcc" + }, + "mail: reply to message": { + "body": "${1:message}.replyTo(${2:email})", + "description": "Adonis Mail: Set `replyTo` email address.", + "prefix": "mail-msg-reply-to" + }, + "mail: send mail in reply to another message": { + "body": "${1:message}.inReplyTo(${2:messageId})", + "description": "Adonis Mail: Set email message `id`.", + "prefix": "mail-msg-in-reply-to" + }, + "mail: set mail `subject`": { + "body": "${1:message}.subject(${2:value})", + "description": "Adonis Mail: Set email subject.", + "prefix": "mail-msg-subject" + }, + "mail: manually set message text": { + "body": "${1:message}.text(${2:messageId})", + "description": "Adonis Mail: Manually set the plain text body for the email.", + "prefix": "mail-msg-text" + }, + "mail: attach file to message": { + "body": "${1:message}.attach(${2:filePath}, ${3:options = {\\}})", + "description": "Adonis Mail: Attach file(s) to the email.", + "prefix": "mail-msg-attach" + }, + "mail: attach data(string, buffer, stream) to message": { + "body": "${1:message}.attachData(${2|new Buffer,fs|}, ${3:filename}, ${4:options = {\\}})", + "description": "Adonis Mail: Attach raw data as a `String`, `Buffer` or `Stream`.", + "prefix": "mail-msg-attach-data" + }, + "mail: embed image into message": { + "body": "${1:message}.embed(${2:filePath}, ${3:contendId}, ${4:options = {\\}}))", + "description": "Adonis Mail: Embed an image into the HTML body using a *content id*.", + "prefix": "mail-msg-embed" + }, + "mail: pass in more values to mail driver": { + "body": "${1:message}.driverExtras(${2:options = {\\}})", + "description": "Adonis Mail: Pass an object of values to the current driver.", + "prefix": "mail-msg-driver-extras" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/redis.json b/src/snippets/adonis/redis.json new file mode 100644 index 0000000..63da081 --- /dev/null +++ b/src/snippets/adonis/redis.json @@ -0,0 +1,43 @@ +{ + "redis": { + "body": "${4:await }${1:Redis}.${2|subscribe,psubscribe,publish,unsubscribe,punsubscribe,connection,quit|}($3)", + "description": "Adonis Redis", + "prefix": "redis" + }, + "redis: subscribe to channel": { + "body": "${4:await }${1:Redis}.subscribe(${2:channel}, ${3:listener})", + "description": "Adonis Redis - Subscribe to a channel.", + "prefix": "redis-sub" + }, + "redis: subscribe to channel by pattern": { + "body": "${4:await }${1:Redis}.psubscribe(${2:pattern}, ${3:listener})", + "description": "Adonis Redis - Subscribe to a pattern channel.", + "prefix": "redis-psub" + }, + "redis: publish message to channel": { + "body": "${4:await }${1:Redis}.publish(${2:channel}, ${3:message})", + "description": "Adonis Redis - Publish message to a given channel.", + "prefix": "redis-publish" + }, + "redis: unsubscribe from channel": { + "body": "${3:await }${1:Redis}.unsubscribe(${2:channel})", + "description": "Adonis Redis - Unsubscribe from a given channel.", + "prefix": "redis-unsub" + }, + "redis: unsubscribe from channel by pattern": { + "body": "${3:await }${1:Redis}.punsubscribe(${2:channelPattern})", + "description": "Adonis Redis - Unsubscribe from a given pattern.", + "prefix": "redis-punsub" + }, + "redis: select a connection": { + "body": "${4:await }${1:Redis}.connection(${2:name})", + "description": "Adonis Redis - Use a different connection to make Redis queries.", + "prefix": "redis-conn" + }, + "redis: quit connection(s)": { + "body": "${4:await }${1:Redis}.quit(['${2:connection}', $3])", + "description": "Adonis Redis - Quite a connection for an array of connections.", + "prefix": "redis-quit" + } + // TODO: Port all redis commands as snippets e.g. hmset, xread, xlen etc +} \ No newline at end of file diff --git a/src/snippets/adonis/request.json b/src/snippets/adonis/request.json new file mode 100644 index 0000000..44c4832 --- /dev/null +++ b/src/snippets/adonis/request.json @@ -0,0 +1,158 @@ +{ + "request": { + "body": "${1:request}.${2|all,get,post,raw,only,except,input,collect,header,headers,cookie,cookies,plainCookie,plainCookies,accepts,language,url,originalUrl,method,intended,ip,ips,subdomains,ajax,pjax,hostname,protocol,match,hasBody,is|}($3)", + "description": "Adonis Route", + "prefix": "req" + }, + "request: all": { + "body": "${1:request}.all()", + "description": "Adonis Route: Get an object containing all request data (merges query params and request body data).", + "prefix": "req-all" + }, + "request: get": { + "body": "${1:request}.get()", + "description": "Adonis Route: Get an object containing query params data.", + "prefix": "req-get" + }, + "request: post": { + "body": "${1:request}.post()", + "description": "Adonis Route: Get an object containing request body data.", + "prefix": "req-post" + }, + "request: raw": { + "body": "${1:request}.raw()", + "description": "Adonis Route: Get raw body data as a string.", + "prefix": "req-raw" + }, + "request: only": { + "body": "${1:request}.only([${2:key}$3])", + "description": "Adonis Route: Get an object with only the specified keys.", + "prefix": "req-only" + }, + "request: except": { + "body": "${1:request}.except([${2:key}$3])", + "description": "Adonis Route: Get an object with everything except the specified keys (opposite of only).", + "prefix": "req-except" + }, + "request: input": { + "body": "${1:request}.input(${2:key}, ${3:default})", + "description": "Adonis Route: Get the value of a given key (if it doesn’t exist, return the default value).", + "prefix": "req-input" + }, + "request: collect": { + "body": "${1:request}.collect([${2:key}$3])", + "description": "Adonis Route: Collect request data in a read-to-save to DB format.", + "prefix": "req-collect" + }, + "request: header": { + "body": "${1:request}.header(${2:key}, ${3:default})", + "description": "Adonis Route: Get the header value for a given key (optionally with default value)", + "prefix": "req-header" + }, + "request: headers": { + "body": "${1:request}.headers()", + "description": "Adonis Route: Get an object of all header data.", + "prefix": "req-headers" + }, + "request: cookie": { + "body": "${1:request}.cookie(${2:key}, ${3:default})", + "description": "Adonis Route: Get the cookie value for a given key (optionally with default value).", + "prefix": "req-cookie" + }, + "request: cookies": { + "body": "${1:request}.cookies()", + "description": "Adonis Route: Get an object of all cookie data.", + "prefix": "req-cookies" + }, + "request: set plain cookie": { + "body": "${1:request}.plainCookie(${2:key}, ${3:default})", + "description": "Adonis Route: Get the raw cookie value for a given key (optionally with default value).", + "prefix": "req-plainCookie" + }, + "request: get all plain cookies data": { + "body": "${1:request}.plainCookies()", + "description": "Adonis Route: Get an object of all raw cookie data.", + "prefix": "req-plainCookies" + }, + "request: accepts": { + "body": "${1:request}.accepts([${2:value}$3])", + "description": "Adonis Route: Reads the Accept header to help determine the response format.", + "prefix": "req-accepts" + }, + "request: language": { + "body": "${1:request}.language([${2:value}$3])", + "description": "Adonis Route: Language can also be negotiated based upon the Accept-Language header.", + "prefix": "req-language" + }, + // Request methods + "request: url": { + "body": "${1:request}.url()", + "description": "Adonis Route: Returns the current request url", + "prefix": "req-url" + }, + "request: original url": { + "body": "${1:request}.originalUrl()", + "description": "Adonis Route: Get the full current request url with query strings.", + "prefix": "req-originalUrl" + }, + "request: method": { + "body": "${1:request}.method()", + "description": "Adonis Route: Get the HTTP request method.", + "prefix": "req-method" + }, + "request: intended": { + "body": "${1:request}.intended()", + "description": "Adonis Route: Get the actual method leveraging AdonisJS method spoofing.", + "prefix": "req-intended" + }, + "request: ip": { + "body": "${1:request}.ip()", + "description": "Adonis Route: Get the most trusted ip address for the user.", + "prefix": "req-ip" + }, + "request: ips": { + "body": "${1:request}.ips()", + "description": "Adonis Route: Get an array of ips from most to the least trusted (removes the default ip address, which can be accessed via the ip method).", + "prefix": "req-ips" + }, + "request: subdomains": { + "body": "${1:request}.subdomains()", + "description": "Adonis Route: Get a list of request subdomains (removes www from the list).", + "prefix": "req-subdomains" + }, + "request: ajax": { + "body": "${1:request}.ajax()", + "description": "Adonis Route: Checks for X-Requested-With header to determine if the request is ajax or not.", + "prefix": "req-ajax" + }, + "request: pjax": { + "body": "${1:request}.pjax()", + "description": "Adonis Route: Look for the X-PJAX header to identify if a request is pjax or not.", + "prefix": "req-pjax" + }, + "request: hostname": { + "body": "${1:request}.hostname()", + "description": "Adonis Route: Get the request hostname.", + "prefix": "req-hostname" + }, + "request: protocol": { + "body": "${1:request}.protocol()", + "description": "Adonis Route: Get the request protocol.", + "prefix": "req-protocol" + }, + "request: match": { + "body": "${1:request}.match([${2:expression}$3])", + "description": "Adonis Route: Get whether the passed set of expressions match the current request URL.", + "prefix": "req-match" + }, + "request: has body": { + "body": "${1:request}.hasBody()", + "description": "Adonis Route: A boolean indicating if the request has a post body (mainly used by the BodyParser to determine whether or not to parse the body).", + "prefix": "req-hasBody" + }, + "request: is": { + "body": "${1:request}.is([${2:contentType}$3])", + "description": "Adonis Route: Get the best matching content type for the current request.", + "prefix": "req-is" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/response.json b/src/snippets/adonis/response.json new file mode 100644 index 0000000..7020fb1 --- /dev/null +++ b/src/snippets/adonis/response.json @@ -0,0 +1,287 @@ +{ + "response": { + "body": "${1:response}.${2|send,json,header,safeHeader,removeHeader,type,cookie,clearCookie,plainCookie,redirect,route,download,attachment,unauthorized,status,continue,switchingProtocols,ok,created,accepted,nonAuthoritativeInformation,noContent,resetContent,partialContent,multipleChoices,movedPermanently,found,seeOther,notModified,useProxy,temporaryRedirect,badRequest,unauthorized,paymentRequired,forbidden,notFound,methodNotAllowed,notAcceptable,proxyAuthenticationRequired,requestTimeout,conflict,gone,lengthRequired,preconditionFailed,requestEntityTooLarge,requestUriTooLong,unsupportedMediaType,requestedRangeNotSatisfiable,expectationFailed,unprocessableEntity,tooManyRequests,internalServerError,notImplemented,badGateway,serviceUnavailable,gatewayTimeout,httpVersionNotSupported|}($3)", + "description": "Adonis Response", + "prefix": "res" + }, + "response: send": { + "body": "${1:response}.send(${2:data})", + "description": "Adonis Response: Send the provided data.", + "prefix": "res-send" + }, + "response: json": { + "body": "${1:response}.json(${2:data})", + "description": "Adonis Response: Return json response.", + "prefix": "res-json" + }, + "response: header": { + "body": "${1:response}.header(${2:key}, ${3:value})", + "description": "Adonis Response: Set a header value.", + "prefix": "res-header" + }, + "response: safe header": { + "body": "${1:response}.safeHeader(${2:key}, ${3:value})", + "description": "Adonis Response: Only set a header value if it does not already exist.", + "prefix": "res-safeHeader" + }, + "response: remove header": { + "body": "${1:response}.removeHeader(${2:key})", + "description": "Adonis Response: Remove an existing header.", + "prefix": "res-removeHeader" + }, + "response: type": { + "body": "${1:response}.type(${2:contentType})", + "description": "Adonis Response: Set the Content-Type header.", + "prefix": "res-type" + }, + "response: cookie": { + "body": "${1:response}.cookie(${2:key}, ${3:value})", + "description": "Adonis Response: Set a cookie value.", + "prefix": "res-cookie" + }, + "response: clear cookie": { + "body": "${1:response}.clearCookie(${2:key})", + "description": "Adonis Response: Remove an existing cookie value (by setting its expiry in the past).", + "prefix": "res-clearCookie" + }, + "response: plain cookie": { + "body": "${1:response}.plainCookie(${2:key}, ${3:value})", + "description": "Adonis Response: Set a plain cookie key/value pair.", + "prefix": "res-plainCookie" + }, + "response: redirect": { + "body": "${1:response}.redirect(${2:url}, ${3:sendParam = true}, ${4:status = 301})", + "description": "Adonis Response: Redirect request to a different url (by default it will set the status as 302).", + "prefix": "res-redirect" + }, + "response: route": { + "body": "${1:response}.route(${2:route}, ${3:data}, ${4:domain}, ${5:sendParams = false}, ${6:status = 302})", + "description": "Adonis Response: Redirect to a route (via route name or controller method).", + "prefix": "res-route" + }, + "response: download": { + "body": "${1:response}.download(${2:filePath})", + "description": "Adonis Response: Stream the file specified to the client.", + "prefix": "res-download" + }, + "response: attachment": { + "body": "${1:response}.attachment(${2:filePath}, ${3:name}, ${4:disposition})", + "description": "Adonis Response: Force download the file specified.", + "prefix": "res-attachment" + }, + "response: status": { + "body": "${1:response}.status(${2:data})", + "description": "Adonis Response: Specify the status code to be return to a client.", + "prefix": "res-status" + }, + "response: 100 - continue": { + "body": "${1:response}.continue(${2:data})", + "description": "Adonis Response: 100 - continue.", + "prefix": "res-continue" + }, + "response: 101 - switching protocols": { + "body": "${1:response}.switchingProtocols(${2:data})", + "description": "Adonis Response: 101 - switching protocols.", + "prefix": "res-switching-protocols" + }, + "response: 200 - ok": { + "body": "${1:response}.ok(${2:data})", + "description": "Adonis Response: 200 - ok.", + "prefix": "res-ok" + }, + "response: 201 - created": { + "body": "${1:response}.created(${2:data})", + "description": "Adonis Response: 201 - created.", + "prefix": "res-created" + }, + "response: 202 - accepted": { + "body": "${1:response}.accepted(${2:data})", + "description": "Adonis Response: 202 - accepted.", + "prefix": "res-accepted" + }, + "response: 203 - non-authoritative information": { + "body": "${1:response}.nonAuthoritativeInformation(${2:data})", + "description": "Adonis Response: 203 - non authoritative information.", + "prefix": "res-non-auth-info" + }, + "response: 204 - no content": { + "body": "${1:response}.noContent(${2:data})", + "description": "Adonis Response: 204 - no content.", + "prefix": "res-no-content" + }, + "response: 205 - reset content": { + "body": "${1:response}.resetContent(${2:data})", + "description": "Adonis Response: 205 - reset content.", + "prefix": "res-reset-content" + }, + "response: 206 - partial content": { + "body": "${1:response}.partialContent(${2:data})", + "description": "Adonis Response: 206 - partial content.", + "prefix": "res-partial-content" + }, + "response: 300 - multiple choices": { + "body": "${1:response}.multipleChoices(${2:data})", + "description": "Adonis Response: 300 - multiple choices.", + "prefix": "res-multiple choices" + }, + "response: 301 - moved permanently": { + "body": "${1:response}.movedPermanently(${2:data})", + "description": "Adonis Response: 301 - moved permanently.", + "prefix": "res-moved-permanently" + }, + "response: 302 - found": { + "body": "${1:response}.found(${2:data})", + "description": "Adonis Response: 302 - found.", + "prefix": "res-found" + }, + "response: 303 - see other": { + "body": "${1:response}.seeOther(${2:data})", + "description": "Adonis Response: 303 - see-other.", + "prefix": "res-see-other" + }, + "response: 304 - not modified": { + "body": "${1:response}.notModified(${2:data})", + "description": "Adonis Response: 304 - not modified.", + "prefix": "res-not-modified" + }, + "response: 305 - use proxy": { + "body": "${1:response}.useProxy(${2:data})", + "description": "Adonis Response: 305 - use proxy.", + "prefix": "res-use-proxy" + }, + "response: 307 - temporary redirect": { + "body": "${1:response}.temporaryRedirect(${2:data})", + "description": "Adonis Response: 307 - temporary redirect.", + "prefix": "res-temp-redirect" + }, + "response: 400 - bad request": { + "body": "${1:response}.badRequest(${2:data})", + "description": "Adonis Response: 400 - bad request.", + "prefix": "res-bad-request" + }, + "response: 401 - unauthorized": { + "body": "${1:response}.unauthorized(${2:data})", + "description": "Adonis Response: 401 - unauthorized.", + "prefix": "res-unauthorized" + }, + "response: 402 - payment required": { + "body": "${1:response}.paymentRequired(${2:data})", + "description": "Adonis Response: 402 - payment required.", + "prefix": "res-payment-required" + }, + "response: 403 - forbidden": { + "body": "${1:response}.forbidden(${2:data})", + "description": "Adonis Response: 403 - forbidden.", + "prefix": "res-forbidden" + }, + "response: 404 - not found": { + "body": "${1:response}.notFound(${2:data})", + "description": "Adonis Response: 404 - not found.", + "prefix": "res-not-found" + }, + "response: 405 - method not allowed": { + "body": "${1:response}.methodNotAllowed(${2:data})", + "description": "Adonis Response: 405 - method not allowed.", + "prefix": "res-method-not-allowed" + }, + "response: 406 - not acceptable": { + "body": "${1:response}.notAcceptable(${2:data})", + "description": "Adonis Response: 406 - not acceptable.", + "prefix": "res-not-acceptable" + }, + "response: 407 - proxy authentication required": { + "body": "${1:response}.proxyAuthenticationRequired(${2:data})", + "description": "Adonis Response: 407 - proxy authentication required.", + "prefix": "res-proxy-auth-required" + }, + "response: 408 - request timeout": { + "body": "${1:response}.requestTimeout(${2:data})", + "description": "Adonis Response: 408 - request timeout.", + "prefix": "res-request-timeout" + }, + "response: 409 - conflict": { + "body": "${1:response}.conflict(${2:data})", + "description": "Adonis Response: 409 - conflict.", + "prefix": "res-conflict" + }, + "response: 410 - gone": { + "body": "${1:response}.gone(${2:data})", + "description": "Adonis Response: 410 - gone.", + "prefix": "res-gone" + }, + "response: 411 - length required": { + "body": "${1:response}.lengthRequired(${2:data})", + "description": "Adonis Response: 411 - length required.", + "prefix": "res-length-required" + }, + "response: 412 - precondition failed": { + "body": "${1:response}.preconditionFailed(${2:data})", + "description": "Adonis Response: 412 - precondition failed.", + "prefix": "res-precondition-failed" + }, + "response: 413 - request entity too large": { + "body": "${1:response}.requestEntityTooLarge(${2:data})", + "description": "Adonis Response: 413 - request entity too large.", + "prefix": "res-request-entity-too-large" + }, + "response: 414 - request uri too long": { + "body": "${1:response}.requestUriTooLong(${2:data})", + "description": "Adonis Response: 414 - request URI too long.", + "prefix": "res-request-uri-too-long" + }, + "response: 415 - unsupported media type": { + "body": "${1:response}.unsupportedMediaType(${2:data})", + "description": "Adonis Response: 415 - unsupported media type.", + "prefix": "res-unsupported-media-type" + }, + "response: 416 - requested range not satisfiable": { + "body": "${1:response}.requestedRangeNotSatisfiable(${2:data})", + "description": "Adonis Response: 416 - requested range not satisfiable.", + "prefix": "res-requested-range-not-satisfiable" + }, + "response: 417 - expectation failed": { + "body": "${1:response}.expectationFailed(${2:data})", + "description": "Adonis Response: 417 - expectation failed.", + "prefix": "res-expectation-failed" + }, + "response: 422 - unprocessable entity": { + "body": "${1:response}.unprocessableEntity(${2:data})", + "description": "Adonis Response: 422 - unprocessable entity.", + "prefix": "res-unprocessable-entity" + }, + "response: 429 - too many requests": { + "body": "${1:response}.tooManyRequests(${2:data})", + "description": "Adonis Response: 429 - too many requests.", + "prefix": "res-too-many-requests" + }, + "response: 500 - internal server error": { + "body": "${1:response}.internalServerError(${2:data})", + "description": "Adonis Response: 500 - internal server error.", + "prefix": "res-internal-server-error" + }, + "response: 501 - not implemented": { + "body": "${1:response}.notImplemented(${2:data})", + "description": "Adonis Response: 501 - not implemented.", + "prefix": "res-not-implemented" + }, + "response: 502 - bad gateway": { + "body": "${1:response}.badGateway(${2:data})", + "description": "Adonis Response: 502 - bad gateway.", + "prefix": "res-bad-gateway" + }, + "response: 503 - service unavailable": { + "body": "${1:response}.serviceUnavailable(${2:data})", + "description": "Adonis Response: 503 - service unavailable.", + "prefix": "res-service-unavailable" + }, + "response: 504 - gateway timeout": { + "body": "${1:response}.gatewayTimeout(${2:data})", + "description": "Adonis Response: 504 - gateway timeout.", + "prefix": "res-gateway-timeout" + }, + "response: 505 - http version not supported": { + "body": "${1:response}.httpVersionNotSupported(${2:data})", + "description": "Adonis Response: 505 - http version not supported.", + "prefix": "res-http-version-not-supported" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/route.json b/src/snippets/adonis/route.json new file mode 100644 index 0000000..4117515 --- /dev/null +++ b/src/snippets/adonis/route.json @@ -0,0 +1,45 @@ +{ + "route": { + "body": "Route.${1|get,put,post,patch,delete,any|}('$2', $3, $4)", + "description": "Adonis Route", + "prefix": "route" + }, + "route: on(...).render('view')": { + "body": "Route.on($1).render($2)", + "description": "Adonis Route: on", + "prefix": "route-on" + }, + "route: named route": { + "body": "Route.${1|get,put,post,patch,delete,any|}('$2', $3, $4).as('$7')", + "description": "Adonis Route: Name a route with a unique value.", + "prefix": "route-named" + }, + "route: formats": { + "body": "Route.${1|get,put,post,patch,delete,any|}('$2', $3, $4).formats(['$7',$8], $9)", + "description": "Adonis Route: Defines formats for all routes in the group.", + "prefix": "route-formats" + }, + "route: inline": { + "body": [ + "Route.${1|get,put,post,patch,delete,any|}('$2', ($5) => {", + " $7", + "\\},$6)" + ], + "description": "Adonis Route: Map route to inline function.", + "prefix": "route-inline" + }, + "route: resource": { + "body": "Route.resource('$1', $2).${3|apiOnly,only,except,middleware,formats|}($4)", + "description": "Adonis Route: Resources", + "prefix": "route-resource" + }, + "route: group": { + "body": [ + "Route.group(() => {", + " $1", + "}).${2|domain,prefix,middleware,namespace,formats|}($3)" + ], + "description": "Adonis Route: Group", + "prefix": "route-group" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/session.json b/src/snippets/adonis/session.json new file mode 100644 index 0000000..8c8384b --- /dev/null +++ b/src/snippets/adonis/session.json @@ -0,0 +1,77 @@ +{ + "session": { + "body": "${1:session}.${2|put,get,all,increment,decrement,forget,pull,clear,flashAll,flashOnly,flashExcept,withErrors,flash,old,withErrorFor,getErrorFor,flashMessage,commit|}($3)", + "description": "Adonis Session", + "prefix": "session" + }, + "session: put key pair value to session": { + "body": "${1:session}.put(${2:key}, ${3:value})", + "description": "Adonis Session: Add a key/value pair to the session store.", + "prefix": "session-put" + }, + "session: get session value by key": { + "body": "${1:session}.get(${2:key}, ${3:default})", + "description": "Adonis Session: Get the value for a given key (accepts an optional default value).", + "prefix": "session-get" + }, + "session: get all session data": { + "body": "${1:session}.all()", + "description": "Adonis Session: Get everything back as an object from the session store.", + "prefix": "session-all" + }, + "session: increment session value by key": { + "body": "${1:session}.increment(${2:key}, ${3:steps})", + "description": "Adonis Session: Increment the value for a given key (ensure the previous value is a number).", + "prefix": "session-increment" + }, + "session: decrement session value by key": { + "body": "${1:session}.decrement(${2:key}, ${3:steps})", + "description": "Adonis Session: Decrement the value for a given key (ensure the previous value is a number).", + "prefix": "session-decrement" + }, + "session: forget": { + "body": "${1:session}.forget(${2:key})", + "description": "Adonis Session: Remove a key/value pair from the session store.", + "prefix": "session-forget" + }, + "session: pull": { + "body": "${1:session}.pull(${2:key}, ${3:default})", + "description": "Adonis Session: Get (and then remove) a key/value pair from the session store.", + "prefix": "session-pull" + }, + "session: clear session store": { + "body": "${1:session}.clear()", + "description": "Adonis Session: Empty the session store.", + "prefix": "session-clear" + }, + "session: flash all fields": { + "body": "${1:session}.flashAll()", + "description": "Adonis Session: Flash the request form data.", + "prefix": "session-flash-all" + }, + "session: flash only selected fields": { + "body": "${1:session}.flashOnly([$2,$3])", + "description": "Adonis Session: Flash only the selected fields.", + "prefix": "session-flash-only" + }, + "session: flash except selected fields": { + "body": "${1:session}.flashExcept([$2,$3])", + "description": "Adonis Session: Flash the request form data except the selected fields.", + "prefix": "session-flash-except" + }, + "session: flash with provided errors": { + "body": "${1:session}.withErrors([{$2}])", + "description": "Adonis Session: Flash with an array of errors.", + "prefix": "session-with-errors" + }, + "session: flash": { + "body": "${1:session}.flash({$2})", + "description": "Adonis Session: Flash a custom object.", + "prefix": "session-flash" + }, + "session: commit session": { + "body": "${1:session}.commit($2)", + "description": "Adonis Session: Commit the session manually (usefull when handling exceptions of your own).", + "prefix": "session-commit" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/views.json b/src/snippets/adonis/views.json new file mode 100644 index 0000000..9c828eb --- /dev/null +++ b/src/snippets/adonis/views.json @@ -0,0 +1,12 @@ +{ + "view": { + "body": "${1:view}.render('${3:path.name}')", + "description": "Adonis View: Render an edge view to a client.", + "prefix": "view" + }, + "view: share": { + "body": "${1:view}.share({$3})", + "description": "Adonis View: Share specific request values with views.", + "prefix": "view-share" + } +} \ No newline at end of file diff --git a/src/snippets/adonis/websocket.json b/src/snippets/adonis/websocket.json new file mode 100644 index 0000000..ed96930 --- /dev/null +++ b/src/snippets/adonis/websocket.json @@ -0,0 +1,95 @@ +{ + "websocket:": { + "body": "${1:Ws}.${2|channel,getChannel|}($3)", + "description": "Adonis Websocket", + "prefix": "ws" + }, + "websocket: channel": { + "body": [ + "${1:Ws}.channel(${2:name}, ({ ${3:socket} \\}) => {", + " ${4:// implementation}", + "\\})" + ], + "description": "Adonis Websocket: Register a dynamic function to a socket channel.", + "prefix": "ws-channel" + }, + "websocket: get channel": { + "body": "${1:Ws}.getChannel(${2:name})$0", + "description": "Adonis Websocket: Select a given channel to perform an action on.", + "prefix": "ws-get-channel" + }, + "websocket: middleware": { + "body": [ + "${1:Ws}", + " .channel(${2:name}, ${3:controller})", + " .middleware([${4:middleware},$5])$0" + ], + "description": "Adonis Websocket: Register a middleware to a channel.", + "prefix": "ws-middleware" + }, + // Socket events + "socket:": { + "body": "${1:socket}.${2|on,emit,emitTo,broadcast,broadcastToAllon,emit,close|}($3)", + "description": "Adonis Websocket (Server API)", + "prefix": "socket" + }, + "socket: on": { + "body": [ + "${1:socket}.on('${2|close,error|}', ${3:() => {", + " // implementation", + "\\}})" + ], + "description": "Adonis Websocket (Server API): Subscribe to available socket events (error, close).", + "prefix": "socket-on" + }, + "socket: on close": { + "body": [ + "${1:socket}.on('close', ${2:() => {", + " // implementation", + "\\}})" + ], + "description": "Adonis Websocket (Server API): Invoked when a subscription is closed.", + "prefix": "socket-on-close" + }, + "socket: on error": { + "body": [ + "${1:socket}.on('error', ${2:() => {", + " // implementation", + "\\}})" + ], + "description": "Adonis Websocket (Server API): Invoked when an error is received.", + "prefix": "socket-on-error" + }, + // Socket methods + "socket: emit": { + "body": "${1:socket}.emit(${2:event}, ${3:data}, ${4:[ackCallback]})", + "description": "Adonis Websocket (Server API): Emit event to the connected client.", + "prefix": "socket-emit" + }, + "socket: emit to": { + "body": "${1:socket}.emitTo(${2:event}, ${3:data}, ${4:[socketIds]})", + "description": "Adonis Websocket (Server API): Emit event to an array of socket ids.", + "prefix": "socket-emit-to" + }, + "socket: broadcast": { + "body": "${1:socket}.broadcast(${2:event}, ${3:data})", + "description": "Adonis Websocket (Server API): Emit event to everyone except yourself.", + "prefix": "socket-broadcast" + }, + "socket: broadcast to all": { + "body": "${1:socket}.broadcastToAll(${2:event}, ${3:data})", + "description": "Adonis Websocket (Server API): Emit event to everyone including yourself.", + "prefix": "socket-broadcastToAll" + }, + "socket: close": { + "body": "${1:socket}.close()", + "description": "Adonis Websocket (Server API): Forcefully close a subscription from the server.", + "prefix": "socket-close" + }, + // Socket properties + "socket: properties": { + "body": "${1:socket}.${2|id,topic,connection|}", + "description": "Adonis Websocket (Server API) - Read-only socket prorities.", + "prefix": "socket-props" + } +} \ No newline at end of file diff --git a/src/snippets/combine.ts b/src/snippets/combine.ts new file mode 100644 index 0000000..8cef069 --- /dev/null +++ b/src/snippets/combine.ts @@ -0,0 +1,27 @@ +const fs = require("fs"); +const path = require("path"); +const snippetFolders = ["adonis", "edge"]; +const jsonCommentRegex = new RegExp(/(\n\s+\/\/.*)/, "gi"); +const snippetsParentDir = path.join(__dirname, "../../src/snippets"); + +for (const snippetFolder of snippetFolders) { + const snippets: any[] = []; + const dir = path.join(snippetsParentDir, snippetFolder); + + for (const file of fs.readdirSync(dir)) { + const filePath = path.join(dir, file); + const json = fs + .readFileSync(filePath) + .toString("utf8") + .replace(jsonCommentRegex, "") + .trim(); + + snippets.push(JSON.parse(json)); + const output = path.join( + snippetsParentDir, + "output", + `${snippetFolder}.json` + ); + fs.writeFileSync(output, JSON.stringify(snippets)); + } +} diff --git a/src/snippets/edge/base.json b/src/snippets/edge/base.json new file mode 100644 index 0000000..a03c5bb --- /dev/null +++ b/src/snippets/edge/base.json @@ -0,0 +1,83 @@ +{ + "edge: {{ css('path') }}": { + "prefix": "css", + "body": "{{ css('$1') }}", + "description": "Adonis - make css link" + }, + "edge: {{ script ('path') }}": { + "prefix": "script", + "body": "{{ script('$1') }}", + "description": "Adonis - make script link" + }, + "edge: {{ assetsUrl('path') }}": { + "prefix": "assetsUrl", + "body": "{{ assetsUrl('$1') }}", + "description": "Adonis - make asset link" + }, + "edge: {{ route('name', params = {}) }}": { + "prefix": "route", + "body": "{{ route('$1', { $2 }) }}", + "description": "Adonis - make link from route" + }, + "edge: {{ url }}": { + "prefix": "url", + "body": "{{ url }}", + "description": "Adonis - current url" + }, + "edge: {{ auth.user }}": { + "prefix": "auth-user", + "body": "{{ auth.user$1 }}$0", + "description": "Adonis - current auth user" + }, + "edge: {{ csrfField() }}": { + "prefix": "csrf", + "body": "{{ csrfField() }}", + "description": "Adonis - csrf field" + }, + "edge: {{ cspMeta() }}": { + "prefix": "cspMeta", + "body": "{{ cspMeta() }}", + "description": "Adonis - meta tag" + }, + "edge: @loggedIn ... @else ... @endLoggedIn": { + "prefix": "logged-in", + "body": [ + "@loggedIn", + " $1", + "@else", + " $2", + "@endloggedIn" + ], + "description": "Edge - @loggedIn else block" + }, + "edge: {{ old(key, default) }}": { + "prefix": "old", + "body": "{{ old($1, $2) }}", + "description": "Edge View - returns the value for a given key from the flash store" + }, + "edge: {{ hasErrorFor(key) }}": { + "prefix": "has-error-for", + "body": "{{ hasErrorFor($1) }}", + "description": "Edge View - returns true if there is an error for a given field inside the flash store" + }, + "edge: {{ getErrorFor(key) }}": { + "prefix": "get-error-for", + "body": "{{ getErrorFor($1) }}", + "description": "Edge View - returns the error message for a given field" + }, + "edge: {{ flashMessage(key, default) }}": { + "prefix": "flash", + "body": "{{ flashMessage(${1:key}, ${2:default}) }}", + "description": "Edge View - returns the error message for a given field" + }, + "edge: {{ auth }}": { + "prefix": "auth", + "body": "{{ auth$1 }}", + "description": "Edge View - authenticated object" + }, + "edge: {{ antl }}": { + "prefix": "antl", + "body": "{{ antl.${1|formatNumber,formatRelative,formatDate,formatAmount,formatMessage|}($3) }}", + "description": "Edge Localizalisation - antl" + } +} \ No newline at end of file diff --git a/src/snippets/edge/comment.json b/src/snippets/edge/comment.json new file mode 100644 index 0000000..3fbd5ad --- /dev/null +++ b/src/snippets/edge/comment.json @@ -0,0 +1,28 @@ +{ + "edge: comment": { + "prefix": "comment", + "body": [ + "{{-- ${1:comment} --}}", + "$2" + ], + "description": "Edge: Comment block" + }, + "edge: multiline comment": { + "prefix": "comment-multiline", + "body": [ + "{{-- ", + " ${1:comment}", + "--}}", + "$2" + ], + "description": "Edge: Multiline comment block" + }, + "html: comment": { + "prefix": "html-comment", + "body": [ + "", + "$2" + ], + "description": "HTML: Comment block" + } +} \ No newline at end of file diff --git a/src/snippets/edge/components.json b/src/snippets/edge/components.json new file mode 100644 index 0000000..432c9cf --- /dev/null +++ b/src/snippets/edge/components.json @@ -0,0 +1,26 @@ +{ + "edge: @include('view')": { + "prefix": "include", + "body": "@include('${1:name}')$2", + "description": "Edge: Include view" + }, + "edge: @super": { + "prefix": "super", + "body": "@super", + "description": "Edge: Super extend" + }, + "edge: @!component('name')": { + "prefix": "component", + "body": "@!component('$1')", + "description": "Edge: Component self close" + }, + "edge: @component('name') ... @endcomponent": { + "prefix": "component-block", + "body": [ + "@component('$1')", + " $2", + "@endcomponent" + ], + "description": "Edge: Component block" + } +} \ No newline at end of file diff --git a/src/snippets/edge/conditionals.json b/src/snippets/edge/conditionals.json new file mode 100644 index 0000000..50a3e1e --- /dev/null +++ b/src/snippets/edge/conditionals.json @@ -0,0 +1,46 @@ +{ + "edge: @if (...)": { + "prefix": "if", + "body": [ + "@if($1)", + " $2", + "@endif" + ], + "description": "Edge: if block" + }, + "edge: @if (...) ... @else ... @endif": { + "prefix": "ifelse", + "body": [ + "@if($1)", + " $2", + "@else", + " $3", + "@endif" + ], + "description": "Edge: if-else block" + }, + "edge: @if (...) ... @elseif (...) ... @else ... @endif": { + "prefix": "ifelseif", + "body": [ + "@if($1)", + " $2", + "@elseif($3)", + " $4", + "@else", + " $5", + "@endif" + ], + "description": "Edge: if-else block" + }, + "edge: @unless (...) ... @else ... @endunless": { + "prefix": "unless", + "body": [ + "@unless($1)", + " $2", + "@else", + " $3", + "@endunless" + ], + "description": "Edge: unless-block" + } +} \ No newline at end of file diff --git a/src/snippets/edge/debugger.json b/src/snippets/edge/debugger.json new file mode 100644 index 0000000..703854a --- /dev/null +++ b/src/snippets/edge/debugger.json @@ -0,0 +1,10 @@ +{ + "edge: @debugger": { + "prefix": "debugger", + "body": [ + "@debugger", + "$0" + ], + "description": "Edge: Debug block" + } +} \ No newline at end of file diff --git a/src/snippets/edge/echo.json b/src/snippets/edge/echo.json new file mode 100644 index 0000000..b0036f4 --- /dev/null +++ b/src/snippets/edge/echo.json @@ -0,0 +1,17 @@ +{ + "edge: {{ text }}": { + "prefix": "echo", + "body": "{{ ${1:data} }}$2", + "description": "Edge: Echo data" + }, + "edge: {{{ text }}}": { + "prefix": "echo-html", + "body": "{{{ ${1:html_data} }}}$2", + "description": "Edge: Echo unescaped data (allow html outputs)" + }, + "edge: @{{ text }}": { + "prefix": "echo-raw", + "body": "@{{ ${1:variable} }}$2", + "description": "Edge: Echo untouched data (allow javascript expression)" + } +} \ No newline at end of file diff --git a/src/snippets/edge/globals.json b/src/snippets/edge/globals.json new file mode 100644 index 0000000..871c384 --- /dev/null +++ b/src/snippets/edge/globals.json @@ -0,0 +1,87 @@ +{ + "edge: range(from, to)": { + "prefix": "range", + "body": "{{ range($1, $2) }}", + "description": "Edge: Returns an array of numbers within a given range" + }, + "edge: batch(array)": { + "prefix": "batch", + "body": "{{ batch([ $1 ]) }}", + "description": "Edge: Convert an array to a batch of nested arrays." + }, + "edge: toJSON(object)": { + "prefix": "toJSON", + "body": "{{ toJSON({ $1 }) }}", + "description": "Edge: Convert an object to a JSON string via JSON.stringify." + }, + "edge: first(array)": { + "prefix": "first", + "body": "{{ first([ $1 ]) }}", + "description": "Edge: Returns the first item from an array." + }, + "edge: last(array)": { + "prefix": "last", + "body": "{{ last([ $1 ]) }}", + "description": "Edge: Returns the last item from an array." + }, + "edge: groupBy(array)": { + "prefix": "groupBy", + "body": "{{ groupBy([ $1 ], '$2') }}", + "description": "Edge: Group an array via given field. For example group all articles for an author." + }, + "edge: size(array)": { + "prefix": "size", + "body": "{{ size($1) }}", + "description": "Edge: Return size of a string or an array." + }, + "edge: el(...)": { + "prefix": "el", + "body": "{{ el($1) }}", + "description": "Edge: Returns an HTML string by replacing dynamic placeholders with actual content. It is helpful inside if shorthand." + }, + "edge: camelCase(text)": { + "prefix": "camelCase", + "body": "{{ camelCase('$1') }}", + "description": "Edge: Convert string to camelcase." + }, + "edge: upperCase(text)": { + "prefix": "upperCase", + "body": "{{ upperCase('$1') }}", + "description": "Edge: Convert string to uppercase." + }, + "edge: upperFirst(text)": { + "prefix": "upperFirst", + "body": "{{ upperFirst('$1') }}", + "description": "Edge: Convert first character of a string to uppercase." + }, + "edge: lowerCase(text)": { + "prefix": "lowerCase", + "body": "{{ lowerCase('$1') }}", + "description": "Edge: Convert string to lowerCase." + }, + "edge: lowerFirst(text)": { + "prefix": "lowerFirst", + "body": "{{ lowerFirst('$1') }}", + "description": "Edge: Convert first character of a string to lowercase." + }, + "edge: capitalize(text)": { + "prefix": "capitalize", + "body": "{{ capitalize('$1') }}", + "description": "Edge: Convert first character of all words inside a string to uppercase." + }, + "edge: truncate (text1, limit, ...)": { + "prefix": "truncate", + "body": "{{ truncate('$1', $2, '...') }}", + "description": "Edge: Truncate a string to a given limit" + }, + "edge: toAnchor(url, title = url)": { + "prefix": "toAnchor", + "body": "{{ toAnchor('$1', '$2') }}", + "description": "Edge: Convert a url to an anchor tag" + }, + "edge: urlEncode(string)": { + "prefix": "urlEncode", + "body": "{{ urlEncode('$1') }}", + "description": "Edge: Encode a string to be url safe." + } +} \ No newline at end of file diff --git a/src/snippets/edge/iteration.json b/src/snippets/edge/iteration.json new file mode 100644 index 0000000..1c378d0 --- /dev/null +++ b/src/snippets/edge/iteration.json @@ -0,0 +1,90 @@ +{ + "edge: @each(item as collection) ... @endeach": { + "prefix": "each-array", + "body": [ + "@each(${1:item} as ${2:collection})", + " $3", + "@endeach" + ], + "description": "Edge: @each array block" + }, + "edge: @each( (key, value) in object) ... @endeach": { + "prefix": "each-object", + "body": [ + "@each(${1:key}, ${2:value} in ${3:object})", + " $3", + "@endeach" + ], + "description": "Edge: @each array block" + }, + "edge: @each (item in collection) ... @endeach": { + "prefix": "each-in", + "body": [ + "@each(${1:item} in ${2:collection})", + " $3", + "@endeach" + ], + "description": "Edge: @each else block" + }, + "edge: @each(item in collection) ... @else ... @endeach": { + "prefix": "each-else", + "body": [ + "@each(${1:item} in ${2:collection})", + " $3", + "@else", + " $4", + "@endeach" + ], + "description": "Edge: @each else block" + }, + "edge: $loop.index": { + "prefix": "loop-index", + "body": "\\$loop.${1:index}$2", + "description": "Edge: Holds the iteration index, start from 0" + }, + "edge: $loop.total": { + "prefix": "loop-total", + "body": "\\$loop.${1:total}$2", + "description": "Edge: The total number of items" + }, + "edge: @if($loop.first) ... @endif": { + "prefix": "loop-first", + "body": [ + "@if(\\$loop.first)", + " ${1:{{-- This is the first iteration --\\}\\}}", + "@endif", + "$2" + ], + "description": "Edge: Whether or not the item is the first in the loop" + }, + "edge: @if($loop.last) ... @endif": { + "prefix": "loop-last", + "body": [ + "@if(\\$loop.last)", + " ${1:{{-- This is the last iteration --\\}\\}}", + "@endif", + "$2" + ], + "description": "Edge: Whether or not the item is the last in the loop" + }, + "edge: @if(loop.isEven) ... @endif": { + "prefix": "loop-isEven", + "body": [ + "@if(\\$loop.isEven)", + " ${1:{{-- This is the isEven code --\\}\\}}", + "@endif", + "$2" + ], + "description": "Edge: Whether or not an iteration count is an even number" + }, + "edge: @if($loop.isOdd) ... @endif": { + "prefix": "loop-isOdd", + "body": [ + "@if(\\$loop.isOdd)", + " ${1:{{-- This is the isOdd code --\\}\\}}", + "@endif", + "$2" + ], + "description": "Edge: Whether or not an iteration count is an odd number. The first item returns true for isOdd" + } +} \ No newline at end of file diff --git a/src/snippets/edge/layout.json b/src/snippets/edge/layout.json new file mode 100644 index 0000000..fd42320 --- /dev/null +++ b/src/snippets/edge/layout.json @@ -0,0 +1,26 @@ +{ + "edge: @layout('view')": { + "prefix": "layout", + "body": "@layout('${1:name}')", + "description": "Edge: Layout view" + }, + "edge: @extend('layout')": { + "prefix": "extends", + "body": "@extends('${1:name}')$2", + "description": "Edge: Extends view layout" + }, + "edge: @section('block') ... @endsection": { + "prefix": "section-block", + "body": [ + "@section('${1:name}')", + " $2", + "@endsection" + ], + "description": "Edge: Section block" + }, + "edge: @!section('block')": { + "prefix": "section", + "body": "@!section('${1:name}')", + "description": "Edge: Section no default" + } +} \ No newline at end of file diff --git a/src/snippets/edge/partials.json b/src/snippets/edge/partials.json new file mode 100644 index 0000000..a32e271 --- /dev/null +++ b/src/snippets/edge/partials.json @@ -0,0 +1,7 @@ +{ + "edge: @!each(item in collection, include = 'partial')": { + "prefix": "each-include", + "body": "@!each(${1:item} in ${2:collection}, include = '${3:partial}')$4", + "description": "Edge: @each include" + } +} \ No newline at end of file diff --git a/src/snippets/edge/rawOuput.json b/src/snippets/edge/rawOuput.json new file mode 100644 index 0000000..1dea905 --- /dev/null +++ b/src/snippets/edge/rawOuput.json @@ -0,0 +1,11 @@ +{ + "edge: @raw ... @endraw": { + "prefix": "raw", + "body": [ + "@raw", + " $1", + "@endraw" + ], + "description": "Edge: echo untouched data (allow javascript expression)" + } +} \ No newline at end of file diff --git a/src/snippets/edge/svg.json b/src/snippets/edge/svg.json new file mode 100644 index 0000000..8d0d40e --- /dev/null +++ b/src/snippets/edge/svg.json @@ -0,0 +1,7 @@ +{ + "edge: @inlineSvg('path')": { + "prefix": "inlineSvg", + "body": "@inlineSvg('${1:name}')$2", + "description": "Edge: Inline Svg" + } +} \ No newline at end of file diff --git a/src/snippets/edge/yield.json b/src/snippets/edge/yield.json new file mode 100644 index 0000000..b6030a3 --- /dev/null +++ b/src/snippets/edge/yield.json @@ -0,0 +1,11 @@ +{ + "edge: @yield('value') ... @endyield": { + "prefix": "yield", + "body": [ + "@yield('$1')", + " $2", + "@endyield" + ], + "description": "Edge: yield slot" + } +} \ No newline at end of file diff --git a/src/snippets/output/adonis.json b/src/snippets/output/adonis.json new file mode 100644 index 0000000..332018f --- /dev/null +++ b/src/snippets/output/adonis.json @@ -0,0 +1 @@ +[{"ally":{"body":"ally.driver('${1:facebook}').${2|getUser,redirect,getRedirectUrl|}();","description":"Adonis Ally","prefix":"ally"},"ally: redirect":{"body":"ally.driver('${1:facebook}').redirect();","description":"Adonis Ally: Redirect user to the 3rd party website","prefix":"ally-redirect"},"ally: get redirect url":{"body":"ally.driver('${1:facebook}').getRedirectUrl();","description":"Adonis Ally: Get redirect URL back as a string","prefix":"ally-get-redirect-url"},"ally: with scope":{"body":"ally.driver('${1:facebook}').scope(['$2',$3]).${4|getUser,redirect,getRedirectUrl|}();","description":"Adonis Ally: Define runtime scopes before redirecting the user","prefix":"ally-scope"},"ally: with fields":{"body":"ally.driver('${1:facebook}').fields(['$2',$3]).${4|getUser,redirect,getRedirectUrl|}();","description":"Adonis Ally: Fields to be fetched when getting the authenticated user profile","prefix":"ally-fields"},"ally: get user":{"body":"ally.driver('${1:facebook}').fields(['$2',$3]).getUser();","description":"Adonis Ally: Get the user profile of an authenticated user (returns an AllyUser instance)","prefix":"ally-get-user"},"ally: by access token":{"body":"ally.getUserByToken($1);","description":"Adonis Ally: Get the user details using the accessToken","prefix":"ally-by-token"},"ally: user":{"body":"${1:user}.${2|getName,getEmail,getNickname,getAvatar,getAccessToken,getRefreshToken,getExpires,getTokenSecret,getOriginal|}();","description":"Adonis Ally User","prefix":"ally-user"},"ally: get name for user":{"body":"${1:user}.getName()","description":"Adonis Ally User: Get the user name","prefix":"ally-user-name"},"ally: get email for user":{"body":"${1:user}.getEmail()","description":"Adonis Ally User: Get the user email","prefix":"ally-user-email"},"ally: get nickname for user":{"body":"${1:user}.getNickname()","description":"Adonis Ally User: Get the nickname / display name of the user","prefix":"ally-user-nickname"},"ally: get avatar for user":{"body":"${1:user}.getAvatar()","description":"Adonis Ally User: Get the public URL to the user’s profile picture","prefix":"ally-user-avatar"},"ally: get access token for user":{"body":"${1:user}.getAccessToken()","description":"Adonis Ally User: Get the access token which may be used later to update the user profile","prefix":"ally-user-token"},"ally: get refresh token for user":{"body":"${1:user}.getRefreshToken()","description":"Adonis Ally User: Get token to be used when access token expires","prefix":"ally-user-rtoken"},"ally: get expires for user":{"body":"${1:user}.getExpires()","description":"Adonis Ally User: Access token expiry data","prefix":"ally-user-expires"},"ally: get token secret for user":{"body":"${1:user}.getTokenSecret()","description":"Adonis Ally User: ","prefix":"ally-user-stoken"},"ally: get original 3rd party payload for user":{"body":"${1:user}.getOriginal()","description":"Adonis Ally User: Get original payload returned by the 3rd party provider","prefix":"ally-user-original"}},{"Antl":{"body":"${1:Antl}.${2|currentLocale,defaultLocale,formatMessage,formatNumber,formatAmount,formatDate,formatRelative,forLocale,bootLoader,loader,switchLocale|}($3)","description":"Adonis Antl","prefix":"antl"},"antl: current locale":{"body":"${1:Antl}.currentLocale()","description":"Adonis Antl: Get the current locale of antl","prefix":"antl-locale-current"},"antl: default locale":{"body":"${1:Antl}.defaultLocale()","description":"Adonis Antl: Get the default locale of antl","prefix":"antl-locale"},"antl: format message":{"body":"${1:Antl}.formatMessage(${2:key}, ${3:data}, ${4:format})","description":"Adonis Antl: format a message usign the default locale","prefix":"antl-fmessage"},"antl: format number":{"body":"${1:Antl}.formatNumber(${2:value}, ${3:options = {\\}})","description":"Adonis Antl: Format value as a number (accepts NumberFormat options as defined [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat))","prefix":"antl-fnumber"},"antl: format amount":{"body":"${1:Antl}.formatAmount(${2:value}, ${3:currency}, ${4:options = {\\}})","description":"Adonis Antl: Format value with style set to currency","prefix":"antl-famount"},"antl: format date":{"body":"${1:Antl}.formatDate(${2:value}, ${3:options = {\\}})","description":"Adonis Antl: Format value as date (accepts DateTimeFormat options as defined [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat))","prefix":"antl-fdate"},"antl: format relative":{"body":"${1:Antl}.formatRelative(${2:value}, ${3:options = {\\}})","description":"Adonis Antl: Format a date relative to the current date/time (accepts RelativeFormat options as defined [here](https://github.com/yahoo/intl-relativeformat#custom-options))","prefix":"antl-frelative"},"antl: for locale":{"body":"${1:Antl}.forLocale('${2:fr}')","description":"Adonis Antl: Switch locale format at runtime","prefix":"antl-for-locale"},"antl: boot loader":{"body":"await ${1:Antl}.bootLoader()","description":"Adonis Antl: Initialize the bootlader","prefix":"antl-boot-loader"},"antl: loader":{"body":"${1:Antl}.loader(${2:loader})","description":"Adonis Antl: Switch between loaders at runtime. Always call `await Antl.bootLoader()` before Antl.loader (you only need to call bootLoader once)","prefix":"antl-loader"},"antl: switch locale for view":{"body":"${1:antl}.switchLocale(${2:key}, ${3:data}, ${4:format})","description":"Adonis Antl: Switch locale for view","prefix":"antl-switch-locale"},"antl: add format":{"body":["${1:Format}.add(${2:key}, {"," style: '$3'"," ${4:currency}: '$5'}","\\})$0"],"description":"Adonis Antl: Add a new localisation format","prefix":"antl-format-add"}},{"assert: fail":{"body":"${1:assert}.fail(${2:actual}, ${3:expected}, ${4:[message]}, ${5:[operator]})","description":"Adonis Assert: Throw a failure. Node.js assert module-compatible.","prefix":"assert-fail"},"assert: is ok":{"body":"${1:assert}.isOk(${2:object}, ${3:[message]})","description":"Adonis Assert: Asserts that object is truthy.","prefix":"assert-ok"},"assert: is not ok":{"body":"${1:assert}.isNotOk(${2:object}, ${3:[message]})","description":"Adonis Assert: Asserts that object is falsy.","prefix":"assert-not-ok"},"assert: equal":{"body":"${1:assert}.equal(${2:actual}, ${3:expected}, ${4:[message]})","description":"Adonis Assert: Asserts non-strict equality (==) of actual and expected.","prefix":"assert-equal"},"assert: not equal":{"body":"${1:assert}.notEqual(${2:actual}, ${3:expected}, ${4:[message]})","description":"Adonis Assert: Asserts non-strict inequality (!=) of actual and expected.","prefix":"assert-not-equal"},"assert: strict equal":{"body":"${1:assert}.strictEqual(${2:actual}, ${3:expected}, ${4:[message]})","description":"Adonis Assert: Asserts strict equality (===) of actual and expected.","prefix":"assert-strict-equal"},"assert: not strict equal":{"body":"${1:assert}.notStrictEqual(${2:actual}, ${3:expected}, ${4:[message]})","description":"Adonis Assert: Asserts strict inequality (!==) of actual and expected.","prefix":"assert-not-strict-equal"},"assert: deep equal":{"body":"${1:assert}.deepEqual(${2:actual}, ${3:expected}, ${4:[message]})","description":"Adonis Assert: Asserts that actual is deeply equal to expected.","prefix":"assert-deep-equal"},"assert: not deep equal":{"body":"${1:assert}.notDeepEqual(${2:actual}, ${3:expected}, ${4:[message]})","description":"Adonis Assert: Asserts that actual is deeply equal to expected.","prefix":"assert-not-deep-equal"},"assert: is above":{"body":"${1:assert}.isAbove(${2:valueToCheck}, ${3:valueToBeAbove}, ${4:[message]})","description":"Adonis Assert: Asserts valueToCheck is strictly greater than (>) valueToBeAbove.","prefix":"assert-above"},"assert: is at least":{"body":"${1:assert}.isAtLeast(${2:valueToCheck}, ${3:valueToBeAtLeast}, ${4:[message]})","description":"Adonis Assert: Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast.","prefix":"assert-at-Least"},"assert: is below":{"body":"${1:assert}.isBelow(${2:valueToCheck}, ${3:valueToBeBelow}, ${4:[message]})","description":"Adonis Assert: Asserts valueToCheck is strictly less than (<) valueToBeBelow.","prefix":"assert-below"},"assert: is at most":{"body":"${1:assert}.isAtMost(${2:valueToCheck}, ${3:valueToBeAtMost}, ${4:[message]})","description":"Adonis Assert: Asserts valueToCheck is less than or equal to (<=) valueToBeAtMost.","prefix":"assert-at-most"},"assert: is true":{"body":"${1:assert}.isTrue(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is true.","prefix":"assert-true"},"assert: is not true":{"body":"${1:assert}.isNotTrue(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is not true.","prefix":"assert-not-true"},"assert: is false":{"body":"${1:assert}.isFalse(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is false.","prefix":"assert-false"},"assert: is not false":{"body":"${1:assert}.isNotFalse(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is not false.","prefix":"assert-not-false"},"assert: is null":{"body":"${1:assert}.isNull(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is null.","prefix":"assert-null"},"assert: is not null":{"body":"${1:assert}.isNotNull(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is not null.","prefix":"assert-not-null"},"assert: is NaN":{"body":"${1:assert}.isNaN(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is NaN.","prefix":"assert-nan"},"assert: is not NaN":{"body":"${1:assert}.isNotNaN(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is not NaN.","prefix":"assert-not-nan"},"assert: exists":{"body":"${1:assert}.exists(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that the target is neither null nor undefined.","prefix":"assert-exists"},"assert: not exists":{"body":"${1:assert}.notExists(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that the target is either null or undefined.","prefix":"assert-not-exists"},"assert: is undefined":{"body":"${1:assert}.isUndefined(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is undefined.","prefix":"assert-undefined"},"assert: is defined":{"body":"${1:assert}.isDefined(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is not undefined.","prefix":"assert-defined"},"assert: is function":{"body":"${1:assert}.isFunction(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is a function.","prefix":"assert-function"},"assert: is not function":{"body":"${1:assert}.isNotFunction(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is not a function.","prefix":"assert-not-function"},"assert: is object":{"body":"${1:assert}.isObject(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is an object of type ‘Object’ (as revealed by Object.prototype.toString). The assertion does not match subclassed objects.","prefix":"assert-object"},"assert: is not object":{"body":"${1:assert}.isNotObject(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is not an object of type ‘Object’ (as revealed by Object.prototype.toString).","prefix":"assert-not-object"},"assert: is array":{"body":"${1:assert}.isArray(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is an array.","prefix":"assert-array"},"assert: is not array":{"body":"${1:assert}.isNotArray(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is not an array.","prefix":"assert-not-array"},"assert: is string":{"body":"${1:assert}.isString(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is a string.","prefix":"assert-string"},"assert: is not string":{"body":"${1:assert}.isNotString(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is not a string.","prefix":"assert-not-string"},"assert: is number":{"body":"${1:assert}.isNumber(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is a number.","prefix":"assert-number"},"assert: is not number":{"body":"${1:assert}.isNotNumber(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is not a number.","prefix":"assert-not-number"},"assert: is finite":{"body":"${1:assert}.isFinite(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is a finite number. Unlike .isNumber, this will fail for NaN and Infinity.","prefix":"assert-finite"},"assert: is boolean":{"body":"${1:assert}.isBoolean(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is a boolean.","prefix":"assert-boolean"},"assert: is not boolean":{"body":"${1:assert}.isNotBoolean(${2:value}, ${3:[message]})","description":"Adonis Assert: Asserts that value is not a boolean.","prefix":"assert-not-boolean"},"assert: type of":{"body":"${1:assert}.typeOf(${2:value}, ${3:name}, ${4:[message]})","description":"Adonis Assert: Asserts that value’s type is name, as determined by Object.prototype.toString.","prefix":"assert-typeof"},"assert: not type of":{"body":"${1:assert}.notTypeOf(${2:value}, ${3:name}, ${4:[message]})","description":"Adonis Assert: Asserts that value’s type is not name, as determined by Object.prototype.toString.","prefix":"assert-not-typeof"},"assert: instance of":{"body":"${1:assert}.instanceOf(${2:object}, ${3:constructor}, ${4:[message]})","description":"Adonis Assert: Asserts that value is an instance of constructor.","prefix":"assert-instanceof"},"assert: not instance of":{"body":"${1:assert}.notInstanceOf(${2:object}, ${3:constructor}, ${4:[message]})","description":"Adonis Assert: Asserts value is not an instance of constructor.","prefix":"assert-not-instanceof"},"assert: include":{"body":"${1:assert}.include(${2:haystack}, ${3:needle}, ${4:[message]})","description":"Adonis Assert: Asserts that haystack includes needle. Can be used to assert the inclusion of a value in an array, a substring in a string, or a subset of properties in an object.","prefix":"assert-include"},"assert: not include":{"body":"${1:assert}.notInclude(${2:haystack}, ${3:needle}, ${4:[message]})","description":"Adonis Assert: Asserts that haystack does not include needle. Can be used to assert the absence of a value in an array, a substring in a string, or a subset of properties in an object.","prefix":"assert-not-include"},"assert: deep include":{"body":"${1:assert}.deepInclude(${2:haystack}, ${3:needle}, ${4:[message]})","description":"Adonis Assert: Asserts that haystack includes needle. Can be used to assert the inclusion of a value in an array or a subset of properties in an object. Deep equality is used.","prefix":"assert-deep-include"},"assert: not deep include":{"body":"${1:assert}.notDeepInclude(${2:haystack}, ${3:needle}, ${4:[message]})","description":"Adonis Assert: Asserts that haystack does not include needle. Can be used to assert the absence of a value in an array or a subset of properties in an object. Deep equality is used.","prefix":"assert-not-deep-include"},"assert: nested include":{"body":"${1:assert}.nestedInclude(${2:haystack}, ${3:needle}, ${4:[message]})","description":"Adonis Assert: Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object. Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.","prefix":"assert-nested-include"},"assert: not nested include":{"body":"${1:assert}.notNestedInclude(${2:haystack}, ${3:needle}, ${4:[message]})","description":"Adonis Assert: Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object. Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.","prefix":"assert-not-nested-include"},"assert: deep nested include":{"body":"${1:assert}.deepNestedInclude(${2:haystack}, ${3:needle}, ${4:[message]})","description":"Adonis Assert: Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while checking for deep equality. Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.","prefix":"assert-deep-nested-include"},"assert: not deep nested include":{"body":"${1:assert}.notDeepNestedInclude(${2:haystack}, ${3:needle}, ${4:[message]})","description":"Adonis Assert: Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object while checking for deep equality. Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.","prefix":"assert-not-deep-nested-include"},"assert: own include":{"body":"${1:assert}.ownInclude(${2:haystack}, ${3:needle}, ${4:[message]})","description":"Adonis Assert: Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties.","prefix":"assert-own-include"},"assert: not own include":{"body":"${1:assert}.notOwnInclude(${2:haystack}, ${3:needle}, ${4:[message]})","description":"Adonis Assert: Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties.","prefix":"assert-not-own-include"},"assert: deep own include":{"body":"${1:assert}.deepOwnInclude(${2:haystack}, ${3:needle}, ${4:[message]})","description":"Adonis Assert: Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties and checking for deep equality.","prefix":"assert-deep-own-include"},"assert: not deep own include":{"body":"${1:assert}.notDeepOwnInclude(${2:haystack}, ${3:needle}, ${4:[message]})","description":"Adonis Assert: Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties and checking for deep equality.","prefix":"assert-not-deep-own-include"},"assert: match":{"body":"${1:assert}.match(${2:value}, ${3:regexp}, ${4:[message]})","description":"Adonis Assert: Asserts that value matches the regular expression regexp.","prefix":"assert-match"},"assert: not match":{"body":"${1:assert}.notMatch(${2:value}, ${3:regexp}, ${4:[message]})","description":"Adonis Assert: Asserts that value does not match the regular expression regexp.","prefix":"assert-not-match"},"assert: property":{"body":"${1:assert}.property(${2:object}, ${3:property}, ${4:[message]})","description":"Adonis Assert: Asserts that object has a direct or inherited property named by property.","prefix":"assert-property"},"assert: not property":{"body":"${1:assert}.notProperty(${2:object}, ${3:property}, ${4:[message]})","description":"Adonis Assert: Asserts that object does not have a direct or inherited property named by property.","prefix":"assert-not-property"},"assert: property val":{"body":"${1:assert}.propertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})","description":"Adonis Assert: Asserts that object has a direct or inherited property named by property with a value given by value. Uses a strict equality check (===).","prefix":"assert-property-val"},"assert: not property val":{"body":"${1:assert}.notPropertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})","description":"Adonis Assert: Asserts that object does not have a direct or inherited property named by property with value given by value. Uses a strict equality check (===).","prefix":"assert-not-property-val"},"assert: deep property val":{"body":"${1:assert}.deepPropertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})","description":"Adonis Assert: Asserts that object has a direct or inherited property named by property with a value given by value. Uses a deep equality check.","prefix":"assert-deep-property-val"},"assert: not deep property val":{"body":"${1:assert}.notDeepPropertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})","description":"Adonis Assert: Asserts that object does not have a direct or inherited property named by property with value given by value. Uses a deep equality check.","prefix":"assert-not-deepPropertyVal"},"assert: nested property":{"body":"${1:assert}.nestedProperty(${2:object}, ${3:property}, ${4:[message]})","description":"Adonis Assert: Asserts that object has a direct or inherited property named by property, which can be a string using dot- and bracket-notation for nested reference.","prefix":"assert-nested-property"},"assert: not nested property":{"body":"${1:assert}.notNestedProperty(${2:object}, ${3:property}, ${4:[message]})","description":"Adonis Assert: Asserts that object does not have a property named by property, which can be a string using dot- and bracket-notation for nested reference. The property cannot exist on the object nor anywhere in its prototype chain.","prefix":"assert-not-nested-property"},"assert: nested property val":{"body":"${1:assert}.nestedPropertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})","description":"Adonis Assert: Asserts that object has a property named by property with value given by value. property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).","prefix":"assert-nested-property-val"},"assert: not nested property val":{"body":"${1:assert}.notNestedPropertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})","description":"Adonis Assert: Asserts that object does not have a property named by property with value given by value. property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).","prefix":"assert-not-nested-property-val"},"assert: deep nested property val":{"body":"${1:assert}.deepNestedPropertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})","description":"Adonis Assert: Asserts that object has a property named by property with a value given by value. property can use dot- and bracket-notation for nested reference. Uses a deep equality check.","prefix":"assert-deep-nested-property-val"},"assert: not deep nested property val":{"body":"${1:assert}.notDeepNestedPropertyVal(${2:object}, ${3:property}, ${4:value}, ${5:[message]})","description":"Adonis Assert: Asserts that object does not have a property named by property with value given by value. property can use dot- and bracket-notation for nested reference. Uses a deep equality check.","prefix":"assert-not-deep-nested-property-val"},"assert: length of":{"body":"${1:assert}.lengthOf(${2:object}, ${3:length}, ${4:[message]})","description":"Adonis Assert: Asserts that object has a length or size with the expected value.","prefix":"assert-length-of"},"assert: has any keys":{"body":"${1:assert}.hasAnyKeys(${2:object}, ${3:keys}, ${4:[message]})","description":"Adonis Assert: Asserts that object has at least one of the keys provided. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.","prefix":"assert-has-any-keys"},"assert: has all keys":{"body":"${1:assert}.hasAllKeys(${2:object}, ${3:keys}, ${4:[message]})","description":"Adonis Assert: Asserts that object has all and only all of the keys provided. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.","prefix":"assert-has-all-keys"},"assert: contains all keys":{"body":"${1:assert}.containsAllKeys(${2:object}, ${3:keys}, ${4:[message]})","description":"Adonis Assert: Asserts that object has all of the keys provided but may have more keys not listed. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.","prefix":"assert-contains-all-keys"},"assert: does not have any keys":{"body":"${1:assert}.doesNotHaveAnyKeys(${2:object}, ${3:keys}, ${4:[message]})","description":"Adonis Assert: Asserts that object has none of the keys provided. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.","prefix":"assert-does-not-have-any-keys"},"assert: does not have all keys":{"body":"${1:assert}.doesNotHaveAllKeys(${2:object}, ${3:keys}, ${4:[message]})","description":"Adonis Assert: Asserts that object does not have at least one of the keys provided. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.","prefix":"assert-does-not-have-all-keys"},"assert: has any deep keys":{"body":"${1:assert}.hasAnyDeepKeys(${2:object}, ${3:keys}, ${4:[message]})","description":"Adonis Assert: Asserts that object has at least one of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.","prefix":"assert-hasAnyDeepKeys"},"assert: has all deep keys":{"body":"${1:assert}.hasAllDeepKeys(${2:object}, ${3:keys}, ${4:[message]})","description":"Adonis Assert: Asserts that object has all and only all of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.","prefix":"assert-hasAllDeepKeys"},"assert: contains all deep keys":{"body":"${1:assert}.containsAllDeepKeys(${2:object}, ${3:keys}, ${4:[message]})","description":"Adonis Assert: Asserts that object contains all of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.","prefix":"assert-containsAllDeepKeys"},"assert: does not have any deep keys":{"body":"${1:assert}.doesNotHaveAnyDeepKeys(${2:object}, ${3:keys}, ${4:[message]})","description":"Adonis Assert: Asserts that object has none of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.","prefix":"assert-does-not-have-any-deep-keys"},"assert: does not have all deep keys":{"body":"${1:assert}.doesNotHaveAllDeepKeys(${2:object}, ${3:keys}, ${4:[message]})","description":"Adonis Assert: Asserts that object does not have at least one of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.","prefix":"assert-does-not-have-all-deep-keys"},"assert: throws":{"body":"${1:assert}.throws(${2:fn}, ${3:errorLike/string/regexp}, ${4:string/regexp}, ${5:[message]})","description":"Adonis Assert: If errorLike is an Error constructor, asserts that fn will throw an error that is an instance of errorLike. If errorLike is an Error instance, asserts that the error thrown is the same instance as errorLike. If errMsgMatcher is provided, it also asserts that the error thrown will have a message matching errMsgMatcher.","prefix":"assert-throws"},"assert: does not throw":{"body":"${1:assert}.doesNotThrow(${2:fn}, ${3:errorLike/string/regexp}, ${4:string/regexp}, ${5:[message]})","description":"Adonis Assert: If errorLike is an Error constructor, asserts that fn will not throw an error that is an instance of errorLike. If errorLike is an Error instance, asserts that the error thrown is not the same instance as errorLike. If errMsgMatcher is provided, it also asserts that the error thrown will not have a message matching errMsgMatcher.","prefix":"assert-does-not-throw"},"assert: operator":{"body":"${1:assert}.operator(${2:val1}, ${3:operator}, ${4:val2}, ${5:[message]})","description":"Compares two values using operator.","prefix":"assert-operator"}},{"auth:":{"body":"${1:auth}.${2|attempt,login,loginViaId,remember,check,getUser,logout,generate,withRefreshToken,generateForRefreshToken,newRefreshToken,listTokens,authenticator,revokeTokens,revokeTokensForUser|}($3)","description":"Adonis Authentication","prefix":"auth"},"auth: attempt login via session":{"body":"${1:auth}.attempt(${2:uid}, ${3:password})","description":"Adonis Auth: Login via uid and password, throwing an exception if no user is found or the password is invalid:","prefix":"auth-attempt"},"auth: attempt to login":{"body":"${1:auth}.login(${2:user})","description":"Adonis Auth: Login via user model instance, not verify anything but simply marking the user as logged in","prefix":"auth-login"},"auth: login a user via id":{"body":"${1:auth}.loginViaId(${2:id})","description":"Adonis Auth: Login a via user id, querying the database to ensure the user exists","prefix":"auth-via-id"},"auth: remember user session":{"body":"${1:auth}.remember(${2:true}).$5attempt(${3:email}, ${4:password})","description":"Adonis Auth: When calling methods like attempt, login or loginViaId, chain the remember method to ensure users stay logged in after closing their browser","prefix":"auth-remember"},"auth: check if logged in":{"body":"${1:auth}.check()","description":"Adonis Auth: Check if a user is already logged in by reading their session","prefix":"auth-check"},"auth: get logged in user":{"body":"${1:auth}.getUser()","description":"Adonis Auth: Get the logged in user instance (via the check method)","prefix":"auth-get-user"},"auth: logout user":{"body":"${1:auth}.logout()","description":"Adonis Auth: Log out the currently logged in user","prefix":"auth-logout"},"auth: generate jwt token":{"body":"${1:auth}.generate(${2:user}, ${3:jwtPayload}, ${4:jwtOptions})","description":"Adonis Auth: Generate JWT token for a given user","prefix":"auth-generate"},"auth: authenticate and generate refresh token":{"body":"${1:auth}.withRefreshToken().$4attempt(${2:uid}, ${3:password})","description":"Adonis Auth: Instruct the JWT authenticator to generate a refresh token as well","prefix":"auth-with-rtoken"},"auth: generate token from refresh token":{"body":"${1:auth}.generateForRefreshToken(${2:refreshToken}, ${3:jwtPayload})","description":"Adonis Auth: Generate a new JWT token using the refresh token. Passing jwtPayload=true encodes the user object within the token.","prefix":"auth-generate-from-rtoken"},"auth: forcefully generate new token":{"body":"${1:auth}.newRefreshToken().$4generateForRefreshToken(${2:refreshToken}, ${3:jwtPayload})","description":"Adonis Auth: When generating a new jwt token, the auth provider does not reissue a new refresh token and instead uses the old one. If you want, you can also regenerate a new refresh token:","prefix":"auth-new-rtoken"},"auth: get all refresh token for auth user":{"body":"${1:auth}.listTokens()","description":"Adonis Auth: List all tokens for the user (either JWT or API)","prefix":"auth-list-tokens"},"auth: authenticator":{"body":"${1:auth}.authenticator(${2:authenticator})","description":"Adonis Auth: authenticator","prefix":"auth-authenticator"},"auth: revoke API tokens for auth user":{"body":"${1:auth}.revokeTokens(${2:tokens = []}, ${3:delete = false})","description":"Adonis Auth: Revoke all authenticated user API tokens by setting a flag in the tokens table","prefix":"auth-revoke-tokens"},"auth: revoke API tokens for specified user":{"body":"${1:auth}.revokeTokensForUser(${2:user}, ${3:tokens}, ${4:delete = false})","description":"Adonis Auth: Revoke all specified user API tokens.","prefix":"auth-revoke-user-tokens"}},{"database:":{"body":"${1:Database}.${2|table,connection,close,withOutPrefix,on|}($3)","description":"Adonis Database","prefix":"db"},"database: get table":{"body":"${4:await }${1:Database}.table('${2:name}')$3","description":"Adonis Database: Select a database table.","prefix":"db-table"},"database: set connection":{"body":"${1:Database}.connection('${2:mysql}').${3:table}($4)","description":"Adonis Database: Set the db connection to use for query.","prefix":"db-conn"},"database: close specified connection":{"body":"${1:Database}.close(['${2:mysql}', $3])","description":"Adonis Database: Close the specified db connection.","prefix":"db-close"},"database: without prefix":{"body":"${1:Database}.withOutPrefix()","description":"Adonis Database: without prefix","prefix":"db-without-prefix"},"database: on":{"body":"${1:Database}.on('${2:query}', ${3:(param) => {\\}})","description":"Adonis Database: on","prefix":"db-on"},"database: select":{"body":"${5:await }${1:Database}.table('${2:name}').select($3)$4","description":"Adonis Database: Defines the fields to be selected for a given query","prefix":"db-select"},"database: where":{"body":"${5:await }${1:Database}.table('${2:name}').where($3)$4","description":"Adonis Database: sql where","prefix":"db-where"},"database: or Where":{"body":"${6:await }${1:Database}.table('${2:name}').where($3).orWhere($4)$5","description":"Adonis Database: sql where or where","prefix":"db-or-where"},"database: where not":{"body":"${5:await }${1:Database}.table('${2:name}').whereNot($3)$4","description":"Adonis Database: sql where not","prefix":"db-where-not"},"database: where in":{"body":"${6:await }${1:Database}.table('${2:name}').whereIn($3, ${4:ids = []})$5","description":"Adonis Database: sql where in","prefix":"db-where-in"},"database: where not in":{"body":"${6:await }${1:Database}.table('${2:name}').whereNotIn($3, ${4:ids = []})$5","description":"Adonis Database: sql where not in","prefix":"db-where-not-in"},"database: where null":{"body":"${5:await }${1:Database}.table('${2:name}').whereNull($3)$4","description":"Adonis Database: sql where null","prefix":"db-where-null"},"database: where not null":{"body":"${5:await }${1:Database}.table('${2:name}').whereNotNull($3)$4","description":"Adonis Database: sql where not null","prefix":"db-where-not-null"},"database: where exists":{"body":["${6:await }${1:Database}.table('${2:name}').whereExists(function () {"," this.from('$3').where($4)$5","\\})"],"description":"Adonis Database: sql where exists","prefix":"db-where-exists"},"database: where not exists":{"body":["${6:await }${1:Database}.table('${2:name}').whereNotExists(function () {"," this.from('$3').where($4)$5","\\})"],"description":"Adonis Database: sql where not exists","prefix":"db-where-not-exists"},"database: where between":{"body":"${5:await }${1:Database}.table('${2:name}').whereBetween($3)$4","description":"Adonis Database: sql where between","prefix":"db-where-between"},"database: where not between":{"body":"${5:await }${1:Database}.table('${2:name}').whereNotBetween($3)$4","description":"Adonis Database: sql where not between","prefix":"db-where-not-between"},"database: where raw":{"body":"${5:await }${1:Database}.table('${2:name}').whereRaw($3)$4","description":"Adonis Database: sql where raw","prefix":"db-where-raw"},"database: inner join":{"body":"${7:await }${1:Database}.table('${2:name}').innerJoin($3, $4, $5)$6","description":"Adonis Database: sql inner join","prefix":"db-inner-join"},"database: left join":{"body":"${8:await }${1:Database}.select(${2:fields}).from('${3:table}').leftJoin($4, $5, $6)$7","description":"Adonis Database: sql left join","prefix":"db-left-join"},"database: left outer join":{"body":"${8:await }${1:Database}.select(${2:fields}).from('${3:table}').leftOuterJoin($4, $5, $6)$7","description":"Adonis Database: sql left outer join","prefix":"db-left-outer-join"},"database: right join":{"body":"${8:await }${1:Database}.select(${2:fields}).from('${3:table}').rightJoin($4, $5, $6)$7","description":"Adonis Database: sql right join","prefix":"db-right-join"},"database: right outer join":{"body":"${8:await }${1:Database}.select(${2:fields}).from('${3:table}').rightOuterJoin($4, $5, $6)$7","description":"Adonis Database: sql right outer join","prefix":"db-right-outer-join"},"database: outer join":{"body":"${8:await }${1:Database}.select(${2:fields}).from('${3:table}').outerJoin($4, $5, $6)$7","description":"Adonis Database: sql right outer join","prefix":"db-right-outer-join"},"database: full outer join":{"body":"${8:await }${1:Database}.select(${2:fields}).from('${3:table}').fullOuterJoin($4, $5, $6)$7","description":"Adonis Database: sql full outer join","prefix":"db-full-outer-join"},"database: cross join":{"body":"${8:await }${1:Database}.select(${2:fields}).from('${3:table}').crossJoin($4, $5, $6)$7","description":"Adonis Database: sql cross join","prefix":"db-cross-join"},"database: join raw":{"body":"${6:await }${1:Database}.select(${2:fields}).from('${3:table}').joinRaw($4)$5","description":"Adonis Database: sql right outer join","prefix":"db-join-raw"},"database: distinct":{"body":"${5:await }${1:Database}.table('${2:name}').distinct($3)$4","description":"Adonis Database: sql distinct","prefix":"db-distinct"},"database: group by":{"body":"${5:await }${1:Database}.table('${2:name}').groupBy($3)$4","description":"Adonis Database: sql group by","prefix":"db-group-by"},"database: group by raw":{"body":"${6:await }${1:Database}.table('${2:name}').groupByRaw($3, $4)$5","description":"Adonis Database: sql group by raw","prefix":"db-group-by-raw"},"database: order by":{"body":"${6:await }${1:Database}.table('${2:name}').orderBy(${3:column}, '${4:|asc,desc|}')$5","description":"Adonis Database: sql order by","prefix":"db-order-by"},"database: order by raw":{"body":"${5:await }${1:Database}.table('${2:name}').orderByRaw(${3:raw})$4","description":"Adonis Database: sql order by raw","prefix":"db-order-by-raw"},"database: having":{"body":["${8:await }${1:Database}"," .table('${2:name}')"," .groupBy(${3:column})"," .having(${4:column}, ${5:operator}, ${6:value})$7"],"description":"Adonis Database: sql having (N.B. `groupBy()` must be called before `having()` ).","prefix":"db-having"},"database: offset and limit":{"body":["await ${1:Database}"," .table('${2:name}')"," .offset(${3:number})"," .limit(${4:number})$5"],"description":"Adonis Database: sql offset and limit.","prefix":"db-offset-and-limit"},"database: insert":{"body":["await ${1:Database}"," .table('${2:name}')"," .insert(${3:values})$4"],"description":"Adonis Database: Create a row and return its newly created `id`.","prefix":"db-insert"},"database: insert into":{"body":["await ${1:Database}"," .insert(${2:values})"," .into('${3:table}')$4"],"description":"Adonis Database: Create a row and return its newly created `id`.","prefix":"db-insert-into"},"database: PostreSQL - insert into and return column value":{"body":["await ${1:Database}"," .insert(${2:values})"," .into('${3:table}')"," .returning('${4:column}')$5"],"description":"Adonis Database: PostgreSQL - sql insert into and return column value.","prefix":"db-insert-into-return"},"database: update where":{"body":["await ${1:Database}"," .table(${2:name})"," .where(${3:query})"," .update(${4:data})$5"],"description":"Adonis Database: sql update where.","prefix":"db-update"},"database: delete where":{"body":["await ${1:Database}"," .table(${2:name})"," .where(${3:query})"," .delete()"],"description":"Adonis Database: Delete operations also return the number of affected rows.","prefix":"db-delete"},"database: truncate":{"body":"await ${1:Database}.truncate(${2:table})","description":"Adonis Database: sql delete where.","prefix":"db-truncate"},"database: for page":{"body":["await ${1:Database}"," .from(${2:table})"," .forPage(${3:page}, ${4:[limit=20]})"],"description":"Adonis Database: paginate for page.","prefix":"db-for-page"},"database: paginate":{"body":["await ${1:Database}"," .from(${2:table})"," .paginate(${3:page}, ${4:[limit=20]})"],"description":"Adonis Database: paginate.","prefix":"db-paginate"},"database: begin transaction":{"body":"await ${1:Database}.beginTransaction()","description":"Adonis Database: sql begin transaction.","prefix":"db-trx-begin"},"database: insert using transaction":{"body":"await ${1:trx}.insert(${2:data}).into(${3:table})","description":"Adonis Database: sql insert using transaction.","prefix":"db-trx-insert"},"database: commit transaction":{"body":"await ${1:trx}.commit()","description":"Adonis Database: sql commit transaction.","prefix":"db-trx-commit"},"database: rollback transaction":{"body":"await ${1:trx}.rollback()","description":"Adonis Database: sql rollback transaction.","prefix":"db-trx-rollback"},"database: count":{"body":["await ${1:Database}"," .from(${2:table})"," .count('${3:*} as ${4:total}')[0]"," .${4:total}"],"description":"Adonis Database: count.","prefix":"db-count"},"database: count distinct":{"body":["await ${1:Database}"," .from(${2:table})"," .countDistinct('${3:*} as ${4:total}')[0]"," .${4:total}"],"description":"Adonis Database: count distinct.","prefix":"db-count-distinct"},"database: get minimum":{"body":"await ${1:Database}.from(${2:table}).min(${3:column})","description":"Adonis Database: sql get minimum value.","prefix":"db-min"},"database: get maximum":{"body":"await ${1:Database}.from(${2:table}).max(${3:column})","description":"Adonis Database: sql get maximum value.","prefix":"db-max"},"database: sum":{"body":"await ${1:Database}.from(${2:table}).sum(${3:column})","description":"Adonis Database: sql sum column.","prefix":"db-sum"},"database: sum distinct":{"body":"await ${1:Database}.from(${2:table}).sumDistinct(${3:column})","description":"Adonis Database: sql sum distinct.","prefix":"db-sum-distinct"},"database: avg":{"body":"await ${1:Database}.from(${2:table}).avg(${3:column})","description":"Adonis Database: sql average.","prefix":"db-avg"},"database: avg distinct":{"body":"await ${1:Database}.from(${2:table}).avgDistinct(${3:column})","description":"Adonis Database: sql average distinct.","prefix":"db-avg-distinct"},"database: increment column by value":{"body":["await ${1:Database}"," .table(${2:name})"," .where(${3:query})"," .increment(${4:column}, ${5:value})"],"description":"Adonis Database: Increment column by value.","prefix":"db-increment"},"database: decrement column by value":{"body":["await ${1:Database}"," .table(${2:name})"," .where(${3:query})"," .decrement(${4:column}, ${5:value})"],"description":"Adonis Database: decrement column by value.","prefix":"db-decrement"},"database: query builder - get count":{"body":["await ${1:Database}"," .from(${2:table})"," .getCount(${3:columnName = '*'})"],"description":"Adonis Database: Query Builder - count.","prefix":"db-get-count"},"database: query builder - get count distinct":{"body":["await ${1:Database}"," .from(${2:table})"," .getCountDistinct(${3:columnName = '*'})"],"description":"Adonis Database: Query Builder - count distinct.","prefix":"db-get-count-distinct"},"database: query builder - get min":{"body":["await ${1:Database}"," .from(${2:table})"," .getMin(${3:columnName = '*'})"],"description":"Adonis Database: Query Builder - min.","prefix":"db-get-min"},"database: query builder - get max":{"body":["await ${1:Database}"," .from(${2:table})"," .getMax(${3:columnName = '*'})"],"description":"Adonis Database: Query Builder - max.","prefix":"db-get-max"},"database: query builder - get sum":{"body":["await ${1:Database}"," .from(${2:table})"," .getSum(${3:columnName = '*'})"],"description":"Adonis Database: Query Builder - sum.","prefix":"db-get-sum"},"database: query builder - get sum distinct":{"body":["await ${1:Database}"," .from(${2:table})"," .getSumDistinct(${3:columnName = '*'})"],"description":"Adonis Database: Query Builder - sum distinct.","prefix":"db-get-sum-distinct"},"database: query builder - get average":{"body":["await ${1:Database}"," .from(${2:table})"," .getAvg(${3:columnName = '*'})"],"description":"Adonis Database: Query Builder - average","prefix":"db-get-avg"},"database: query builder - get average distinct":{"body":["await ${1:Database}"," .from(${2:table})"," .getAvgDistinct(${3:columnName = '*'})"],"description":"Adonis Database: Query Builder - average distinct.","prefix":"db-get-avg-distinct"},"database: pluck":{"body":"await ${1:Database}.from(${2:table}).pluck(${3:column})","description":"Adonis Database: Get an array of values for the selected column.","prefix":"db-pluck"},"database: first":{"body":"await ${1:Database}.from(${2:table}).first()","description":"Adonis Database: Get first item in table by adding a limit 1 clause to the query.","prefix":"db-first"},"database: clone":{"body":["${4:await }${1:Database}"," .from(${2:table})"," .where($3)"," .clone()"],"description":"Adonis Database: Clones the current query chain for later usage.","prefix":"db-clone"},"database: get column information":{"body":["await ${1:Database}"," .table(${2:table})"," .columnInfo(${3:column})"],"description":"Adonis Database: Get information for a given column","prefix":"db-column-info"},"database: sub-query":{"body":["${5:await }${1:Database}"," .from(${2:table})"," .whereIn(${3:column}, ${4:subquery})"],"description":"Adonis Database: sql sub-query","prefix":"db-subquery"},"database: raw queries":{"body":"await ${1:Database}.raw(${2:sql}, [${3:values}])","description":"Adonis Database: sql raw queries","prefix":"db-raw"},"database: close connections":{"body":"${1:Database}.close(${2:['${3:mysql}']})","description":"Adonis Database: Close database connectionn for specified connection names. If no connection is provided, all connections are closed by default.","prefix":"db-close"}},{"drive:":{"body":"${1:Drive}.${2|exists,get,getStream,put,prepend,append,delete,move,copy|}($3)","description":"Adonis Drive","prefix":"drive"},"drive: exists":{"body":"${1:Drive}.exists(${2:relativePath})","description":"Adonis Drive: Find if a file/directory exists or not.","prefix":"drive-exists"},"drive: get":{"body":"${1:Drive}.get(${2:relativePath}, ${3:encoding = utf-8})","description":"Adonis Drive: Get file contents as a buffer or string.","prefix":"drive-get"},"drive: get stream":{"body":"${1:Drive}.getStream(${2:relativePath})","description":"Adonis Drive: Get file as a stream.","prefix":"drive-get-stream"},"drive: put":{"body":"${1:Drive}.put(${2:relativePath}, ${3:content}, ${4:options = {\\}})","description":"Adonis Drive: Create a new file with given contents (creates any missing directories).","prefix":"drive-put"},"drive: prepend":{"body":"${1:Drive}.prepend(${2:relativePath}, ${3:content}, ${4:options = {\\}})","description":"Adonis Drive: Prepend content to a file (creates a new file if path doesn’t exist).","prefix":"drive-prepend"},"drive: append":{"body":"${1:Drive}.append(${2:relativePath}, ${3:content}, ${4:options = {\\}})","description":"Adonis Drive: Append content to a file (creates a new file if path doesn’t exist).","prefix":"drive-append"},"drive: delete":{"body":"${1:Drive}.delete(${2:relativePath})","description":"Adonis Drive: Remove existing file.","prefix":"drive-delete"},"drive: move":{"body":"${1:Drive}.move(${2:relativePath}, ${3:content}, ${4:options = {\\}})","description":"Adonis Drive: Move file from one directory to another.","prefix":"drive-move"},"drive: copy":{"body":"${1:Drive}.copy(${2:relativePath}, ${3:content}, ${4:options = {\\}})","description":"Adonis Drive: Copy file from one directory to another.","prefix":"drive-copy"},"drive: S3":{"body":"${1:Drive}.disk('s3').${2|getObject,getUrl,getSignedUrl|}($3)","description":"Adonis Drive: S3 API","prefix":"s3"},"drive: get object from S3":{"body":"${1:Drive}.disk('s3').getObject(${2:location}, ${3:params})","description":"Adonis Drive: S3 - Get S3 object for a given file (for params info, see S3 params).","prefix":"s3-get-object"},"drive: get url from S3":{"body":"${1:Drive}.disk('s3').getUrl(${2:location}, ${3:bucket})","description":"Adonis Drive: S3 - Get url for a given file (accepts optional alternative bucket param).","prefix":"s3-get-url"},"drive: get signed url from S3":{"body":"${1:Drive}.disk('s3').getSignedUrl(${2:location}, ${3:expiry = 900}, ${4:params})","description":"Adonis Drive: S3 - Get signed url for a given file (expiry set to 15mins by default).","prefix":"s3-get-signed-url"}},{"encryption":{"body":"${1:Encryption}.${2|encrypt,decrypt|}($3)","description":"Adonis Encryption","prefix":"encryption"},"encryption: decrypt string":{"body":"${1:Encryption}.decrypt(${2:value})","description":"Adonis Encryption: Decrypt a plain text script.","prefix":"decrypt"},"encryption: encrypt string ":{"body":"${1:Encryption}.encrypt(${2:value})","description":"Adonis Encryption: Encrypt a plain text string.","prefix":"encrypt"}},{"event:":{"body":"${1:Event}.${2|on,fire,when,once,onAny,times,emit,removeListener,off,removeAlllisteners,listenersCount,getListeners,hasListeners|}($3)","description":"Adonis Event","prefix":"event"},"event: on":{"body":"${1:Event}.on(${2:event}, ${3:listener})","description":"Adonis Event: Bind single or multiple listeners for a given event. The listener can be a closure function or reference to one (or many) IoC container bindings.","prefix":"event-on"},"event: fire":{"body":"${1:Event}.fire(${2:event}, ${3:data})","description":"Adonis Event: Emit an event with optional data (an alias to the `emit` method).","prefix":"event-fire"},"event: when":{"body":"${1:Event}.when(${2:event}, ${3:listener})","description":"Adonis Event: The when method aliases the on method.","prefix":"event-when"},"event: once":{"body":"${1:Event}.once(${2:event}, ${3:listener})","description":"Adonis Event: Same as on, but only called one time.","prefix":"event-once"},"event: on any":{"body":"${1:Event}.onAny(${2:listener})","description":"Adonis Event: Bind listener for any event.","prefix":"event-on-any"},"event: times":{"body":"${1:Event}.times(${2:times})","description":"Adonis Event: The times method is chained with `on` or `when` to limit the number of times the listener should be fired.","prefix":"event-times"},"event: emit":{"body":"${1:Event}.emit(${2:event}, ${3:data})","description":"Adonis Event: Emit an event with optional data.","prefix":"event-emit"},"event: remove listener":{"body":"${1:Event}.removeListener(${2:event}, ${3:listener})","description":"Adonis Event: Remove listener(s) for a given event.","prefix":"event-remove-listener"},"event: off":{"body":"${1:Event}.off(${2:event}, ${3:listener})","description":"Adonis Event: Remove all listeners for a given event.","prefix":"event-off"},"event: remove all listeners":{"body":"${1:Event}.removeAlllisteners(${2:event})","description":"Adonis Event: Remove all listeners for a given event.","prefix":"event-remove-all-listeners"},"event: count listeners":{"body":"${1:Event}.listenersCount(${2:event})","description":"Adonis Event: Get the number of listeners for a given event.","prefix":"event-listeners-count"},"event: get listeners":{"body":"${1:Event}.getListeners(${2:event})","description":"Adonis Event: Get an array of listeners for a given event.","prefix":"event-get-listeners"},"event: check if isteners exist for event":{"body":"${1:Event}.hasListeners(${2:event})","description":"Adonis Event: Get a boolean indicating whether there are any listeners for a given event.","prefix":"event-has-listeners"}},{"factory":{"body":"${1:Factory}.${2|model,blueprint,get|}($3)","description":"Adonis Factory","prefix":"factory"},"factory: create model instance":{"body":"${1:Factory}.model(${2:name}).create()","description":"Adonis Factory: Persist and return model instance.","prefix":"factory-create"},"factory: create many model instances":{"body":"${1:Factory}.model(${2:name}).createMany(${3:3})","description":"Adonis Factory: Persist and return many model instances.","prefix":"factory-create-many"},"factory: make un-persisted model":{"body":"${1:Factory}.model(${2:name}).make()","description":"Adonis Factory: Get model instance but do not persist it to the database.","prefix":"factory-make"},"factory: make many un-persisted model":{"body":"${1:Factory}.model(${2:name}).makeMany(${3:3})","description":"Adonis Factory: Get array of model instances but do not persist them to the database.","prefix":"factory-make-many"},"factory: create model factory blueprint":{"body":["${1:Factory}.blueprint(${2:table}, (faker) => {"," return {"," $3"," }","\\})"],"description":"Adonis Factory: Define a factory blueprint for a database table.","prefix":"factory-blueprint"},"factory: change table without lucid":{"body":"${1:Factory}.get(${2:table}).table(${3:newTableName}).create()","description":"Adonis Factory: Define a different table name at runtime.","prefix":"factory-table"},"factory: returning without lucid":{"body":"${1:Factory}.get(${2:table}).returning(${3:column}).create()","description":"Adonis Factory: For PostgreSQL, define a returning column.","prefix":"factory-return"},"factory: change connection without lucid":{"body":"${1:Factory}.get(${2:table}).connection('${3:myql}')","description":"Adonis Factory: Choose a different connection at runtime.","prefix":"factory-conn"},"factory: create many without lucid":{"body":"${1:Factory}.get(${2:table}).creatMany(${3:3})","description":"Adonis Factory: Create multiple records.","prefix":"factory-create-many"}},{"hash":{"body":"${1:Encryption}.${2|make,verify|}($3)","description":"Adonis Hashing","prefix":"hash"},"hash: make hash from plain string":{"body":"${1:Encryption}.make(${2:value}, ${3:config = {\\}})","description":"Adonis Hashing: Hash a plain string value.","prefix":"hash"},"hash: verify hash string":{"body":"${1:Encryption}.verify(${2:value}, ${3:hashedValue})","description":"Adonis Hashing: Verify the input value against the previously hashed value.","prefix":"hash-verify"}},{"helper":{"body":"${1:Helper}.${2|appRoot,publicPath,configPath,resourcesPath,migrationsPath,seedsPath,databasePath,viewsPath,tmpPath,promisify,isAceCommand|}($3)","description":"Adonis Helper","prefix":"help"},"helper: get app root":{"body":"${1:Helper}.appRoot()","description":"Adonis Helper: Get path to the application root.","prefix":"help-app-root"},"helper: get public directory path":{"body":"${1:Helper}.publicPath(${2:toFile = optional})","description":"Adonis Helper: Get path to the public directory or file inside the directory.","prefix":"help-public-path"},"helper: get path to config directory":{"body":"${1:Helper}.configPath(${2:toFile = optional})","description":"Adonis Helper: Get path to the config directory or file inside the directory.","prefix":"help-config-path"},"helper: get path to resources directory":{"body":"${1:Helper}.resourcesPath(${2:toFile = optional})","description":"Adonis Helper: Get path to the resources directory or file inside the directory.","prefix":"help-resources-path"},"helper: get path to migrations directory":{"body":"${1:Helper}.migrationsPath(${2:toFile = optional})","description":"Adonis Helper: Get path to the migrations directory or file inside the directory.","prefix":"help-migrations-path"},"helper: get path to seeds directory":{"body":"${1:Helper}.seedsPath(${2:toFile = optional})","description":"Adonis Helper: Get path to the seeds directory or file inside the directory.","prefix":"help-seeds-path"},"helper: get path to database directory":{"body":"${1:Helper}.databasePath(${2:toFile = optional})","description":"Adonis Helper: Get path to the database directory or file inside the directory.","prefix":"help-database-path"},"helper: get path to views directory":{"body":"${1:Helper}.viewsPath(${2:toFile = optional})","description":"Adonis Helper: Get path to the views directory or file inside the directory.","prefix":"help-views-path"},"helper: get path to `tmp` directories":{"body":"${1:Helper}.tmpPath(${2:toFile = optional})","description":"Adonis Helper: Get path to the tmp directory or file inside the directory.","prefix":"help-tmp-path"},"helper: get promisified callback callback":{"body":"${1:Helper}.promisify(${2:item})","description":"Adonis Helper: Get promisified callback functions.","prefix":"help-promisify"},"helper: check if ace command started current process":{"body":"${1:Helper}.isAceCommand()","description":"Adonis Helper: Get whether the process was started as the ace command or not.","prefix":"help-is-ace"}},{"logger":{"body":"${1:Logger}.${2|emerg,alert,crit,error,warning,notice,info,debug|}(${3:msg}, ${4:...data})","description":"Adonis Logger","prefix":"log"},"logger: debug":{"body":"${1:Logger}.debug(${2:msg}, ${3:...data})","description":"Adonis Logger: Debug","prefix":"log-debug"},"logger: info":{"body":"${1:Logger}.info(${2:msg}, ${3:...data})","description":"Adonis Logger: Info","prefix":"log-info"},"logger: notice":{"body":"${1:Logger}.notice(${2:msg}, ${3:...data})","description":"Adonis Logger: Notice","prefix":"log-notice"},"logger: warning":{"body":"${1:Logger}.warning(${2:msg}, ${3:...data})","description":"Adonis Logger: Warning","prefix":"log-warning"},"logger: error":{"body":"${1:Logger}.error(${2:msg}, ${3:...data})","description":"Adonis Logger: Error","prefix":"log-error"},"logger: critical":{"body":"${1:Logger}.crit(${2:msg}, ${3:...data})","description":"Adonis Logger: Critical","prefix":"log-crit"},"logger: alert":{"body":"${1:Logger}.alert(${2:msg}, ${3:...data})","description":"Adonis Logger: Alert","prefix":"log-alert"},"logger: emergency":{"body":"${1:Logger}.emerg(${2:msg}, ${3:...data})","description":"Adonis Logger: Emergency","prefix":"log-emerg"},"logger: switch transport":{"body":"${1:Logger}.transport(${2:transport}).${3|emerg,alert,crit,error,warning,notice,info,debug|}(${4:msg}, ${5:...data})","description":"Adonis Logger: Switch log transport.","prefix":"log-transport"},"logger: change log level":{"body":"${1:Logger}.level = '${2|emerg,alert,crit,error,warning,notice,info,debug|}'","description":"Adonis Logger: Change log level.","prefix":"log-level"}},{"mail":{"body":"${1:Mail}.${2|send,raw,connection|}($3)","description":"Adonis Mail: ","prefix":"mail"},"mail: send message":{"body":["await ${1:Mail}.send(${2:views = []}, ${3:data}, (${4:message}) => {"," ${4:message}$0","\\})$5"],"description":"Adonis Mail: Send email using one or many Edge views.","prefix":"mail-send"},"mail: send raw text":{"body":["await ${1:Mail}.raw(${2:views = []}, (${3:message}) => {"," ${3:message}$0","\\})$4"],"description":"Adonis Mail: Use a raw string to send the mail (when the string is HTML the email HTML body will be set, otherwise just a plain text email will be sent).","prefix":"mail-send-raw"},"mail: switch connection":{"body":["await ${1:Mail}"," .connection(${2:name})"," .${3|send,raw|}($4)"],"description":"Adonis Mail: Switch the mail driver.","prefix":"mail-connection"},"mail: set `to` address":{"body":"${1:message}.to(${2:email}, ${3:optionalName})","description":"Adonis Mail: Set `to` address.","prefix":"mail-msg-to"},"mail: set `from` address":{"body":"${1:message}.from(${2:email}, ${3:optionalName})","description":"Adonis Mail: Set `from` address.","prefix":"mail-msg-from"},"mail: set `cc` address":{"body":"${1:message}.cc(${2:email}, ${3:optionalName})","description":"Adonis Mail: Add `cc` address to the email.","prefix":"mail-msg-cc"},"mail: set `bcc` address":{"body":"${1:message}.bcc(${2:email}, ${3:optionalName})","description":"Adonis Mail: Add `bcc` address to the email.","prefix":"mail-msg-bcc"},"mail: reply to message":{"body":"${1:message}.replyTo(${2:email})","description":"Adonis Mail: Set `replyTo` email address.","prefix":"mail-msg-reply-to"},"mail: send mail in reply to another message":{"body":"${1:message}.inReplyTo(${2:messageId})","description":"Adonis Mail: Set email message `id`.","prefix":"mail-msg-in-reply-to"},"mail: set mail `subject`":{"body":"${1:message}.subject(${2:value})","description":"Adonis Mail: Set email subject.","prefix":"mail-msg-subject"},"mail: manually set message text":{"body":"${1:message}.text(${2:messageId})","description":"Adonis Mail: Manually set the plain text body for the email.","prefix":"mail-msg-text"},"mail: attach file to message":{"body":"${1:message}.attach(${2:filePath}, ${3:options = {\\}})","description":"Adonis Mail: Attach file(s) to the email.","prefix":"mail-msg-attach"},"mail: attach data(string, buffer, stream) to message":{"body":"${1:message}.attachData(${2|new Buffer,fs|}, ${3:filename}, ${4:options = {\\}})","description":"Adonis Mail: Attach raw data as a `String`, `Buffer` or `Stream`.","prefix":"mail-msg-attach-data"},"mail: embed image into message":{"body":"${1:message}.embed(${2:filePath}, ${3:contendId}, ${4:options = {\\}}))","description":"Adonis Mail: Embed an image into the HTML body using a *content id*.","prefix":"mail-msg-embed"},"mail: pass in more values to mail driver":{"body":"${1:message}.driverExtras(${2:options = {\\}})","description":"Adonis Mail: Pass an object of values to the current driver.","prefix":"mail-msg-driver-extras"}},{"redis":{"body":"${4:await }${1:Redis}.${2|subscribe,psubscribe,publish,unsubscribe,punsubscribe,connection,quit|}($3)","description":"Adonis Redis","prefix":"redis"},"redis: subscribe to channel":{"body":"${4:await }${1:Redis}.subscribe(${2:channel}, ${3:listener})","description":"Adonis Redis - Subscribe to a channel.","prefix":"redis-sub"},"redis: subscribe to channel by pattern":{"body":"${4:await }${1:Redis}.psubscribe(${2:pattern}, ${3:listener})","description":"Adonis Redis - Subscribe to a pattern channel.","prefix":"redis-psub"},"redis: publish message to channel":{"body":"${4:await }${1:Redis}.publish(${2:channel}, ${3:message})","description":"Adonis Redis - Publish message to a given channel.","prefix":"redis-publish"},"redis: unsubscribe from channel":{"body":"${3:await }${1:Redis}.unsubscribe(${2:channel})","description":"Adonis Redis - Unsubscribe from a given channel.","prefix":"redis-unsub"},"redis: unsubscribe from channel by pattern":{"body":"${3:await }${1:Redis}.punsubscribe(${2:channelPattern})","description":"Adonis Redis - Unsubscribe from a given pattern.","prefix":"redis-punsub"},"redis: select a connection":{"body":"${4:await }${1:Redis}.connection(${2:name})","description":"Adonis Redis - Use a different connection to make Redis queries.","prefix":"redis-conn"},"redis: quit connection(s)":{"body":"${4:await }${1:Redis}.quit(['${2:connection}', $3])","description":"Adonis Redis - Quite a connection for an array of connections.","prefix":"redis-quit"}},{"request":{"body":"${1:request}.${2|all,get,post,raw,only,except,input,collect,header,headers,cookie,cookies,plainCookie,plainCookies,accepts,language,url,originalUrl,method,intended,ip,ips,subdomains,ajax,pjax,hostname,protocol,match,hasBody,is|}($3)","description":"Adonis Route","prefix":"req"},"request: all":{"body":"${1:request}.all()","description":"Adonis Route: Get an object containing all request data (merges query params and request body data).","prefix":"req-all"},"request: get":{"body":"${1:request}.get()","description":"Adonis Route: Get an object containing query params data.","prefix":"req-get"},"request: post":{"body":"${1:request}.post()","description":"Adonis Route: Get an object containing request body data.","prefix":"req-post"},"request: raw":{"body":"${1:request}.raw()","description":"Adonis Route: Get raw body data as a string.","prefix":"req-raw"},"request: only":{"body":"${1:request}.only([${2:key}$3])","description":"Adonis Route: Get an object with only the specified keys.","prefix":"req-only"},"request: except":{"body":"${1:request}.except([${2:key}$3])","description":"Adonis Route: Get an object with everything except the specified keys (opposite of only).","prefix":"req-except"},"request: input":{"body":"${1:request}.input(${2:key}, ${3:default})","description":"Adonis Route: Get the value of a given key (if it doesn’t exist, return the default value).","prefix":"req-input"},"request: collect":{"body":"${1:request}.collect([${2:key}$3])","description":"Adonis Route: Collect request data in a read-to-save to DB format.","prefix":"req-collect"},"request: header":{"body":"${1:request}.header(${2:key}, ${3:default})","description":"Adonis Route: Get the header value for a given key (optionally with default value)","prefix":"req-header"},"request: headers":{"body":"${1:request}.headers()","description":"Adonis Route: Get an object of all header data.","prefix":"req-headers"},"request: cookie":{"body":"${1:request}.cookie(${2:key}, ${3:default})","description":"Adonis Route: Get the cookie value for a given key (optionally with default value).","prefix":"req-cookie"},"request: cookies":{"body":"${1:request}.cookies()","description":"Adonis Route: Get an object of all cookie data.","prefix":"req-cookies"},"request: set plain cookie":{"body":"${1:request}.plainCookie(${2:key}, ${3:default})","description":"Adonis Route: Get the raw cookie value for a given key (optionally with default value).","prefix":"req-plainCookie"},"request: get all plain cookies data":{"body":"${1:request}.plainCookies()","description":"Adonis Route: Get an object of all raw cookie data.","prefix":"req-plainCookies"},"request: accepts":{"body":"${1:request}.accepts([${2:value}$3])","description":"Adonis Route: Reads the Accept header to help determine the response format.","prefix":"req-accepts"},"request: language":{"body":"${1:request}.language([${2:value}$3])","description":"Adonis Route: Language can also be negotiated based upon the Accept-Language header.","prefix":"req-language"},"request: url":{"body":"${1:request}.url()","description":"Adonis Route: Returns the current request url","prefix":"req-url"},"request: original url":{"body":"${1:request}.originalUrl()","description":"Adonis Route: Get the full current request url with query strings.","prefix":"req-originalUrl"},"request: method":{"body":"${1:request}.method()","description":"Adonis Route: Get the HTTP request method.","prefix":"req-method"},"request: intended":{"body":"${1:request}.intended()","description":"Adonis Route: Get the actual method leveraging AdonisJS method spoofing.","prefix":"req-intended"},"request: ip":{"body":"${1:request}.ip()","description":"Adonis Route: Get the most trusted ip address for the user.","prefix":"req-ip"},"request: ips":{"body":"${1:request}.ips()","description":"Adonis Route: Get an array of ips from most to the least trusted (removes the default ip address, which can be accessed via the ip method).","prefix":"req-ips"},"request: subdomains":{"body":"${1:request}.subdomains()","description":"Adonis Route: Get a list of request subdomains (removes www from the list).","prefix":"req-subdomains"},"request: ajax":{"body":"${1:request}.ajax()","description":"Adonis Route: Checks for X-Requested-With header to determine if the request is ajax or not.","prefix":"req-ajax"},"request: pjax":{"body":"${1:request}.pjax()","description":"Adonis Route: Look for the X-PJAX header to identify if a request is pjax or not.","prefix":"req-pjax"},"request: hostname":{"body":"${1:request}.hostname()","description":"Adonis Route: Get the request hostname.","prefix":"req-hostname"},"request: protocol":{"body":"${1:request}.protocol()","description":"Adonis Route: Get the request protocol.","prefix":"req-protocol"},"request: match":{"body":"${1:request}.match([${2:expression}$3])","description":"Adonis Route: Get whether the passed set of expressions match the current request URL.","prefix":"req-match"},"request: has body":{"body":"${1:request}.hasBody()","description":"Adonis Route: A boolean indicating if the request has a post body (mainly used by the BodyParser to determine whether or not to parse the body).","prefix":"req-hasBody"},"request: is":{"body":"${1:request}.is([${2:contentType}$3])","description":"Adonis Route: Get the best matching content type for the current request.","prefix":"req-is"}},{"response":{"body":"${1:response}.${2|send,json,header,safeHeader,removeHeader,type,cookie,clearCookie,plainCookie,redirect,route,download,attachment,unauthorized,status,continue,switchingProtocols,ok,created,accepted,nonAuthoritativeInformation,noContent,resetContent,partialContent,multipleChoices,movedPermanently,found,seeOther,notModified,useProxy,temporaryRedirect,badRequest,unauthorized,paymentRequired,forbidden,notFound,methodNotAllowed,notAcceptable,proxyAuthenticationRequired,requestTimeout,conflict,gone,lengthRequired,preconditionFailed,requestEntityTooLarge,requestUriTooLong,unsupportedMediaType,requestedRangeNotSatisfiable,expectationFailed,unprocessableEntity,tooManyRequests,internalServerError,notImplemented,badGateway,serviceUnavailable,gatewayTimeout,httpVersionNotSupported|}($3)","description":"Adonis Response","prefix":"res"},"response: send":{"body":"${1:response}.send(${2:data})","description":"Adonis Response: Send the provided data.","prefix":"res-send"},"response: json":{"body":"${1:response}.json(${2:data})","description":"Adonis Response: Return json response.","prefix":"res-json"},"response: header":{"body":"${1:response}.header(${2:key}, ${3:value})","description":"Adonis Response: Set a header value.","prefix":"res-header"},"response: safe header":{"body":"${1:response}.safeHeader(${2:key}, ${3:value})","description":"Adonis Response: Only set a header value if it does not already exist.","prefix":"res-safeHeader"},"response: remove header":{"body":"${1:response}.removeHeader(${2:key})","description":"Adonis Response: Remove an existing header.","prefix":"res-removeHeader"},"response: type":{"body":"${1:response}.type(${2:contentType})","description":"Adonis Response: Set the Content-Type header.","prefix":"res-type"},"response: cookie":{"body":"${1:response}.cookie(${2:key}, ${3:value})","description":"Adonis Response: Set a cookie value.","prefix":"res-cookie"},"response: clear cookie":{"body":"${1:response}.clearCookie(${2:key})","description":"Adonis Response: Remove an existing cookie value (by setting its expiry in the past).","prefix":"res-clearCookie"},"response: plain cookie":{"body":"${1:response}.plainCookie(${2:key}, ${3:value})","description":"Adonis Response: Set a plain cookie key/value pair.","prefix":"res-plainCookie"},"response: redirect":{"body":"${1:response}.redirect(${2:url}, ${3:sendParam = true}, ${4:status = 301})","description":"Adonis Response: Redirect request to a different url (by default it will set the status as 302).","prefix":"res-redirect"},"response: route":{"body":"${1:response}.route(${2:route}, ${3:data}, ${4:domain}, ${5:sendParams = false}, ${6:status = 302})","description":"Adonis Response: Redirect to a route (via route name or controller method).","prefix":"res-route"},"response: download":{"body":"${1:response}.download(${2:filePath})","description":"Adonis Response: Stream the file specified to the client.","prefix":"res-download"},"response: attachment":{"body":"${1:response}.attachment(${2:filePath}, ${3:name}, ${4:disposition})","description":"Adonis Response: Force download the file specified.","prefix":"res-attachment"},"response: status":{"body":"${1:response}.status(${2:data})","description":"Adonis Response: Specify the status code to be return to a client.","prefix":"res-status"},"response: 100 - continue":{"body":"${1:response}.continue(${2:data})","description":"Adonis Response: 100 - continue.","prefix":"res-continue"},"response: 101 - switching protocols":{"body":"${1:response}.switchingProtocols(${2:data})","description":"Adonis Response: 101 - switching protocols.","prefix":"res-switching-protocols"},"response: 200 - ok":{"body":"${1:response}.ok(${2:data})","description":"Adonis Response: 200 - ok.","prefix":"res-ok"},"response: 201 - created":{"body":"${1:response}.created(${2:data})","description":"Adonis Response: 201 - created.","prefix":"res-created"},"response: 202 - accepted":{"body":"${1:response}.accepted(${2:data})","description":"Adonis Response: 202 - accepted.","prefix":"res-accepted"},"response: 203 - non-authoritative information":{"body":"${1:response}.nonAuthoritativeInformation(${2:data})","description":"Adonis Response: 203 - non authoritative information.","prefix":"res-non-auth-info"},"response: 204 - no content":{"body":"${1:response}.noContent(${2:data})","description":"Adonis Response: 204 - no content.","prefix":"res-no-content"},"response: 205 - reset content":{"body":"${1:response}.resetContent(${2:data})","description":"Adonis Response: 205 - reset content.","prefix":"res-reset-content"},"response: 206 - partial content":{"body":"${1:response}.partialContent(${2:data})","description":"Adonis Response: 206 - partial content.","prefix":"res-partial-content"},"response: 300 - multiple choices":{"body":"${1:response}.multipleChoices(${2:data})","description":"Adonis Response: 300 - multiple choices.","prefix":"res-multiple choices"},"response: 301 - moved permanently":{"body":"${1:response}.movedPermanently(${2:data})","description":"Adonis Response: 301 - moved permanently.","prefix":"res-moved-permanently"},"response: 302 - found":{"body":"${1:response}.found(${2:data})","description":"Adonis Response: 302 - found.","prefix":"res-found"},"response: 303 - see other":{"body":"${1:response}.seeOther(${2:data})","description":"Adonis Response: 303 - see-other.","prefix":"res-see-other"},"response: 304 - not modified":{"body":"${1:response}.notModified(${2:data})","description":"Adonis Response: 304 - not modified.","prefix":"res-not-modified"},"response: 305 - use proxy":{"body":"${1:response}.useProxy(${2:data})","description":"Adonis Response: 305 - use proxy.","prefix":"res-use-proxy"},"response: 307 - temporary redirect":{"body":"${1:response}.temporaryRedirect(${2:data})","description":"Adonis Response: 307 - temporary redirect.","prefix":"res-temp-redirect"},"response: 400 - bad request":{"body":"${1:response}.badRequest(${2:data})","description":"Adonis Response: 400 - bad request.","prefix":"res-bad-request"},"response: 401 - unauthorized":{"body":"${1:response}.unauthorized(${2:data})","description":"Adonis Response: 401 - unauthorized.","prefix":"res-unauthorized"},"response: 402 - payment required":{"body":"${1:response}.paymentRequired(${2:data})","description":"Adonis Response: 402 - payment required.","prefix":"res-payment-required"},"response: 403 - forbidden":{"body":"${1:response}.forbidden(${2:data})","description":"Adonis Response: 403 - forbidden.","prefix":"res-forbidden"},"response: 404 - not found":{"body":"${1:response}.notFound(${2:data})","description":"Adonis Response: 404 - not found.","prefix":"res-not-found"},"response: 405 - method not allowed":{"body":"${1:response}.methodNotAllowed(${2:data})","description":"Adonis Response: 405 - method not allowed.","prefix":"res-method-not-allowed"},"response: 406 - not acceptable":{"body":"${1:response}.notAcceptable(${2:data})","description":"Adonis Response: 406 - not acceptable.","prefix":"res-not-acceptable"},"response: 407 - proxy authentication required":{"body":"${1:response}.proxyAuthenticationRequired(${2:data})","description":"Adonis Response: 407 - proxy authentication required.","prefix":"res-proxy-auth-required"},"response: 408 - request timeout":{"body":"${1:response}.requestTimeout(${2:data})","description":"Adonis Response: 408 - request timeout.","prefix":"res-request-timeout"},"response: 409 - conflict":{"body":"${1:response}.conflict(${2:data})","description":"Adonis Response: 409 - conflict.","prefix":"res-conflict"},"response: 410 - gone":{"body":"${1:response}.gone(${2:data})","description":"Adonis Response: 410 - gone.","prefix":"res-gone"},"response: 411 - length required":{"body":"${1:response}.lengthRequired(${2:data})","description":"Adonis Response: 411 - length required.","prefix":"res-length-required"},"response: 412 - precondition failed":{"body":"${1:response}.preconditionFailed(${2:data})","description":"Adonis Response: 412 - precondition failed.","prefix":"res-precondition-failed"},"response: 413 - request entity too large":{"body":"${1:response}.requestEntityTooLarge(${2:data})","description":"Adonis Response: 413 - request entity too large.","prefix":"res-request-entity-too-large"},"response: 414 - request uri too long":{"body":"${1:response}.requestUriTooLong(${2:data})","description":"Adonis Response: 414 - request URI too long.","prefix":"res-request-uri-too-long"},"response: 415 - unsupported media type":{"body":"${1:response}.unsupportedMediaType(${2:data})","description":"Adonis Response: 415 - unsupported media type.","prefix":"res-unsupported-media-type"},"response: 416 - requested range not satisfiable":{"body":"${1:response}.requestedRangeNotSatisfiable(${2:data})","description":"Adonis Response: 416 - requested range not satisfiable.","prefix":"res-requested-range-not-satisfiable"},"response: 417 - expectation failed":{"body":"${1:response}.expectationFailed(${2:data})","description":"Adonis Response: 417 - expectation failed.","prefix":"res-expectation-failed"},"response: 422 - unprocessable entity":{"body":"${1:response}.unprocessableEntity(${2:data})","description":"Adonis Response: 422 - unprocessable entity.","prefix":"res-unprocessable-entity"},"response: 429 - too many requests":{"body":"${1:response}.tooManyRequests(${2:data})","description":"Adonis Response: 429 - too many requests.","prefix":"res-too-many-requests"},"response: 500 - internal server error":{"body":"${1:response}.internalServerError(${2:data})","description":"Adonis Response: 500 - internal server error.","prefix":"res-internal-server-error"},"response: 501 - not implemented":{"body":"${1:response}.notImplemented(${2:data})","description":"Adonis Response: 501 - not implemented.","prefix":"res-not-implemented"},"response: 502 - bad gateway":{"body":"${1:response}.badGateway(${2:data})","description":"Adonis Response: 502 - bad gateway.","prefix":"res-bad-gateway"},"response: 503 - service unavailable":{"body":"${1:response}.serviceUnavailable(${2:data})","description":"Adonis Response: 503 - service unavailable.","prefix":"res-service-unavailable"},"response: 504 - gateway timeout":{"body":"${1:response}.gatewayTimeout(${2:data})","description":"Adonis Response: 504 - gateway timeout.","prefix":"res-gateway-timeout"},"response: 505 - http version not supported":{"body":"${1:response}.httpVersionNotSupported(${2:data})","description":"Adonis Response: 505 - http version not supported.","prefix":"res-http-version-not-supported"}},{"route":{"body":"Route.${1|get,put,post,patch,delete,any|}('$2', $3, $4)","description":"Adonis Route","prefix":"route"},"route: on(...).render('view')":{"body":"Route.on($1).render($2)","description":"Adonis Route: on","prefix":"route-on"},"route: named route":{"body":"Route.${1|get,put,post,patch,delete,any|}('$2', $3, $4).as('$7')","description":"Adonis Route: Name a route with a unique value.","prefix":"route-named"},"route: formats":{"body":"Route.${1|get,put,post,patch,delete,any|}('$2', $3, $4).formats(['$7',$8], $9)","description":"Adonis Route: Defines formats for all routes in the group.","prefix":"route-formats"},"route: inline":{"body":["Route.${1|get,put,post,patch,delete,any|}('$2', ($5) => {"," $7","\\},$6)"],"description":"Adonis Route: Map route to inline function.","prefix":"route-inline"},"route: resource":{"body":"Route.resource('$1', $2).${3|apiOnly,only,except,middleware,formats|}($4)","description":"Adonis Route: Resources","prefix":"route-resource"},"route: group":{"body":["Route.group(() => {"," $1","}).${2|domain,prefix,middleware,namespace,formats|}($3)"],"description":"Adonis Route: Group","prefix":"route-group"}},{"session":{"body":"${1:session}.${2|put,get,all,increment,decrement,forget,pull,clear,flashAll,flashOnly,flashExcept,withErrors,flash,old,withErrorFor,getErrorFor,flashMessage,commit|}($3)","description":"Adonis Session","prefix":"session"},"session: put key pair value to session":{"body":"${1:session}.put(${2:key}, ${3:value})","description":"Adonis Session: Add a key/value pair to the session store.","prefix":"session-put"},"session: get session value by key":{"body":"${1:session}.get(${2:key}, ${3:default})","description":"Adonis Session: Get the value for a given key (accepts an optional default value).","prefix":"session-get"},"session: get all session data":{"body":"${1:session}.all()","description":"Adonis Session: Get everything back as an object from the session store.","prefix":"session-all"},"session: increment session value by key":{"body":"${1:session}.increment(${2:key}, ${3:steps})","description":"Adonis Session: Increment the value for a given key (ensure the previous value is a number).","prefix":"session-increment"},"session: decrement session value by key":{"body":"${1:session}.decrement(${2:key}, ${3:steps})","description":"Adonis Session: Decrement the value for a given key (ensure the previous value is a number).","prefix":"session-decrement"},"session: forget":{"body":"${1:session}.forget(${2:key})","description":"Adonis Session: Remove a key/value pair from the session store.","prefix":"session-forget"},"session: pull":{"body":"${1:session}.pull(${2:key}, ${3:default})","description":"Adonis Session: Get (and then remove) a key/value pair from the session store.","prefix":"session-pull"},"session: clear session store":{"body":"${1:session}.clear()","description":"Adonis Session: Empty the session store.","prefix":"session-clear"},"session: flash all fields":{"body":"${1:session}.flashAll()","description":"Adonis Session: Flash the request form data.","prefix":"session-flash-all"},"session: flash only selected fields":{"body":"${1:session}.flashOnly([$2,$3])","description":"Adonis Session: Flash only the selected fields.","prefix":"session-flash-only"},"session: flash except selected fields":{"body":"${1:session}.flashExcept([$2,$3])","description":"Adonis Session: Flash the request form data except the selected fields.","prefix":"session-flash-except"},"session: flash with provided errors":{"body":"${1:session}.withErrors([{$2}])","description":"Adonis Session: Flash with an array of errors.","prefix":"session-with-errors"},"session: flash":{"body":"${1:session}.flash({$2})","description":"Adonis Session: Flash a custom object.","prefix":"session-flash"},"session: commit session":{"body":"${1:session}.commit($2)","description":"Adonis Session: Commit the session manually (usefull when handling exceptions of your own).","prefix":"session-commit"}},{"view":{"body":"${1:view}.render('${3:path.name}')","description":"Adonis View: Render an edge view to a client.","prefix":"view"},"view: share":{"body":"${1:view}.share({$3})","description":"Adonis View: Share specific request values with views.","prefix":"view-share"}},{"websocket:":{"body":"${1:Ws}.${2|channel,getChannel|}($3)","description":"Adonis Websocket","prefix":"ws"},"websocket: channel":{"body":["${1:Ws}.channel(${2:name}, ({ ${3:socket} \\}) => {"," ${4:// implementation}","\\})"],"description":"Adonis Websocket: Register a dynamic function to a socket channel.","prefix":"ws-channel"},"websocket: get channel":{"body":"${1:Ws}.getChannel(${2:name})$0","description":"Adonis Websocket: Select a given channel to perform an action on.","prefix":"ws-get-channel"},"websocket: middleware":{"body":["${1:Ws}"," .channel(${2:name}, ${3:controller})"," .middleware([${4:middleware},$5])$0"],"description":"Adonis Websocket: Register a middleware to a channel.","prefix":"ws-middleware"},"socket:":{"body":"${1:socket}.${2|on,emit,emitTo,broadcast,broadcastToAllon,emit,close|}($3)","description":"Adonis Websocket (Server API)","prefix":"socket"},"socket: on":{"body":["${1:socket}.on('${2|close,error|}', ${3:() => {"," // implementation","\\}})"],"description":"Adonis Websocket (Server API): Subscribe to available socket events (error, close).","prefix":"socket-on"},"socket: on close":{"body":["${1:socket}.on('close', ${2:() => {"," // implementation","\\}})"],"description":"Adonis Websocket (Server API): Invoked when a subscription is closed.","prefix":"socket-on-close"},"socket: on error":{"body":["${1:socket}.on('error', ${2:() => {"," // implementation","\\}})"],"description":"Adonis Websocket (Server API): Invoked when an error is received.","prefix":"socket-on-error"},"socket: emit":{"body":"${1:socket}.emit(${2:event}, ${3:data}, ${4:[ackCallback]})","description":"Adonis Websocket (Server API): Emit event to the connected client.","prefix":"socket-emit"},"socket: emit to":{"body":"${1:socket}.emitTo(${2:event}, ${3:data}, ${4:[socketIds]})","description":"Adonis Websocket (Server API): Emit event to an array of socket ids.","prefix":"socket-emit-to"},"socket: broadcast":{"body":"${1:socket}.broadcast(${2:event}, ${3:data})","description":"Adonis Websocket (Server API): Emit event to everyone except yourself.","prefix":"socket-broadcast"},"socket: broadcast to all":{"body":"${1:socket}.broadcastToAll(${2:event}, ${3:data})","description":"Adonis Websocket (Server API): Emit event to everyone including yourself.","prefix":"socket-broadcastToAll"},"socket: close":{"body":"${1:socket}.close()","description":"Adonis Websocket (Server API): Forcefully close a subscription from the server.","prefix":"socket-close"},"socket: properties":{"body":"${1:socket}.${2|id,topic,connection|}","description":"Adonis Websocket (Server API) - Read-only socket prorities.","prefix":"socket-props"}}] \ No newline at end of file diff --git a/src/snippets/output/edge.json b/src/snippets/output/edge.json new file mode 100644 index 0000000..09dd763 --- /dev/null +++ b/src/snippets/output/edge.json @@ -0,0 +1 @@ +[{"edge: {{ css('path') }}":{"prefix":"css","body":"{{ css('$1') }}","description":"Adonis - make css link"},"edge: {{ script ('path') }}":{"prefix":"script","body":"{{ script('$1') }}","description":"Adonis - make script link"},"edge: {{ assetsUrl('path') }}":{"prefix":"assetsUrl","body":"{{ assetsUrl('$1') }}","description":"Adonis - make asset link"},"edge: {{ route('name', params = {}) }}":{"prefix":"route","body":"{{ route('$1', { $2 }) }}","description":"Adonis - make link from route"},"edge: {{ url }}":{"prefix":"url","body":"{{ url }}","description":"Adonis - current url"},"edge: {{ auth.user }}":{"prefix":"auth-user","body":"{{ auth.user$1 }}$0","description":"Adonis - current auth user"},"edge: {{ csrfField() }}":{"prefix":"csrf","body":"{{ csrfField() }}","description":"Adonis - csrf field"},"edge: {{ cspMeta() }}":{"prefix":"cspMeta","body":"{{ cspMeta() }}","description":"Adonis - meta tag"},"edge: @loggedIn ... @else ... @endLoggedIn":{"prefix":"logged-in","body":["@loggedIn"," $1","@else"," $2","@endloggedIn"],"description":"Edge - @loggedIn else block"},"edge: {{ old(key, default) }}":{"prefix":"old","body":"{{ old($1, $2) }}","description":"Edge View - returns the value for a given key from the flash store"},"edge: {{ hasErrorFor(key) }}":{"prefix":"has-error-for","body":"{{ hasErrorFor($1) }}","description":"Edge View - returns true if there is an error for a given field inside the flash store"},"edge: {{ getErrorFor(key) }}":{"prefix":"get-error-for","body":"{{ getErrorFor($1) }}","description":"Edge View - returns the error message for a given field"},"edge: {{ flashMessage(key, default) }}":{"prefix":"flash","body":"{{ flashMessage(${1:key}, ${2:default}) }}","description":"Edge View - returns the error message for a given field"},"edge: {{ auth }}":{"prefix":"auth","body":"{{ auth$1 }}","description":"Edge View - authenticated object"},"edge: {{ antl }}":{"prefix":"antl","body":"{{ antl.${1|formatNumber,formatRelative,formatDate,formatAmount,formatMessage|}($3) }}","description":"Edge Localizalisation - antl"}},{"edge: comment":{"prefix":"comment","body":["{{-- ${1:comment} --}}","$2"],"description":"Edge: Comment block"},"edge: multiline comment":{"prefix":"comment-multiline","body":["{{-- "," ${1:comment}","--}}","$2"],"description":"Edge: Multiline comment block"},"html: comment":{"prefix":"html-comment","body":["","$2"],"description":"HTML: Comment block"}},{"edge: @include('view')":{"prefix":"include","body":"@include('${1:name}')$2","description":"Edge: Include view"},"edge: @super":{"prefix":"super","body":"@super","description":"Edge: Super extend"},"edge: @!component('name')":{"prefix":"component","body":"@!component('$1')","description":"Edge: Component self close"},"edge: @component('name') ... @endcomponent":{"prefix":"component-block","body":["@component('$1')"," $2","@endcomponent"],"description":"Edge: Component block"}},{"edge: @if (...)":{"prefix":"if","body":["@if($1)"," $2","@endif"],"description":"Edge: if block"},"edge: @if (...) ... @else ... @endif":{"prefix":"ifelse","body":["@if($1)"," $2","@else"," $3","@endif"],"description":"Edge: if-else block"},"edge: @if (...) ... @elseif (...) ... @else ... @endif":{"prefix":"ifelseif","body":["@if($1)"," $2","@elseif($3)"," $4","@else"," $5","@endif"],"description":"Edge: if-else block"},"edge: @unless (...) ... @else ... @endunless":{"prefix":"unless","body":["@unless($1)"," $2","@else"," $3","@endunless"],"description":"Edge: unless-block"}},{"edge: @debugger":{"prefix":"debugger","body":["@debugger","$0"],"description":"Edge: Debug block"}},{"edge: {{ text }}":{"prefix":"echo","body":"{{ ${1:data} }}$2","description":"Edge: Echo data"},"edge: {{{ text }}}":{"prefix":"echo-html","body":"{{{ ${1:html_data} }}}$2","description":"Edge: Echo unescaped data (allow html outputs)"},"edge: @{{ text }}":{"prefix":"echo-raw","body":"@{{ ${1:variable} }}$2","description":"Edge: Echo untouched data (allow javascript expression)"}},{"edge: range(from, to)":{"prefix":"range","body":"{{ range($1, $2) }}","description":"Edge: Returns an array of numbers within a given range"},"edge: batch(array)":{"prefix":"batch","body":"{{ batch([ $1 ]) }}","description":"Edge: Convert an array to a batch of nested arrays."},"edge: toJSON(object)":{"prefix":"toJSON","body":"{{ toJSON({ $1 }) }}","description":"Edge: Convert an object to a JSON string via JSON.stringify."},"edge: first(array)":{"prefix":"first","body":"{{ first([ $1 ]) }}","description":"Edge: Returns the first item from an array."},"edge: last(array)":{"prefix":"last","body":"{{ last([ $1 ]) }}","description":"Edge: Returns the last item from an array."},"edge: groupBy(array)":{"prefix":"groupBy","body":"{{ groupBy([ $1 ], '$2') }}","description":"Edge: Group an array via given field. For example group all articles for an author."},"edge: size(array)":{"prefix":"size","body":"{{ size($1) }}","description":"Edge: Return size of a string or an array."},"edge: el(...)":{"prefix":"el","body":"{{ el($1) }}","description":"Edge: Returns an HTML string by replacing dynamic placeholders with actual content. It is helpful inside if shorthand."},"edge: camelCase(text)":{"prefix":"camelCase","body":"{{ camelCase('$1') }}","description":"Edge: Convert string to camelcase."},"edge: upperCase(text)":{"prefix":"upperCase","body":"{{ upperCase('$1') }}","description":"Edge: Convert string to uppercase."},"edge: upperFirst(text)":{"prefix":"upperFirst","body":"{{ upperFirst('$1') }}","description":"Edge: Convert first character of a string to uppercase."},"edge: lowerCase(text)":{"prefix":"lowerCase","body":"{{ lowerCase('$1') }}","description":"Edge: Convert string to lowerCase."},"edge: lowerFirst(text)":{"prefix":"lowerFirst","body":"{{ lowerFirst('$1') }}","description":"Edge: Convert first character of a string to lowercase."},"edge: capitalize(text)":{"prefix":"capitalize","body":"{{ capitalize('$1') }}","description":"Edge: Convert first character of all words inside a string to uppercase."},"edge: truncate (text1, limit, ...)":{"prefix":"truncate","body":"{{ truncate('$1', $2, '...') }}","description":"Edge: Truncate a string to a given limit"},"edge: toAnchor(url, title = url)":{"prefix":"toAnchor","body":"{{ toAnchor('$1', '$2') }}","description":"Edge: Convert a url to an anchor tag"},"edge: urlEncode(string)":{"prefix":"urlEncode","body":"{{ urlEncode('$1') }}","description":"Edge: Encode a string to be url safe."}},{"edge: @each(item as collection) ... @endeach":{"prefix":"each-array","body":["@each(${1:item} as ${2:collection})"," $3","@endeach"],"description":"Edge: @each array block"},"edge: @each( (key, value) in object) ... @endeach":{"prefix":"each-object","body":["@each(${1:key}, ${2:value} in ${3:object})"," $3","@endeach"],"description":"Edge: @each array block"},"edge: @each (item in collection) ... @endeach":{"prefix":"each-in","body":["@each(${1:item} in ${2:collection})"," $3","@endeach"],"description":"Edge: @each else block"},"edge: @each(item in collection) ... @else ... @endeach":{"prefix":"each-else","body":["@each(${1:item} in ${2:collection})"," $3","@else"," $4","@endeach"],"description":"Edge: @each else block"},"edge: $loop.index":{"prefix":"loop-index","body":"\\$loop.${1:index}$2","description":"Edge: Holds the iteration index, start from 0"},"edge: $loop.total":{"prefix":"loop-total","body":"\\$loop.${1:total}$2","description":"Edge: The total number of items"},"edge: @if($loop.first) ... @endif":{"prefix":"loop-first","body":["@if(\\$loop.first)"," ${1:{{-- This is the first iteration --\\}\\}}","@endif","$2"],"description":"Edge: Whether or not the item is the first in the loop"},"edge: @if($loop.last) ... @endif":{"prefix":"loop-last","body":["@if(\\$loop.last)"," ${1:{{-- This is the last iteration --\\}\\}}","@endif","$2"],"description":"Edge: Whether or not the item is the last in the loop"},"edge: @if(loop.isEven) ... @endif":{"prefix":"loop-isEven","body":["@if(\\$loop.isEven)"," ${1:{{-- This is the isEven code --\\}\\}}","@endif","$2"],"description":"Edge: Whether or not an iteration count is an even number"},"edge: @if($loop.isOdd) ... @endif":{"prefix":"loop-isOdd","body":["@if(\\$loop.isOdd)"," ${1:{{-- This is the isOdd code --\\}\\}}","@endif","$2"],"description":"Edge: Whether or not an iteration count is an odd number. The first item returns true for isOdd"}},{"edge: @layout('view')":{"prefix":"layout","body":"@layout('${1:name}')","description":"Edge: Layout view"},"edge: @extend('layout')":{"prefix":"extends","body":"@extends('${1:name}')$2","description":"Edge: Extends view layout"},"edge: @section('block') ... @endsection":{"prefix":"section-block","body":["@section('${1:name}')"," $2","@endsection"],"description":"Edge: Section block"},"edge: @!section('block')":{"prefix":"section","body":"@!section('${1:name}')","description":"Edge: Section no default"}},{"edge: @!each(item in collection, include = 'partial')":{"prefix":"each-include","body":"@!each(${1:item} in ${2:collection}, include = '${3:partial}')$4","description":"Edge: @each include"}},{"edge: @raw ... @endraw":{"prefix":"raw","body":["@raw"," $1","@endraw"],"description":"Edge: echo untouched data (allow javascript expression)"}},{"edge: @inlineSvg('path')":{"prefix":"inlineSvg","body":"@inlineSvg('${1:name}')$2","description":"Edge: Inline Svg"}},{"edge: @yield('value') ... @endyield":{"prefix":"yield","body":["@yield('$1')"," $2","@endyield"],"description":"Edge: yield slot"}}] \ No newline at end of file