Advertisement
pharmokan

codesandbox.io / vscode snippets file

Aug 22nd, 2020 (edited)
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 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 console0": {
  10. "scope": "javascript,typescript",
  11. "prefix": "log",
  12. "body": [
  13. "console.log($1);",
  14. "$2"
  15. ],
  16. "description": "Log output to console"
  17. },
  18. "Print to console1": {
  19. "scope": "javascript,typescript",
  20. "prefix": "cl",
  21. "body": [
  22. "console.log($1);",
  23. "$2"
  24. ],
  25. "description": "Log output to console"
  26. },
  27. "Print to console2": {
  28. "scope": "javascript,typescript",
  29. "prefix": "c",
  30. "body": [
  31. "console.log($1);",
  32. "$2"
  33. ],
  34. "description": "Log output to console"
  35. },
  36. "Print to console3": {
  37. "scope": "javascript,typescript",
  38. "prefix": "con",
  39. "body": [
  40. "console.log($1);",
  41. "$2"
  42. ],
  43. "description": "Log output to console"
  44. },
  45. "set state": {
  46. "scope": "javascript,typescript",
  47. "prefix": "sets",
  48. "body": [
  49. "const [$1,use$1] = useState($2);",
  50. "$3"
  51. ],
  52. "description": "react set state"
  53. },
  54. "import react": {
  55. "scope": "javascript,typescript",
  56. "prefix": "imp",
  57. "body": "import React, {useState,useEffects} from \"react\";",
  58. "description": "react set state"
  59. },
  60. "export default function": {
  61. "scope": "javascript,typescript",
  62. "prefix": "exp",
  63. "body": [
  64. "export default function $1($2) {",
  65. "$3",
  66. "}"
  67. ],
  68. "description": "react set state"
  69. },
  70. "JSON Stringify": {
  71. "scope": "javascript,typescript",
  72. "prefix": "str",
  73. "body": "JSON.stringify($1)",
  74. "description": "json stringify"
  75. },
  76. "JSON Stringify console log": {
  77. "scope": "javascript,typescript",
  78. "prefix": "cj",
  79. "body": [
  80. "console.log(JSON.stringify($1));",
  81. ],
  82. "description": "json stringify Log output to console"
  83. },
  84. "ternary if": {
  85. "scope": "javascript,typescript",
  86. "prefix": "ter",
  87. "body": "$1 ? $2 : $3;",
  88. "description": "ternary if js"
  89. },
  90. "map func": {
  91. "scope": "javascript,typescript",
  92. "prefix": "mp",
  93. "body": [
  94. "map( $1 => {",
  95. "\tx$2",
  96. "return $3",
  97. "})",
  98. "$4"
  99. ],
  100. "description": "map js func"
  101. },
  102. "if": {
  103. "scope": "javascript,typescript",
  104. "prefix": "iff",
  105. "body": [
  106. "if($1) {",
  107. "\t$2",
  108. "}",
  109. "$3"
  110. ],
  111. "description": "if"
  112. },
  113. "else if": {
  114. "scope": "javascript,typescript",
  115. "prefix": "elif",
  116. "body": [
  117. "else if($1) {",
  118. "\t$2",
  119. "}",
  120. "$3"
  121. ],
  122. "description": "elseif"
  123. },
  124. "Array Method": {
  125. "prefix": "arrmth",
  126. "body": [
  127. "${1|forEach,map,filter,reduce,some|}((${2:item}) => {",
  128. " $3",
  129. "})"
  130. ],
  131. "description": "Array Method"
  132. },
  133. "Function": {
  134. "scope": "javascript,typescript",
  135. "prefix": "func",
  136. "body": [
  137. "const $1 = ($2) => {",
  138. "\t$3",
  139. "\treturn $4",
  140. "};",
  141. "$5"
  142. ],
  143. "description": "const fat arrow function"
  144. },
  145. "(ES6) Arrow function": {
  146. "prefix": "fat",
  147. "body": [
  148. "($1) => {",
  149. "\t$0",
  150. "}"
  151. ],
  152. "description": "ES6 import syntax"
  153. },
  154. "(ES8) Async function 1": {
  155. "prefix": "async",
  156. "body": [
  157. "async function ${1:name} ($2) {",
  158. "\t${4:await ${3:new Promise((resolve) => resolve())}}$0",
  159. "}"
  160. ],
  161. "description": "ES6 import syntax"
  162. },
  163. "for...in": {
  164. "prefix": "for in",
  165. "body": [
  166. "for (const ${1:property} in ${2:obj}) {",
  167. "\t$0",
  168. "}"
  169. ],
  170. "description": "for...in syntax"
  171. },
  172.  
  173. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement