diff --git a/.vscode/settings.json b/.vscode/settings.json index c5fb600..a38e6a5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -28,6 +28,8 @@ "arrowfunction", "arsna", "arsnd", + "artsna", + "artsnd", "aruv", "caaf", "caaft", @@ -47,6 +49,7 @@ "kural", "paypal", "pranav", + "SWPM", "volta", "vuejs" ], diff --git a/CHANGELOG.md b/CHANGELOG.md index eac3a82..70a632e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,22 @@ Fixed for any bug fixes. Security to invite users to upgrade in case of vulnerabilities. --> +## 3.3.0 - 2023/04/15 + +### Added + +- tab jump position icon +- keyboards tricks on README +- `toSorted` on array snippets + +### Fixed + +- `cafe` snippets on JavaScript and TypeScript + +### Changed + +- rename snippets identifier + ## 3.2.0 - 2023/02/27 ### Added diff --git a/README.md b/README.md index 093f504..475ad10 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ The quick and easy way to create and use [Arrow Functions](https://developer.moz - [Arrays](#arrays) - [Functions](#functions) - [Examples](#examples) +- [Keyboard](#keyboard) - [Settings](#settings) - [About](#about) @@ -98,82 +99,84 @@ Arrow functions can never have duplicate named parameters, whether in strict or ## Snippets -Below is a list of all available snippets and the triggers of each one. The **→** means the `TAB` key and `█` the final cursor position. +Below is a list of all available snippets and the triggers of each one. The `░` means the `TAB` jump position and `█` the final cursor position. ### Arrow Function -| Trigger | Description | Result JS/TS | -| -------: | -------------------------------------- | ---------------------------------------------------------------- | -| `af→` | implicit return without arg(s) | `() => █` | -| `afa→` | implicit return with arg(s) | `(arg) => █` | -| `afad→` | implicit return with arg destructuring | `({prop, prop}) => █` | -| `afo→` | implicit return object | `() => ({prop: value█})` | -| `afoa→` | implicit return object with arg(s) | `(arg) => ({prop: value█})` | -| `afe→` | explicit return | () => {
  return █
}
| -| `afea→` | explicit return with arg(s) | (arg) => {
  return █
}
| -| `afead→` | explicit return with arg destructuring | ({prop, prop}) => {
  return █
}
| -| `afee→` | explicit empty | () => {
  █
}
| -| `afeea→` | explicit empty with arg(s) | (arg) => {
  █
}
| -| `afp→` | explicit with parentheses | () => {
  (█)
}
| -| `afpa→` | explicit with parentheses and arg(s) | (arg) => {
  (█)
}
| -| `afii→` | immediately invoque | `(() => █)()` | -| `iiaf→` | immediately invoque | `(() => █)()` | +| Trigger | Description | Result JS/TS | +| -------: | -------------------------------------- | -------------------------------------------------------------------- | +| `af→` | implicit return without arg(s) | `() => █` | +| `afa→` | implicit return with arg(s) | `(░arg) => █` | +| `afad→` | implicit return with arg destructuring | `({░prop, ░prop}) => █` | +| `afo→` | implicit return object | `() => ({░prop: value█})` | +| `afoa→` | implicit return object with arg(s) | `(░arg) => ({░prop: value█})` | +| `afe→` | explicit return | () => {
  ░return █
}
| +| `afea→` | explicit return with arg(s) | (░arg) => {
  ░return █
}
| +| `afead→` | explicit return with arg destructuring | ({░prop, ░prop}) => {
  ░return █
}
| +| `afee→` | explicit empty | () => {
  █
}
| +| `afeea→` | explicit empty with arg(s) | (░arg) => {
  █
}
| +| `afp→` | explicit with parentheses | () => {
  (█)
}
| +| `afpa→` | explicit with parentheses and arg(s) | (░arg) => {
  (█)
}
| +| `afii→` | immediately invoque | `(() => █)()` | +| `iiaf→` | immediately invoque | `(() => █)()` | #### Async Arrow Functions -| Trigger | Description | Result JS/TS | -| -------: | -------------------------------------- | ------------------------------------------------------------------------- | -| `aaf→` | implicit return without arg(s) | `async () => █` | -| `aafa→` | implicit return with arg(s) | `async (arg) => █` | -| `aafad→` | implicit with arg destructuring | `async ({ prop }) => █` | -| `aafe→` | explicit return | async () => {
  return █
}
| -| `aafea→` | explicit return with arg(s) | async (arg) => {
  return █
}
| -|`aafead→` | explicit return with arg destructuring | async ({prop, prop}) => {
  return █
}
| -| `aafee→` | explicit empty | async () => {
  █
}
| -|`aafeea→` | explicit empty with arg(s) | async (arg) => {
  █
}
| -|`aaafea→` | explicit with args and await | async (arg) => {
  const name = await █
}
| -| `aafii→` | immediately invoked | `(async () => █)()` | -| `iiaaf→` | immediately invoked | `(async () => █)()` | +| Trigger | Description | Result JS/TS | +| -------: | -------------------------------------- | ---------------------------------------------------------------------------- | +| `aaf→` | implicit return without arg(s) | `async () => █` | +| `aafa→` | implicit return with arg(s) | `async (░arg) => █` | +| `aafad→` | implicit with arg destructuring | `async ({ ░prop }) => █` | +| `aafe→` | explicit return | async () => {
  ░return █
}
| +| `aafea→` | explicit return with arg(s) | async (░arg) => {
  ░return █
}
| +|`aafead→` | explicit return with arg destructuring | async ({░prop, ░prop}) => {
  ░return █
}
| +| `aafee→` | explicit empty | async () => {
  █
}
| +|`aafeea→` | explicit empty with arg(s) | async (░arg) => {
  █
}
| +|`aaafea→` | explicit with args and await | async (░arg) => {
  const ░name = await █
}
| +| `aafii→` | immediately invoked | `(async () => █)()` | +| `iiaaf→` | immediately invoked | `(async () => █)()` | ### Promises -| Trigger | Description | Result JS/TS | -| -------: | ----------------------------------- | ----------------------------------------------------------------------------- | -| `afpr→` | promise implicit returns | promise
  .then((response) => { })
  .catch((error) => { })
  .finally(() => { })█
}
| -| `afr→` | implicit return response | `(response) => █` | -| `afrj→` | implicit return response json | `(response) => response.json()█` | -| `afrd→` | implicit return response data | `(response) => response.data█` | -| `afer→` | explicit return response | (response) => {
  return █
}
| -| `aferj→` | explicit return response json | (response) => {
  return response.json()
}█
| -| `aferd→` | explicit return response data | (response) => {
  return response.data
}█
| +| Trigger | Description | Result JS/TS | +| -------: | ----------------------------------- | ------------------------------------------------------------------------------- | +| `afpr→` | promise implicit returns | ░promise
  .then((░response) => {░})
  .catch((░error) => {░})
  .finally(() => {░})█
}
| +| `afr→` | implicit return response | `(░response) => █` | +| `afrj→` | implicit return response json | `(░response) => ░response.json()█` | +| `afrd→` | implicit return response data | `(░response) => ░response.data█` | +| `afer→` | explicit return response | (░response) => {
  ░return █
}
| +| `aferj→` | explicit return response json | (░response) => {
  return ░response.json()
}█
| +| `aferd→` | explicit return response data | (░response) => {
  return ░response.data
}█
| ### Arrays -| Trigger | Description | Result JS/TS | -| --------: | ------------------------| ---------------------------------------------------------------------------------------- | -| `arfeq→` | filter equal | `const newArray = array.filter((element) => element === value)█` | -| `arfne→` | filter not equal | `const newArray = array.filter((element) => element !== value)█` | -| `arfoeq→` | filter object equal | `const newArray = array.filter((element) => element.prop === value)█` | -| `arfone→` | filter object not equal | `const newArray = array.filter((element) => element.prop !== value)█` | -| `arsna→` | sort number ascending | `array.sort((a, z) => a - z)█` | -| `arsnd→` | sort number descending | `array.sort((a, z) => z - a)█` | -| `aruv→` | unique values | `const newArray = array.filter((current, index, arr) => arr.indexOf(current) == index)█` | +| Trigger | Description | Result JS/TS | +| ---------: | ------------------------------------ | ------------------------------------------------------------------------------------------------- | +| `arfeq→` | filter equal | `const ░newArray = ░array.filter((░element) => ░element === ░value)█` | +| `arfne→` | filter not equal | `const ░newArray = ░array.filter((░element) => ░element !== ░value)█` | +| `arfoeq→` | filter object equal | `const ░newArray = ░array.filter((░element) => ░element.░prop === ░value)█` | +| `arfone→` | filter object not equal | `const ░newArray = ░array.filter((░element) => ░element.░prop !== ░value)█` | +| `arsna→` | sort (mutate) number ascending | `░array.sort((a, z) => a - z)█` | +| `arsnd→` | sort (mutate) number descending | `░array.sort((a, z) => z - a)█` | +| `artsna→` | sort (not mutate) number ascending | `░array.toSorted((a, z) => a - z)█` | +| `artsnd→` | sort (not mutate) number descending | `░array.toSorted((a, z) => z - a)█` | +| `aruv→` | unique values | `const ░newArray = ░array.filter((░current, ░index, ░arr) => ░arr.indexOf(░current) == ░index)█` | ### Functions -| Trigger | Description | Result JS | Result TS | -| -------: | ----------------------------------------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `edaf→` | export default anonymous arrow function | export default () => {
  █
}
| export default () => {
  █
}
| -| `edaaf→` | export default async anonymous arrow function | export default async () => {
  █
}
| export default async () => {
  █
}
| -| `caf→` | const arrow function implicit return | const name = () => █ | const name = () => {█ | -| `cafe→` | const arrow function explicit return | const name = () => {
  return █
}
| const name = () => {
  return █
}
| -| `ecaf→` | export const arrow function | export const name = () => {
  █
}
| export const name = () => {
  █
}
| -| `caaf→` | const async arrow function | const name = async () => {
  █
}
| const name = async () => {
  █
}
| -| `ecaaf→` | export const async arrow function | export const name = async () => {
  █
}
| export const name = async () => {
  █
}
| -| `caft→` | const arrow function with type | | const name = () : type => {
  █
}
| -| `ecaft→` | export const arrow function with type | | export const name = () : type => {
  █
}
| -| `caaft→` | const async arrow function with type | | const name = async () : type => {
  █
}
| -| `ecaaft→` | export const async arrow function with type | | export const name = async () : type => {
  █
}
| +| Trigger | Description | Result JS | Result TS | +| -------: | ----------------------------------------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| `edaf→` | export default anonymous arrow function | export default (░) => {
  █
}
| export default (░) => {
  █
}
| +| `edaaf→` | export default async anonymous arrow function | export default async (░) => {
  █
}
| export default async (░) => {
  █
}
| +| `caf→` | const arrow function implicit return | const ░name = (░) => █ | const ░name = (░) => █ | +| `cafe→` | const arrow function explicit return | const ░name = (░) => {
  ░return █
}
| const ░name = (░) => {
  ░return █
}
| +| `ecaf→` | export const arrow function | export const ░name = (░) => {
  █
}
| export const ░name = (░) => {
  █
}
| +| `caaf→` | const async arrow function | const ░name = async (░) => {
  █
}
| const ░name = async (░) => {
  █
}
| +| `ecaaf→` | export const async arrow function | export const ░name = async (░) => {
  █
}
| export const ░name = async (░) => {
  █
}
| +| `caft→` | const arrow function with type | | const ░name = (░) : ░type => {
  █
}
| +| `ecaft→` | export const arrow function with type | | export const ░name = (░) : ░type => {
  █
}
| +| `caaft→` | const async arrow function with type | | const ░name = async (░) : ░type => {
  █
}
| +| `ecaaft→` | export const async arrow function with type | | export const ░name = async (░) : ░type => {
  █
}
| ⇧ [Back to menu](#menu) @@ -181,10 +184,6 @@ Below is a list of all available snippets and the triggers of each one. The ** ## Examples -Create a named arrow function combining `cv` and `af` - -![Function](https://raw.githubusercontent.com/deinsoftware/vscode-arrow-snippets/main/.github/examples/example-function.gif 'Function') - Create a response for `fetch` promise with `afrj` and `afrd` ![Promise](https://raw.githubusercontent.com/deinsoftware/vscode-arrow-snippets/main/.github/examples/example-promise.gif 'Promise') @@ -193,6 +192,19 @@ Create a response for `fetch` promise with `afrj` and `afrd` --- +## Keyboard + +Remember to complement the snippets with these keyboard shortcuts that can be used without needing to move the cursor to the start or to the end. + +| Action | Win/Linux | macOS | +| ----------------- | -----------------: | ----------------: | +| Insert line above | `ctrl+shift+enter` | `cmd+shift+enter` | +| Insert line below | `ctrl+enter` | `cmd+enter` | + +⇧ [Back to menu](#menu) + +--- + ## Settings The `editor.snippetSuggestions` setting in vscode `settings.json` will show snippets on top of the suggestion list. @@ -211,6 +223,7 @@ The `editor.snippetSuggestions` setting in vscode `settings.json` will show snip - [VS Code](https://code.visualstudio.com/) - Code editing redefined. - [Figma](https://www.figma.com/) - The collaborative interface design tool. +- [SWPM](https://www.npmjs.com/package/swpm) - One Package Manager to command them all. ### Contributing diff --git a/package.json b/package.json index 0847f90..87b426b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "arrow-function-snippets", "description": "VS Code Arrow function snippets for JS and TS", - "version": "3.2.0", + "version": "3.3.0", "displayName": "Arrow Function Snippets", "publisher": "deinsoftware", "icon": "images/light-icon.png", diff --git a/snippets/arrays.json b/snippets/arrays.json index b84f078..05d06a6 100644 --- a/snippets/arrays.json +++ b/snippets/arrays.json @@ -1,35 +1,45 @@ { - "arrayFilterEqual": { + "array.Filter.Equal": { "prefix": "arfeq", "body": "const ${1:newArray} = ${2:array}.filter((${3:element}) => ${3:element} === ${4:value})$0", "description": "Array Filter compare equal" }, - "arrayFilterNotEqual": { + "array.Filter.NotEqual": { "prefix": "arfne", "body": "const ${1:newArray} = ${2:array}.filter((${3:element}) => ${3:element} !== ${4:value})$0", "description": "Array Filter compare not equal" }, - "arrayFilterObjectEqual": { + "array.Filter.Object.Equal": { "prefix": "arfoeq", "body": "const ${1:newArray} = ${2:array}.filter((${3:element}) => ${3:element}.${4:prop} === ${5:value})$0", "description": "Array Filter Object compare equal" }, - "arrayFilterObjectNotEqual": { + "array.Filter.Object.NotEqual": { "prefix": "arfone", "body": "const ${1:newArray} = ${2:array}.filter((${3:element}) => ${3:element}.${4:prop} !== ${5:value})$0", "description": "Array Filter Object compare not equal" }, - "arraySortNumberAsc": { + "array.Sort.Number.Asc": { "prefix": "arsna", "body": "${1:array}.sort((${2:a}, ${3:z}) => ${2:a} - ${3:z})$0", - "description": "Array sort numbers ascending" + "description": "Array sort (mutate) numbers ascending" }, - "arraySortNumberDesc": { + "array.Sort.Number.Desc": { "prefix": "arsnd", "body": "${1:array}.sort((${2:a}, ${3:z}) => ${3:z} - ${2:a})$0", - "description": "Array sort numbers descending" + "description": "Array sort (mutate) numbers descending" }, - "arrayUniqueValues": { + "array.ToSorted.Number.Asc": { + "prefix": "artsna", + "body": "${1:array}.toSorted((${2:a}, ${3:z}) => ${2:a} - ${3:z})$0", + "description": "Array sort (not mutate) numbers ascending" + }, + "array.ToSorted.Number.Desc": { + "prefix": "artsnd", + "body": "${1:array}.toSorted((${2:a}, ${3:z}) => ${3:z} - ${2:a})$0", + "description": "Array sort (not mutate) numbers descending" + }, + "array.UniqueValues": { "prefix": "aruv", "body": "const ${1:newArray} = ${2:array}.filter((${3:current}, ${4:index}, ${5:arr}) => ${5:arr}.indexOf(${3:current}) == ${4:index})$0", "description": "Array unique values" diff --git a/snippets/arrow.json b/snippets/arrow.json index 7dbe99f..259f74d 100644 --- a/snippets/arrow.json +++ b/snippets/arrow.json @@ -4,62 +4,62 @@ "body": "() => $0", "description": "Arrow function (implicit return)" }, - "arrowFunctionWithArguments": { + "arrowFunction.WithArguments": { "prefix": "afa", "body": "(${1:arg}) => $0", "description": "Arrow function (implicit return) with arguments" }, - "arrowFunctionWithArgumentDestructuring": { + "arrowFunction.WithArgument.Destructuring": { "prefix": "afad", "body": "({${1:prop}, ${2:prop}}) => $0", "description": "Arrow function (implicit return) with argument destructuring" }, - "arrowFunctionObject": { + "arrowFunction.Object": { "prefix": "afo", "body": "() => ( { ${1:prop}:${0:value}} )", "description": "Arrow function (object literal implicit return)" }, - "arrowFunctionObjectWithArguments": { + "arrowFunction.Object.WithArguments": { "prefix": "afoa", "body": "(${1:arg}) => ( { ${2:prop}:${0:value}} )", "description": "Arrow function (object literal implicit return) with arguments" }, - "arrowFunctionExplicit": { + "arrowFunction.Explicit": { "prefix": "afe", "body": ["() => {", "\t${1:return} $0", "}"], "description": "Arrow function (explicit return)" }, - "arrowFunctionExplicitWithArguments": { + "arrowFunction.Explicit.WithArguments": { "prefix": "afea", "body": ["(${1:arg}) => {", "\t${2:return} $0", "}"], "description": "Arrow function (explicit return) with arguments" }, - "arrowFunctionExplicitWithArgumentDestructuring": { + "arrowFunction.Explicit.WithArgument.Destructuring": { "prefix": "afead", "body": ["({${1:prop}, ${2:prop}}) => {", "\t${3:return} $0", "}"], "description": "Arrow function (explicit return) with argument destructuring" }, - "arrowFunctionExplicitEmpty": { + "arrowFunction.Explicit.Empty": { "prefix": "afee", "body": ["() => {", "\t$0", "}"], "description": "Arrow function (without return)" }, - "arrowFunctionExplicitEmptyWithArguments": { + "arrowFunction.Explicit.Empty.WithArguments": { "prefix": "afeea", "body": ["(${1:arg}) => {", "\t$0", "}"], "description": "Arrow function (without return) with arguments" }, - "arrowFunctionParentheses": { + "arrowFunction.Parentheses": { "prefix": "afp", "body": ["() => {", "\t( ${0} )", "}"], "description": "Arrow function (explicit without return)" }, - "arrowFunctionParenthesesWithArguments": { + "arrowFunction.Parentheses.WithArguments": { "prefix": "afpa", "body": ["(${1:arg}) => {", "\t( ${0} )", "}"], "description": "Arrow function (explicit without return) with arguments" }, - "arrowFunctionImmediatelyInvoque": { + "arrowFunction.ImmediatelyInvoque": { "prefix": ["iiaf", "afii"], "body": "(() => $0)()", "description": "Arrow function Immediately Invoke" @@ -69,47 +69,47 @@ "body": "async () => $0", "description": "Arrow async function" }, - "arrowAsyncFunctionWithArguments": { + "arrowAsyncFunction.WithArguments": { "prefix": "aafa", "body": "async (${1:arg}) => $0", "description": "Arrow async function (implicit return) with arguments" }, - "arrowAsyncFunctionImplicitWithArgumentDestructuring": { + "arrowAsyncFunction.Implicit.WithArgument.Destructuring": { "prefix": "aafad", "body": "async ({ ${1:prop} }) => $0", "description": "Arrow async function (explicit return) with argument destructuring" }, - "arrowAsyncFunctionExplicitReturn": { + "arrowAsyncFunction.Explicit.Return": { "prefix": "aafe", "body": ["async () => {", "\t${1:return} $0", "}"], "description": "Arrow async function (explicit with return)" }, - "arrowAsyncFunctionExplicitWithArguments": { + "arrowAsyncFunction.Explicit.WithArguments": { "prefix": "aafea", "body": ["async (${1:arg}) => {", "\t${2:return} $0", "}"], "description": "Arrow async function (explicit without return) with arguments" }, - "arrowAsyncFunctionExplicitWithArgumentDestructuring": { + "arrowAsyncFunction.Explicit.WithArgument.Destructuring": { "prefix": "aafead", "body": ["async ({ ${1:prop}, ${2:prop} }) => {", "\t${3:return} $0", "}"], "description": "Arrow async function (explicit return) with argument destructuring" }, - "arrowAsyncFunctionExplicitEmpty": { + "arrowAsyncFunction.Explicit.Empty": { "prefix": "aafee", "body": ["async () => {", "\t$0", "}"], "description": "Arrow async function (without return)" }, - "arrowAsyncFunctionExplicitEmptyWithArguments": { + "arrowAsyncFunction.Explicit.Empty.WithArguments": { "prefix": "aafeea", "body": ["async (${1:arg}) => {", "\t$0", "}"], "description": "Arrow async function (without return) with arguments" }, - "arrowAsyncAwaitFunctionExplicitWithArguments": { + "arrowAsyncAwaitFunction.Explicit.WithArguments": { "prefix": "aaafea", "body": ["async (${1:arg}) => {", "\tconst ${2:name} = await ${0}", "}"], "description": "Arrow async-await function (explicit without return) with arguments" }, - "arrowAsyncFunctionImmediatelyInvoque": { + "arrowAsyncFunction.ImmediatelyInvoque": { "prefix": ["iiaaf", "aafii"], "body": "(async () => $0)()", "description": "Arrow async function Immediately Invoke" diff --git a/snippets/function-js.json b/snippets/function-js.json index c99bb41..87f0cae 100644 --- a/snippets/function-js.json +++ b/snippets/function-js.json @@ -1,35 +1,35 @@ { - "exportDefaultArrowFunction": { + "export.Default.ArrowFunction": { "prefix": "edaf", "body": ["export default ($1) => {", "\t$0", "}"], "description": "Export Default Anonymous Arrow function" }, - "exportDefaultAsyncArrowFunction": { + "export.Default.AsyncArrowFunction": { "prefix": "edaaf", "body": ["export default async ($1) => {", "\t$0", "}"], "description": "Export Default Async Anonymous Arrow function" }, - "constantArrowFunction": { + "constant.ArrowFunction": { "prefix": "caf", "body": ["const ${1:name} = ($2) => $0"], "description": "Constant Arrow function (implicit return)" }, - "constantArrowFunctionExplicit": { + "constant.ArrowFunction.Explicit": { "prefix": "cafe", - "body": ["const ${1:name} = ($2) => {", "\treturn $0", "}"], + "body": ["const ${1:name} = ($2) => {", "\t${3:return} $0", "}"], "description": "Constant Arrow function (explicit return)" }, - "exportConstantArrowFunction": { + "export.Constant.ArrowFunction": { "prefix": "ecaf", "body": ["export const ${1:name} = ($2) => {", "\t$0", "}"], "description": "Export Constant Arrow function" }, - "constantAsyncArrowFunction": { + "constant.AsyncArrowFunction": { "prefix": "caaf", "body": ["const ${1:name} = async ($2) => {", "\t$0", "}"], "description": "Constant Async Arrow function" }, - "exportConstantAsyncArrowFunction": { + "export.Constant.AsyncArrowFunction": { "prefix": "ecaaf", "body": ["export const ${1:name} = async ($2) => {", "\t$0", "}"], "description": "Export Constant Async Arrow function" diff --git a/snippets/function-ts.json b/snippets/function-ts.json index 5c058c4..5dd35b5 100644 --- a/snippets/function-ts.json +++ b/snippets/function-ts.json @@ -1,40 +1,40 @@ { - "exportDefaultArrowFunction": { + "export.Default.ArrowFunction": { "prefix": "edaf", "body": ["export default ($1) => {", "\t$0", "}"], "description": "Export Default Anonymous Arrow function" }, - "exportDefaultAsyncArrowFunction": { + "export.Default.AsyncArrowFunction": { "prefix": "edaaf", "body": ["export default async ($1) => {", "\t$0", "}"], "description": "Export Default Async Anonymous Arrow function" }, - "constantArrowFunction": { + "constant.ArrowFunction": { "prefix": "caf", "body": ["const ${1:name} = ($2) => $0"], "description": "Constant Arrow function (implicit return)" }, - "constantArrowFunctionExplicit": { + "constant.ArrowFunction.Explicit": { "prefix": "cafe", - "body": ["const ${1:name} = ($2) => {", "\treturn $0", "}"], + "body": ["const ${1:name} = ($2) => {", "\t${3:return} $0", "}"], "description": "Constant Arrow function (explicit return)" }, - "exportConstantArrowFunction": { + "export.Constant.ArrowFunction": { "prefix": "ecaf", "body": ["export const ${1:name} = ($2) => {", "\t$0", "}"], "description": "Export Constant Arrow function" }, - "constantAsyncArrowFunction": { + "constant.Async.ArrowFunction": { "prefix": "caaf", "body": ["const ${1:name} = async ($2) => {", "\t$0", "}"], "description": "Constant Async Arrow function" }, - "exportConstantAsyncArrowFunction": { + "export.Constant.AsyncArrowFunction": { "prefix": "ecaaf", "body": ["export const ${1:name} = async ($2) => {", "\t$0", "}"], "description": "Export Constant Async Arrow function" }, - "constantArrowFunctionType": { + "constant.ArrowFunction.Type": { "prefix": "caft", "body": [ "const ${1:name} = ($2) : ${3|string,number,boolean,custom|} => {", @@ -43,7 +43,7 @@ ], "description": "Constant Arrow function (explicit return type)" }, - "exportConstantArrowFunctionType": { + "export.ConstantArrow.Function.Type": { "prefix": "ecaft", "body": [ "export const ${1:name} = ($2) : ${3|string,number,boolean,custom|} => {", @@ -52,7 +52,7 @@ ], "description": "Export Constant Arrow function (explicit return type)" }, - "constantAsyncArrowFunctionType": { + "constant.AsyncArrowFunction.Type": { "prefix": "caaft", "body": [ "const ${1:name} = async ($2) : ${3|string,number,boolean,custom|} => {", @@ -61,7 +61,7 @@ ], "description": "Constant Async Arrow function (explicit return type)" }, - "exportConstantAsyncArrowFunctionType": { + "export.Constant.AsyncArrowFunction.Type": { "prefix": "ecaaft", "body": [ "export const ${1:name} = async ($2) : ${3|string,number,boolean,custom|} => {", diff --git a/snippets/promises.json b/snippets/promises.json index 934003d..336350f 100644 --- a/snippets/promises.json +++ b/snippets/promises.json @@ -1,5 +1,5 @@ { - "arrowFunctionPromise": { + "arrowFunction.Promise": { "prefix": "afpr", "body": [ "${1:promise}", @@ -9,32 +9,32 @@ ], "description": "Arrow function Promise" }, - "arrowFunctionResponse": { + "arrowFunction.Response": { "prefix": "afr", "body": "(${1:response}) => $0", "description": "Arrow function (implicit return) response" }, - "arrowFunctionResponseJson": { + "arrowFunction.Response.Json": { "prefix": "afrj", "body": "(${1:response}) => ${1:response}.json()$0", "description": "Arrow function (implicit return) response json" }, - "arrowFunctionResponseData": { + "arrowFunction.Response.Data": { "prefix": "afrd", "body": "(${1:response}) => ${1:response}.data$0", "description": "Arrow function (implicit return) response data" }, - "arrowFunctionExplicitResponse": { + "arrowFunction.Explicit.Response": { "prefix": "afer", "body": ["(${1:response}) => {", "\treturn $0", "}"], "description": "Arrow function (explicit return)" }, - "arrowFunctionExplicitResponseJson": { + "arrowFunction.Explicit.Response.Json": { "prefix": "aferj", "body": ["(${1:response}) => {", "\treturn ${1:response}.json()", "}$0"], "description": "Arrow function (explicit return) response json" }, - "arrowFunctionExplicitResponseData": { + "arrowFunction.Explicit.Response.Data": { "prefix": "aferd", "body": ["(${1:response}) => {", "\treturn ${1:response}.data", "}$0"], "description": "Arrow function (explicit return) response data"