snippets.json 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. {
  2. "Inner class": {
  3. "prefix": "class",
  4. "body": [
  5. "class $1 extends ${2:Reference}",
  6. "\t$3"
  7. ]
  8. },
  9. "Print messages to console": {
  10. "prefix": "pr",
  11. "body": [
  12. "print($1)"
  13. ]
  14. },
  15. "_ready method of Node": {
  16. "prefix": "ready",
  17. "body": [
  18. "func _ready():",
  19. "\t${1:pass}"
  20. ]
  21. },
  22. "_init method of Object": {
  23. "prefix": "init",
  24. "body": [
  25. "func _init():",
  26. "\t${1:pass}"
  27. ]
  28. },
  29. "_process method of Node": {
  30. "prefix": "process",
  31. "body": [
  32. "func _process(delta):",
  33. "\t${1:pass}"
  34. ]
  35. },
  36. "_physics_process method of Node": {
  37. "prefix": "physics",
  38. "body": [
  39. "func _physics_process(delta):",
  40. "\t${1:pass}"
  41. ]
  42. },
  43. "_input method of Node": {
  44. "prefix": "input",
  45. "body": [
  46. "func _input(event):",
  47. "\t${1:pass}"
  48. ]
  49. },
  50. "_input_event method of Node": {
  51. "prefix": "inpute",
  52. "body": [
  53. "func _input_event(event):",
  54. "\t${1:pass}"
  55. ]
  56. },
  57. "_unhandled_input method of Node": {
  58. "prefix": "uinput",
  59. "body": [
  60. "func _unhandled_input(event):",
  61. "\t${1:pass}"
  62. ]
  63. },
  64. "_draw method of Node": {
  65. "prefix": "draw",
  66. "body": [
  67. "func _draw():",
  68. "\t${1:pass}"
  69. ]
  70. },
  71. "_gui_input method of Node": {
  72. "prefix": "guii",
  73. "body": [
  74. "func _gui_input(event):",
  75. "\t${1:pass}"
  76. ]
  77. },
  78. "for loop": {
  79. "prefix": "for",
  80. "body": [
  81. "for $1 in $2:",
  82. "\t${3:pass}"
  83. ]
  84. },
  85. "for range loop": {
  86. "prefix": "for",
  87. "body": [
  88. "for $1 in range(${2:start}{$3:,end}):",
  89. "\t${4:pass}"
  90. ]
  91. },
  92. "if elif else": {
  93. "prefix": "if",
  94. "body": [
  95. "if ${1:condition}:",
  96. "\t${3:pass}",
  97. "elif ${2:condition}:",
  98. "\t${4:pass}",
  99. "else:",
  100. "\t${5:pass}"
  101. ]
  102. },
  103. "if else": {
  104. "prefix": "if",
  105. "body": [
  106. "if ${1:condition}:",
  107. "\t${2:pass}",
  108. "else:",
  109. "\t${3:pass}"
  110. ]
  111. },
  112. "if": {
  113. "prefix": "if",
  114. "body": [
  115. "if ${1:condition}:",
  116. "\t${2:pass}"
  117. ]
  118. },
  119. "while": {
  120. "prefix": "while",
  121. "body": [
  122. "while ${1:condition}:",
  123. "\t${2:pass}"
  124. ]
  125. },
  126. "function define": {
  127. "prefix": "func",
  128. "body": [
  129. "func ${1:method}(${2:args}):",
  130. "\t${3:pass}"
  131. ]
  132. },
  133. "match": {
  134. "prefix": "match",
  135. "body": [
  136. "match ${1:expression}:\n\t${2:pattern}:\n\t\t${3}\n\t_:\n\t\t${0:default}"
  137. ]
  138. },
  139. "signal declaration": {
  140. "prefix": "signal",
  141. "body": [
  142. "signal ${1:signalname}(${2:args})"
  143. ]
  144. },
  145. "export variables": {
  146. "prefix": "export",
  147. "body": [
  148. "@export(${1:type}${2:,other_configs}) var ${3:name}${4: = default}${5: setget }"
  149. ]
  150. },
  151. "define variables": {
  152. "prefix": "var",
  153. "body": [
  154. "var ${1:name}${2: = default}${3: setget }"
  155. ]
  156. },
  157. "define onready variables": {
  158. "prefix": "onready",
  159. "body": [
  160. "onready var ${1:name} = get_node($2)"
  161. ]
  162. },
  163. "Is instance of a class or script": {
  164. "prefix": "is",
  165. "body": [
  166. "${1:instance} is ${2:class}"
  167. ]
  168. },
  169. "element in array": {
  170. "prefix": "in",
  171. "body": [
  172. "${1:element} in ${$2:array}"
  173. ]
  174. },
  175. "GDScript template": {
  176. "prefix": "gdscript",
  177. "body": [
  178. "extends ${1:BaseClass}",
  179. "",
  180. "# class member variables go here, for example:",
  181. "# var a = 2",
  182. "# var b = \"textvar\"",
  183. "",
  184. "func _ready():",
  185. "\t# Called every time the node is added to the scene.",
  186. "\t# Initialization here",
  187. "\tpass",
  188. ""
  189. ]
  190. },
  191. "pass statement": {
  192. "prefix": "pass",
  193. "body": [
  194. "pass"
  195. ]
  196. },
  197. "GDScript Void": {
  198. "prefix": [
  199. "void"
  200. ],
  201. "body": [
  202. "func ${1:function_name}($2) -> void:",
  203. "\t${3:pass}"
  204. ],
  205. "description": "Void function"
  206. },
  207. "GDScript Load Resource": {
  208. "prefix": [
  209. "loadres",
  210. "ld"
  211. ],
  212. "body": [
  213. "load(\"res://${1:resource_path}\")$0"
  214. ],
  215. "description": "Quickly load a resource with the 'res://' prefix"
  216. },
  217. "GDScript Preload Resource": {
  218. "prefix": [
  219. "preloadres",
  220. "pl"
  221. ],
  222. "body": [
  223. "preload(\"res://${1:resource_path}\")$0"
  224. ],
  225. "description": "Quickly preload a resource with the 'res://' prefix"
  226. },
  227. "GDScript Variable with Getter and Setter": {
  228. "prefix": [
  229. "gs",
  230. "vargetset"
  231. ],
  232. "body": [
  233. "var ${1:variable_name}:",
  234. "\tget:",
  235. "\t\treturn ${1:variable_name}",
  236. "\tset(value):",
  237. "\t\t${1:variable_name} = value"
  238. ],
  239. "description": "Creates a variable with getter and setter functions in GDScript"
  240. },
  241. "GDScript Variable with Getter and Setter (typed)": {
  242. "prefix": [
  243. "gst",
  244. "vargetsettyped"
  245. ],
  246. "body": [
  247. "var ${1:variable_name}: ${2:String}:",
  248. "\tget:",
  249. "\t\treturn ${1:variable_name}",
  250. "\tset(value):",
  251. "\t\t${1:variable_name} = value"
  252. ],
  253. "description": "Creates a typed variable with getter and setter functions in GDScript"
  254. },
  255. "GDScript export var": {
  256. "prefix": [
  257. "exportvar",
  258. "xp"
  259. ],
  260. "body": [
  261. "export var ${1:variable_name}: ${2:String} = ${3:default_value}"
  262. ],
  263. "description": "Creates an exported (typed) variable in GDScript"
  264. },
  265. "GDScript tween": {
  266. "prefix": [
  267. "tween",
  268. "tw"
  269. ],
  270. "body": [
  271. "var tween := create_tween()"
  272. ],
  273. "description": "Creates a tween object"
  274. },
  275. "GDScript wait": {
  276. "prefix": [
  277. "wait",
  278. "timer"
  279. ],
  280. "body": [
  281. "await get_tree().create_timer($1).timeout"
  282. ],
  283. "description": "Waits for a given amount of seconds"
  284. }
  285. }