coffee.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. ace.define("ace/snippets/coffee",["require","exports","module"], function(require, exports, module) {
  2. "use strict";
  3. exports.snippetText = "# Closure loop\n\
  4. snippet forindo\n\
  5. for ${1:name} in ${2:array}\n\
  6. do ($1) ->\n\
  7. ${3:// body}\n\
  8. # Array comprehension\n\
  9. snippet fora\n\
  10. for ${1:name} in ${2:array}\n\
  11. ${3:// body...}\n\
  12. # Object comprehension\n\
  13. snippet foro\n\
  14. for ${1:key}, ${2:value} of ${3:object}\n\
  15. ${4:// body...}\n\
  16. # Range comprehension (inclusive)\n\
  17. snippet forr\n\
  18. for ${1:name} in [${2:start}..${3:finish}]\n\
  19. ${4:// body...}\n\
  20. snippet forrb\n\
  21. for ${1:name} in [${2:start}..${3:finish}] by ${4:step}\n\
  22. ${5:// body...}\n\
  23. # Range comprehension (exclusive)\n\
  24. snippet forrex\n\
  25. for ${1:name} in [${2:start}...${3:finish}]\n\
  26. ${4:// body...}\n\
  27. snippet forrexb\n\
  28. for ${1:name} in [${2:start}...${3:finish}] by ${4:step}\n\
  29. ${5:// body...}\n\
  30. # Function\n\
  31. snippet fun\n\
  32. (${1:args}) ->\n\
  33. ${2:// body...}\n\
  34. # Function (bound)\n\
  35. snippet bfun\n\
  36. (${1:args}) =>\n\
  37. ${2:// body...}\n\
  38. # Class\n\
  39. snippet cla class ..\n\
  40. class ${1:`substitute(Filename(), '\\(_\\|^\\)\\(.\\)', '\\u\\2', 'g')`}\n\
  41. ${2}\n\
  42. snippet cla class .. constructor: ..\n\
  43. class ${1:`substitute(Filename(), '\\(_\\|^\\)\\(.\\)', '\\u\\2', 'g')`}\n\
  44. constructor: (${2:args}) ->\n\
  45. ${3}\n\
  46. \n\
  47. ${4}\n\
  48. snippet cla class .. extends ..\n\
  49. class ${1:`substitute(Filename(), '\\(_\\|^\\)\\(.\\)', '\\u\\2', 'g')`} extends ${2:ParentClass}\n\
  50. ${3}\n\
  51. snippet cla class .. extends .. constructor: ..\n\
  52. class ${1:`substitute(Filename(), '\\(_\\|^\\)\\(.\\)', '\\u\\2', 'g')`} extends ${2:ParentClass}\n\
  53. constructor: (${3:args}) ->\n\
  54. ${4}\n\
  55. \n\
  56. ${5}\n\
  57. # If\n\
  58. snippet if\n\
  59. if ${1:condition}\n\
  60. ${2:// body...}\n\
  61. # If __ Else\n\
  62. snippet ife\n\
  63. if ${1:condition}\n\
  64. ${2:// body...}\n\
  65. else\n\
  66. ${3:// body...}\n\
  67. # Else if\n\
  68. snippet elif\n\
  69. else if ${1:condition}\n\
  70. ${2:// body...}\n\
  71. # Ternary If\n\
  72. snippet ifte\n\
  73. if ${1:condition} then ${2:value} else ${3:other}\n\
  74. # Unless\n\
  75. snippet unl\n\
  76. ${1:action} unless ${2:condition}\n\
  77. # Switch\n\
  78. snippet swi\n\
  79. switch ${1:object}\n\
  80. when ${2:value}\n\
  81. ${3:// body...}\n\
  82. \n\
  83. # Log\n\
  84. snippet log\n\
  85. console.log ${1}\n\
  86. # Try __ Catch\n\
  87. snippet try\n\
  88. try\n\
  89. ${1}\n\
  90. catch ${2:error}\n\
  91. ${3}\n\
  92. # Require\n\
  93. snippet req\n\
  94. ${2:$1} = require '${1:sys}'${3}\n\
  95. # Export\n\
  96. snippet exp\n\
  97. ${1:root} = exports ? this\n\
  98. ";
  99. exports.scope = "coffee";
  100. });