Guest User

Untitled

a guest
Jul 22nd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. {
  2. // Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
  3. // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
  4. // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
  5. // used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
  6. // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
  7. // Placeholders with the same ids are connected.
  8. // Example:
  9. // "Print to console": {
  10. // "scope": "javascript,typescript",
  11. // "prefix": "log",
  12. // "body": [
  13. // "console.log('$1');",
  14. // "$2"
  15. // ],
  16. // "description": "Log output to console"
  17. // }
  18.  
  19.  
  20. "logn": {
  21. "scope": "javascript,typescript",
  22. "prefix": "logn",
  23. "body": "console.log(`$1:`, $1)"
  24. },
  25.  
  26. "Failable async": {
  27. "scope": "javascript,typescript",
  28. "prefix": "failasync",
  29. "body": "const $1 = await \nif (isFailure($1)) return $1\nconst $2 = payload($1)"
  30. },
  31.  
  32. "Failable sync": {
  33. "scope": "javascript,typescript",
  34. "prefix": "failsync",
  35. "body": "const $1 = \nif (isFailure($1)) return $1\nconst $2 = payload($1)"
  36. },
  37.  
  38. "jstr": {
  39. "scope": "javascript,typescript",
  40. "prefix": "jstr",
  41. "body": "JSON.stringify($1)"
  42. },
  43.  
  44. "assres": {
  45. "scope": "javascript,typescript",
  46. "prefix": "assres",
  47. "body": "const result = $1()\nassertSuccess(result)"
  48. },
  49.  
  50. "dassres": {
  51. "scope": "javascript,typescript",
  52. "prefix": "dassres",
  53. "body": "describe(`$1()`, () => {\nit(`should $2`, () => {\nconst result = $1()\nassertSuccess(result)\n})\n})"
  54. },
  55.  
  56. "newFunc": {
  57. "scope": "javascript,typescript",
  58. "prefix":"newFunc",
  59. "body":"const $1 = () => {return success()}"
  60. },
  61.  
  62. "describe": {
  63. "scope": "javascript,typescript",
  64. "prefix": "describe",
  65. "body": "describe(`$1`, () => {\n$2\n})"
  66. },
  67.  
  68. "itsync": {
  69. "scope": "javascript,typescript",
  70. "prefix": "itsync",
  71. "body": "it(`should $1`, () => {\n$2\n})"
  72. },
  73.  
  74. "itasync": {
  75. "scope": "javascript,typescript",
  76. "prefix": "itasync",
  77. "body": "it(`should $1`, async () => {\n$2\n})"
  78. },
  79.  
  80. "failable": {
  81. "scope": "javascript,typescript",
  82. "prefix": "failable",
  83. "body": "const { $1 } = require(`@pheasantplucker/failables`)"
  84. },
  85.  
  86. "async arrow fn": {
  87. "scope": "javascript,typescript",
  88. "prefix": "asyncfn",
  89. "body": "async () => {\n\t$1\n}"
  90. },
  91.  
  92. "sync arrow fn": {
  93. "scope": "javascript,typescript",
  94. "prefix": "sync",
  95. "body": "() => {\n\t$1\n}"
  96. },
  97.  
  98. "promise": {
  99. "scope": "javascript,typescript",
  100. "prefix": "promise",
  101. "body": "new Promise((resolve) => {\n\t$1\n})"
  102. },
  103.  
  104. "trycatch": {
  105. "scope": "javascript,typescript",
  106. "prefix": "try",
  107. "body": "try {\n\t$1\n} catch (e) {\n\treturn failure(e.toString())\n}"
  108. },
  109.  
  110. "import deepequal as equal": {
  111. "scope": "javascript,typescript",
  112. "prefix": "reqass",
  113. "body": "const equal = require(\"assert\").deepEqual"
  114. },
  115.  
  116. "if fail return failure": {
  117. "scope": "javascript,typescript",
  118. "prefix": "rf",
  119. "body": "if (isFailure($1)) return $1"
  120. }
  121. }
Add Comment
Please, Sign In to add comment