ace-rails-ap 2.0.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -4
  3. data/lib/ace/rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/ace/ace.js +14194 -13349
  5. data/vendor/assets/javascripts/ace/ext-beautify.js +335 -0
  6. data/vendor/assets/javascripts/ace/ext-chromevox.js +6 -1
  7. data/vendor/assets/javascripts/ace/ext-elastic_tabstops_lite.js +8 -33
  8. data/vendor/assets/javascripts/ace/ext-emmet.js +487 -424
  9. data/vendor/assets/javascripts/ace/ext-error_marker.js +6 -0
  10. data/vendor/assets/javascripts/ace/ext-keybinding_menu.js +45 -72
  11. data/vendor/assets/javascripts/ace/ext-language_tools.js +734 -578
  12. data/vendor/assets/javascripts/ace/ext-linking.js +53 -0
  13. data/vendor/assets/javascripts/ace/ext-modelist.js +25 -10
  14. data/vendor/assets/javascripts/ace/ext-old_ie.js +93 -120
  15. data/vendor/assets/javascripts/ace/ext-searchbox.js +8 -41
  16. data/vendor/assets/javascripts/ace/ext-settings_menu.js +229 -234
  17. data/vendor/assets/javascripts/ace/ext-spellcheck.js +7 -3
  18. data/vendor/assets/javascripts/ace/ext-split.js +13 -37
  19. data/vendor/assets/javascripts/ace/ext-static_highlight.js +16 -39
  20. data/vendor/assets/javascripts/ace/ext-statusbar.js +8 -2
  21. data/vendor/assets/javascripts/ace/ext-textarea.js +254 -99
  22. data/vendor/assets/javascripts/ace/ext-themelist.js +13 -40
  23. data/vendor/assets/javascripts/ace/ext-whitespace.js +17 -41
  24. data/vendor/assets/javascripts/ace/keybinding-emacs.js +803 -788
  25. data/vendor/assets/javascripts/ace/keybinding-vim.js +1559 -1560
  26. data/vendor/assets/javascripts/ace/mode-abap.js +52 -83
  27. data/vendor/assets/javascripts/ace/mode-actionscript.js +27 -63
  28. data/vendor/assets/javascripts/ace/mode-ada.js +27 -58
  29. data/vendor/assets/javascripts/ace/mode-apache_conf.js +310 -0
  30. data/vendor/assets/javascripts/ace/mode-applescript.js +226 -0
  31. data/vendor/assets/javascripts/ace/mode-asciidoc.js +39 -70
  32. data/vendor/assets/javascripts/ace/mode-assembly_x86.js +26 -58
  33. data/vendor/assets/javascripts/ace/mode-autohotkey.js +27 -63
  34. data/vendor/assets/javascripts/ace/mode-batchfile.js +27 -63
  35. data/vendor/assets/javascripts/ace/mode-c9search.js +92 -112
  36. data/vendor/assets/javascripts/ace/mode-c_cpp.js +224 -223
  37. data/vendor/assets/javascripts/ace/mode-cirru.js +202 -0
  38. data/vendor/assets/javascripts/ace/mode-clojure.js +98 -92
  39. data/vendor/assets/javascripts/ace/mode-cobol.js +27 -58
  40. data/vendor/assets/javascripts/ace/mode-coffee.js +90 -122
  41. data/vendor/assets/javascripts/ace/mode-coldfusion.js +1908 -1464
  42. data/vendor/assets/javascripts/ace/mode-csharp.js +291 -264
  43. data/vendor/assets/javascripts/ace/mode-css.js +266 -267
  44. data/vendor/assets/javascripts/ace/mode-curly.js +796 -815
  45. data/vendor/assets/javascripts/ace/mode-d.js +64 -95
  46. data/vendor/assets/javascripts/ace/mode-dart.js +254 -256
  47. data/vendor/assets/javascripts/ace/mode-diff.js +27 -58
  48. data/vendor/assets/javascripts/ace/mode-django.js +856 -866
  49. data/vendor/assets/javascripts/ace/mode-dockerfile.js +759 -0
  50. data/vendor/assets/javascripts/ace/mode-dot.js +106 -106
  51. data/vendor/assets/javascripts/ace/mode-eiffel.js +135 -0
  52. data/vendor/assets/javascripts/ace/mode-ejs.js +931 -938
  53. data/vendor/assets/javascripts/ace/mode-erlang.js +27 -58
  54. data/vendor/assets/javascripts/ace/mode-forth.js +27 -63
  55. data/vendor/assets/javascripts/ace/mode-ftl.js +457 -508
  56. data/vendor/assets/javascripts/ace/mode-gcode.js +85 -0
  57. data/vendor/assets/javascripts/ace/mode-gherkin.js +129 -0
  58. data/vendor/assets/javascripts/ace/mode-gitignore.js +50 -0
  59. data/vendor/assets/javascripts/ace/mode-glsl.js +252 -248
  60. data/vendor/assets/javascripts/ace/mode-golang.js +206 -179
  61. data/vendor/assets/javascripts/ace/mode-groovy.js +310 -242
  62. data/vendor/assets/javascripts/ace/mode-haml.js +156 -190
  63. data/vendor/assets/javascripts/ace/mode-handlebars.js +815 -784
  64. data/vendor/assets/javascripts/ace/mode-haskell.js +27 -63
  65. data/vendor/assets/javascripts/ace/mode-haxe.js +206 -176
  66. data/vendor/assets/javascripts/ace/mode-html.js +779 -792
  67. data/vendor/assets/javascripts/ace/mode-html_ruby.js +916 -923
  68. data/vendor/assets/javascripts/ace/mode-ini.js +27 -58
  69. data/vendor/assets/javascripts/ace/mode-io.js +201 -0
  70. data/vendor/assets/javascripts/ace/mode-jack.js +169 -170
  71. data/vendor/assets/javascripts/ace/mode-jade.js +722 -774
  72. data/vendor/assets/javascripts/ace/mode-java.js +310 -245
  73. data/vendor/assets/javascripts/ace/mode-javascript.js +285 -247
  74. data/vendor/assets/javascripts/ace/mode-json.js +183 -184
  75. data/vendor/assets/javascripts/ace/mode-jsoniq.js +3211 -1274
  76. data/vendor/assets/javascripts/ace/mode-jsp.js +481 -504
  77. data/vendor/assets/javascripts/ace/mode-jsx.js +206 -176
  78. data/vendor/assets/javascripts/ace/mode-julia.js +33 -69
  79. data/vendor/assets/javascripts/ace/mode-latex.js +74 -41
  80. data/vendor/assets/javascripts/ace/mode-less.js +250 -251
  81. data/vendor/assets/javascripts/ace/mode-liquid.js +424 -475
  82. data/vendor/assets/javascripts/ace/mode-lisp.js +24 -57
  83. data/vendor/assets/javascripts/ace/mode-livescript.js +42 -41
  84. data/vendor/assets/javascripts/ace/mode-logiql.js +229 -230
  85. data/vendor/assets/javascripts/ace/mode-lsl.js +200 -441
  86. data/vendor/assets/javascripts/ace/mode-lua.js +136 -167
  87. data/vendor/assets/javascripts/ace/mode-luapage.js +904 -884
  88. data/vendor/assets/javascripts/ace/mode-lucene.js +22 -17
  89. data/vendor/assets/javascripts/ace/mode-makefile.js +162 -137
  90. data/vendor/assets/javascripts/ace/mode-markdown.js +846 -854
  91. data/vendor/assets/javascripts/ace/mode-matlab.js +98 -72
  92. data/vendor/assets/javascripts/ace/mode-mel.js +569 -0
  93. data/vendor/assets/javascripts/ace/mode-mushcode.js +84 -115
  94. data/vendor/assets/javascripts/ace/mode-mysql.js +49 -80
  95. data/vendor/assets/javascripts/ace/mode-nix.js +252 -256
  96. data/vendor/assets/javascripts/ace/mode-objectivec.js +242 -274
  97. data/vendor/assets/javascripts/ace/mode-ocaml.js +71 -102
  98. data/vendor/assets/javascripts/ace/mode-pascal.js +32 -68
  99. data/vendor/assets/javascripts/ace/mode-perl.js +67 -98
  100. data/vendor/assets/javascripts/ace/mode-pgsql.js +990 -982
  101. data/vendor/assets/javascripts/ace/mode-php.js +1878 -1900
  102. data/vendor/assets/javascripts/ace/mode-plain_text.js +3 -34
  103. data/vendor/assets/javascripts/ace/mode-powershell.js +181 -151
  104. data/vendor/assets/javascripts/ace/mode-praat.js +418 -0
  105. data/vendor/assets/javascripts/ace/mode-prolog.js +27 -63
  106. data/vendor/assets/javascripts/ace/mode-properties.js +20 -48
  107. data/vendor/assets/javascripts/ace/mode-protobuf.js +252 -259
  108. data/vendor/assets/javascripts/ace/mode-python.js +84 -115
  109. data/vendor/assets/javascripts/ace/mode-r.js +105 -140
  110. data/vendor/assets/javascripts/ace/mode-rdoc.js +84 -89
  111. data/vendor/assets/javascripts/ace/mode-rhtml.js +892 -908
  112. data/vendor/assets/javascripts/ace/mode-ruby.js +434 -98
  113. data/vendor/assets/javascripts/ace/mode-rust.js +27 -63
  114. data/vendor/assets/javascripts/ace/mode-sass.js +75 -106
  115. data/vendor/assets/javascripts/ace/mode-scad.js +219 -220
  116. data/vendor/assets/javascripts/ace/mode-scala.js +311 -243
  117. data/vendor/assets/javascripts/ace/mode-scheme.js +24 -60
  118. data/vendor/assets/javascripts/ace/mode-scss.js +250 -251
  119. data/vendor/assets/javascripts/ace/mode-sh.js +506 -118
  120. data/vendor/assets/javascripts/ace/mode-sjs.js +314 -280
  121. data/vendor/assets/javascripts/ace/mode-smarty.js +2474 -0
  122. data/vendor/assets/javascripts/ace/mode-snippets.js +89 -89
  123. data/vendor/assets/javascripts/ace/mode-soy_template.js +792 -811
  124. data/vendor/assets/javascripts/ace/mode-space.js +22 -23
  125. data/vendor/assets/javascripts/ace/mode-sql.js +31 -58
  126. data/vendor/assets/javascripts/ace/mode-stylus.js +161 -197
  127. data/vendor/assets/javascripts/ace/mode-svg.js +906 -836
  128. data/vendor/assets/javascripts/ace/mode-tcl.js +61 -92
  129. data/vendor/assets/javascripts/ace/mode-tex.js +36 -73
  130. data/vendor/assets/javascripts/ace/mode-text.js +1 -0
  131. data/vendor/assets/javascripts/ace/mode-textile.js +41 -72
  132. data/vendor/assets/javascripts/ace/mode-toml.js +26 -62
  133. data/vendor/assets/javascripts/ace/mode-twig.js +1196 -892
  134. data/vendor/assets/javascripts/ace/mode-typescript.js +313 -277
  135. data/vendor/assets/javascripts/ace/mode-vala.js +982 -0
  136. data/vendor/assets/javascripts/ace/mode-vbscript.js +25 -62
  137. data/vendor/assets/javascripts/ace/mode-velocity.js +2251 -1242
  138. data/vendor/assets/javascripts/ace/mode-verilog.js +27 -59
  139. data/vendor/assets/javascripts/ace/mode-vhdl.js +26 -55
  140. data/vendor/assets/javascripts/ace/mode-xml.js +319 -644
  141. data/vendor/assets/javascripts/ace/mode-xquery.js +2503 -588
  142. data/vendor/assets/javascripts/ace/mode-yaml.js +56 -90
  143. data/vendor/assets/javascripts/ace/snippets/abap.js +7 -0
  144. data/vendor/assets/javascripts/ace/snippets/actionscript.js +159 -0
  145. data/vendor/assets/javascripts/ace/snippets/ada.js +7 -0
  146. data/vendor/assets/javascripts/ace/snippets/apache_conf.js +7 -0
  147. data/vendor/assets/javascripts/ace/snippets/applescript.js +7 -0
  148. data/vendor/assets/javascripts/ace/snippets/asciidoc.js +7 -0
  149. data/vendor/assets/javascripts/ace/snippets/assembly_x86.js +7 -0
  150. data/vendor/assets/javascripts/ace/snippets/autohotkey.js +7 -0
  151. data/vendor/assets/javascripts/ace/snippets/batchfile.js +7 -0
  152. data/vendor/assets/javascripts/ace/snippets/c9search.js +7 -0
  153. data/vendor/assets/javascripts/ace/snippets/c_cpp.js +138 -0
  154. data/vendor/assets/javascripts/ace/snippets/cirru.js +7 -0
  155. data/vendor/assets/javascripts/ace/snippets/clojure.js +97 -0
  156. data/vendor/assets/javascripts/ace/snippets/cobol.js +7 -0
  157. data/vendor/assets/javascripts/ace/snippets/coffee.js +102 -0
  158. data/vendor/assets/javascripts/ace/snippets/coldfusion.js +7 -0
  159. data/vendor/assets/javascripts/ace/snippets/csharp.js +7 -0
  160. data/vendor/assets/javascripts/ace/snippets/css.js +974 -0
  161. data/vendor/assets/javascripts/ace/snippets/curly.js +7 -0
  162. data/vendor/assets/javascripts/ace/snippets/d.js +7 -0
  163. data/vendor/assets/javascripts/ace/snippets/dart.js +90 -0
  164. data/vendor/assets/javascripts/ace/snippets/diff.js +18 -0
  165. data/vendor/assets/javascripts/ace/snippets/django.js +115 -0
  166. data/vendor/assets/javascripts/ace/snippets/dockerfile.js +7 -0
  167. data/vendor/assets/javascripts/ace/snippets/dot.js +7 -0
  168. data/vendor/assets/javascripts/ace/snippets/eiffel.js +7 -0
  169. data/vendor/assets/javascripts/ace/snippets/ejs.js +7 -0
  170. data/vendor/assets/javascripts/ace/snippets/erlang.js +167 -0
  171. data/vendor/assets/javascripts/ace/snippets/forth.js +7 -0
  172. data/vendor/assets/javascripts/ace/snippets/ftl.js +7 -0
  173. data/vendor/assets/javascripts/ace/snippets/gcode.js +7 -0
  174. data/vendor/assets/javascripts/ace/snippets/gherkin.js +7 -0
  175. data/vendor/assets/javascripts/ace/snippets/gitignore.js +7 -0
  176. data/vendor/assets/javascripts/ace/snippets/glsl.js +7 -0
  177. data/vendor/assets/javascripts/ace/snippets/golang.js +7 -0
  178. data/vendor/assets/javascripts/ace/snippets/groovy.js +7 -0
  179. data/vendor/assets/javascripts/ace/snippets/haml.js +27 -0
  180. data/vendor/assets/javascripts/ace/snippets/handlebars.js +7 -0
  181. data/vendor/assets/javascripts/ace/snippets/haskell.js +89 -0
  182. data/vendor/assets/javascripts/ace/snippets/haxe.js +7 -0
  183. data/vendor/assets/javascripts/ace/snippets/html.js +835 -0
  184. data/vendor/assets/javascripts/ace/snippets/html_ruby.js +7 -0
  185. data/vendor/assets/javascripts/ace/snippets/ini.js +7 -0
  186. data/vendor/assets/javascripts/ace/snippets/io.js +69 -0
  187. data/vendor/assets/javascripts/ace/snippets/jack.js +7 -0
  188. data/vendor/assets/javascripts/ace/snippets/jade.js +7 -0
  189. data/vendor/assets/javascripts/ace/snippets/java.js +241 -0
  190. data/vendor/assets/javascripts/ace/snippets/javascript.js +189 -0
  191. data/vendor/assets/javascripts/ace/snippets/json.js +7 -0
  192. data/vendor/assets/javascripts/ace/snippets/jsoniq.js +68 -0
  193. data/vendor/assets/javascripts/ace/snippets/jsp.js +106 -0
  194. data/vendor/assets/javascripts/ace/snippets/jsx.js +7 -0
  195. data/vendor/assets/javascripts/ace/snippets/julia.js +7 -0
  196. data/vendor/assets/javascripts/ace/snippets/latex.js +7 -0
  197. data/vendor/assets/javascripts/ace/snippets/less.js +7 -0
  198. data/vendor/assets/javascripts/ace/snippets/liquid.js +7 -0
  199. data/vendor/assets/javascripts/ace/snippets/lisp.js +7 -0
  200. data/vendor/assets/javascripts/ace/snippets/livescript.js +7 -0
  201. data/vendor/assets/javascripts/ace/snippets/logiql.js +7 -0
  202. data/vendor/assets/javascripts/ace/snippets/lsl.js +1073 -0
  203. data/vendor/assets/javascripts/ace/snippets/lua.js +28 -0
  204. data/vendor/assets/javascripts/ace/snippets/luapage.js +7 -0
  205. data/vendor/assets/javascripts/ace/snippets/lucene.js +7 -0
  206. data/vendor/assets/javascripts/ace/snippets/makefile.js +11 -0
  207. data/vendor/assets/javascripts/ace/snippets/markdown.js +95 -0
  208. data/vendor/assets/javascripts/ace/snippets/matlab.js +7 -0
  209. data/vendor/assets/javascripts/ace/snippets/mel.js +7 -0
  210. data/vendor/assets/javascripts/ace/snippets/mushcode.js +7 -0
  211. data/vendor/assets/javascripts/ace/snippets/mysql.js +7 -0
  212. data/vendor/assets/javascripts/ace/snippets/nix.js +7 -0
  213. data/vendor/assets/javascripts/ace/snippets/objectivec.js +7 -0
  214. data/vendor/assets/javascripts/ace/snippets/ocaml.js +7 -0
  215. data/vendor/assets/javascripts/ace/snippets/pascal.js +7 -0
  216. data/vendor/assets/javascripts/ace/snippets/perl.js +354 -0
  217. data/vendor/assets/javascripts/ace/snippets/pgsql.js +7 -0
  218. data/vendor/assets/javascripts/ace/snippets/php.js +283 -0
  219. data/vendor/assets/javascripts/ace/snippets/plain_text.js +7 -0
  220. data/vendor/assets/javascripts/ace/snippets/powershell.js +7 -0
  221. data/vendor/assets/javascripts/ace/snippets/praat.js +7 -0
  222. data/vendor/assets/javascripts/ace/snippets/prolog.js +7 -0
  223. data/vendor/assets/javascripts/ace/snippets/properties.js +7 -0
  224. data/vendor/assets/javascripts/ace/snippets/protobuf.js +7 -0
  225. data/vendor/assets/javascripts/ace/snippets/python.js +165 -0
  226. data/vendor/assets/javascripts/ace/snippets/r.js +128 -0
  227. data/vendor/assets/javascripts/ace/snippets/rdoc.js +7 -0
  228. data/vendor/assets/javascripts/ace/snippets/rhtml.js +7 -0
  229. data/vendor/assets/javascripts/ace/snippets/ruby.js +935 -0
  230. data/vendor/assets/javascripts/ace/snippets/rust.js +7 -0
  231. data/vendor/assets/javascripts/ace/snippets/sass.js +7 -0
  232. data/vendor/assets/javascripts/ace/snippets/scad.js +7 -0
  233. data/vendor/assets/javascripts/ace/snippets/scala.js +7 -0
  234. data/vendor/assets/javascripts/ace/snippets/scheme.js +7 -0
  235. data/vendor/assets/javascripts/ace/snippets/scss.js +7 -0
  236. data/vendor/assets/javascripts/ace/snippets/sh.js +90 -0
  237. data/vendor/assets/javascripts/ace/snippets/sjs.js +7 -0
  238. data/vendor/assets/javascripts/ace/snippets/smarty.js +7 -0
  239. data/vendor/assets/javascripts/ace/snippets/snippets.js +16 -0
  240. data/vendor/assets/javascripts/ace/snippets/soy_template.js +7 -0
  241. data/vendor/assets/javascripts/ace/snippets/space.js +7 -0
  242. data/vendor/assets/javascripts/ace/snippets/sql.js +33 -0
  243. data/vendor/assets/javascripts/ace/snippets/stylus.js +7 -0
  244. data/vendor/assets/javascripts/ace/snippets/svg.js +7 -0
  245. data/vendor/assets/javascripts/ace/snippets/tcl.js +99 -0
  246. data/vendor/assets/javascripts/ace/snippets/tex.js +197 -0
  247. data/vendor/assets/javascripts/ace/snippets/text.js +7 -0
  248. data/vendor/assets/javascripts/ace/snippets/textile.js +37 -0
  249. data/vendor/assets/javascripts/ace/snippets/toml.js +7 -0
  250. data/vendor/assets/javascripts/ace/snippets/twig.js +7 -0
  251. data/vendor/assets/javascripts/ace/snippets/typescript.js +7 -0
  252. data/vendor/assets/javascripts/ace/snippets/vala.js +193 -0
  253. data/vendor/assets/javascripts/ace/snippets/vbscript.js +7 -0
  254. data/vendor/assets/javascripts/ace/snippets/velocity.js +36 -0
  255. data/vendor/assets/javascripts/ace/snippets/verilog.js +7 -0
  256. data/vendor/assets/javascripts/ace/snippets/vhdl.js +7 -0
  257. data/vendor/assets/javascripts/ace/snippets/xml.js +7 -0
  258. data/vendor/assets/javascripts/ace/snippets/xquery.js +68 -0
  259. data/vendor/assets/javascripts/ace/snippets/yaml.js +7 -0
  260. data/vendor/assets/javascripts/ace/theme-ambiance.js +4 -24
  261. data/vendor/assets/javascripts/ace/theme-chaos.js +2 -25
  262. data/vendor/assets/javascripts/ace/theme-chrome.js +2 -31
  263. data/vendor/assets/javascripts/ace/theme-clouds.js +1 -31
  264. data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +1 -31
  265. data/vendor/assets/javascripts/ace/theme-cobalt.js +1 -31
  266. data/vendor/assets/javascripts/ace/theme-crimson_editor.js +1 -31
  267. data/vendor/assets/javascripts/ace/theme-dawn.js +1 -31
  268. data/vendor/assets/javascripts/ace/theme-dreamweaver.js +5 -31
  269. data/vendor/assets/javascripts/ace/theme-eclipse.js +7 -33
  270. data/vendor/assets/javascripts/ace/theme-github.js +2 -35
  271. data/vendor/assets/javascripts/ace/theme-idle_fingers.js +1 -31
  272. data/vendor/assets/javascripts/ace/theme-katzenmilch.js +119 -0
  273. data/vendor/assets/javascripts/ace/theme-kr.js +1 -31
  274. data/vendor/assets/javascripts/ace/theme-kr_theme.js +57 -141
  275. data/vendor/assets/javascripts/ace/theme-kuroir.js +59 -0
  276. data/vendor/assets/javascripts/ace/theme-merbivore.js +1 -31
  277. data/vendor/assets/javascripts/ace/theme-merbivore_soft.js +1 -31
  278. data/vendor/assets/javascripts/ace/theme-mono_industrial.js +1 -31
  279. data/vendor/assets/javascripts/ace/theme-monokai.js +1 -31
  280. data/vendor/assets/javascripts/ace/theme-pastel_on_dark.js +1 -31
  281. data/vendor/assets/javascripts/ace/theme-solarized_dark.js +1 -31
  282. data/vendor/assets/javascripts/ace/theme-solarized_light.js +1 -31
  283. data/vendor/assets/javascripts/ace/theme-terminal.js +1 -31
  284. data/vendor/assets/javascripts/ace/theme-textmate.js +3 -32
  285. data/vendor/assets/javascripts/ace/theme-tomorrow.js +1 -31
  286. data/vendor/assets/javascripts/ace/theme-tomorrow_night.js +1 -31
  287. data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue.js +1 -31
  288. data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +1 -31
  289. data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties.js +1 -31
  290. data/vendor/assets/javascripts/ace/theme-twilight.js +1 -31
  291. data/vendor/assets/javascripts/ace/theme-vibrant_ink.js +1 -31
  292. data/vendor/assets/javascripts/ace/theme-xcode.js +2 -33
  293. data/vendor/assets/javascripts/ace/worker-coffee.js +5026 -5008
  294. data/vendor/assets/javascripts/ace/worker-css.js +5489 -5134
  295. data/vendor/assets/javascripts/ace/worker-html.js +11517 -0
  296. data/vendor/assets/javascripts/ace/worker-javascript.js +9810 -9501
  297. data/vendor/assets/javascripts/ace/worker-json.js +1583 -1564
  298. data/vendor/assets/javascripts/ace/worker-lua.js +2631 -2612
  299. data/vendor/assets/javascripts/ace/worker-php.js +2385 -2341
  300. data/vendor/assets/javascripts/ace/worker-xquery.js +31643 -3993
  301. metadata +147 -11
@@ -0,0 +1,335 @@
1
+ define("ace/ext/beautify/php_rules",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
2
+ "use strict";
3
+ var TokenIterator = require("ace/token_iterator").TokenIterator;
4
+ exports.newLines = [{
5
+ type: 'support.php_tag',
6
+ value: '<?php'
7
+ }, {
8
+ type: 'support.php_tag',
9
+ value: '<?'
10
+ }, {
11
+ type: 'support.php_tag',
12
+ value: '?>'
13
+ }, {
14
+ type: 'paren.lparen',
15
+ value: '{',
16
+ indent: true
17
+ }, {
18
+ type: 'paren.rparen',
19
+ breakBefore: true,
20
+ value: '}',
21
+ indent: false
22
+ }, {
23
+ type: 'paren.rparen',
24
+ breakBefore: true,
25
+ value: '})',
26
+ indent: false,
27
+ dontBreak: true
28
+ }, {
29
+ type: 'comment'
30
+ }, {
31
+ type: 'text',
32
+ value: ';'
33
+ }, {
34
+ type: 'text',
35
+ value: ':',
36
+ context: 'php'
37
+ }, {
38
+ type: 'keyword',
39
+ value: 'case',
40
+ indent: true,
41
+ dontBreak: true
42
+ }, {
43
+ type: 'keyword',
44
+ value: 'default',
45
+ indent: true,
46
+ dontBreak: true
47
+ }, {
48
+ type: 'keyword',
49
+ value: 'break',
50
+ indent: false,
51
+ dontBreak: true
52
+ }, {
53
+ type: 'punctuation.doctype.end',
54
+ value: '>'
55
+ }, {
56
+ type: 'meta.tag.punctuation.end',
57
+ value: '>'
58
+ }, {
59
+ type: 'meta.tag.punctuation.begin',
60
+ value: '<',
61
+ blockTag: true,
62
+ indent: true,
63
+ dontBreak: true
64
+ }, {
65
+ type: 'meta.tag.punctuation.begin',
66
+ value: '</',
67
+ indent: false,
68
+ breakBefore: true,
69
+ dontBreak: true
70
+ }, {
71
+ type: 'punctuation.operator',
72
+ value: ';'
73
+ }];
74
+
75
+ exports.spaces = [{
76
+ type: 'xml-pe',
77
+ prepend: true
78
+ },{
79
+ type: 'entity.other.attribute-name',
80
+ prepend: true
81
+ }, {
82
+ type: 'storage.type',
83
+ value: 'var',
84
+ append: true
85
+ }, {
86
+ type: 'storage.type',
87
+ value: 'function',
88
+ append: true
89
+ }, {
90
+ type: 'keyword.operator',
91
+ value: '='
92
+ }, {
93
+ type: 'keyword',
94
+ value: 'as',
95
+ prepend: true,
96
+ append: true
97
+ }, {
98
+ type: 'keyword',
99
+ value: 'function',
100
+ append: true
101
+ }, {
102
+ type: 'support.function',
103
+ next: /[^\(]/,
104
+ append: true
105
+ }, {
106
+ type: 'keyword',
107
+ value: 'or',
108
+ append: true,
109
+ prepend: true
110
+ }, {
111
+ type: 'keyword',
112
+ value: 'and',
113
+ append: true,
114
+ prepend: true
115
+ }, {
116
+ type: 'keyword',
117
+ value: 'case',
118
+ append: true
119
+ }, {
120
+ type: 'keyword.operator',
121
+ value: '||',
122
+ append: true,
123
+ prepend: true
124
+ }, {
125
+ type: 'keyword.operator',
126
+ value: '&&',
127
+ append: true,
128
+ prepend: true
129
+ }];
130
+ exports.singleTags = ['!doctype','area','base','br','hr','input','img','link','meta'];
131
+
132
+ exports.transform = function(iterator, maxPos, context) {
133
+ var token = iterator.getCurrentToken();
134
+
135
+ var newLines = exports.newLines;
136
+ var spaces = exports.spaces;
137
+ var singleTags = exports.singleTags;
138
+
139
+ var code = '';
140
+
141
+ var indentation = 0;
142
+ var dontBreak = false;
143
+ var tag;
144
+ var lastTag;
145
+ var lastToken = {};
146
+ var nextTag;
147
+ var nextToken = {};
148
+ var breakAdded = false;
149
+ var value = '';
150
+
151
+ while (token!==null) {
152
+ console.log(token);
153
+
154
+ if( !token ){
155
+ token = iterator.stepForward();
156
+ continue;
157
+ }
158
+ if( token.type == 'support.php_tag' && token.value != '?>' ){
159
+ context = 'php';
160
+ }
161
+ else if( token.type == 'support.php_tag' && token.value == '?>' ){
162
+ context = 'html';
163
+ }
164
+ else if( token.type == 'meta.tag.name.style' && context != 'css' ){
165
+ context = 'css';
166
+ }
167
+ else if( token.type == 'meta.tag.name.style' && context == 'css' ){
168
+ context = 'html';
169
+ }
170
+ else if( token.type == 'meta.tag.name.script' && context != 'js' ){
171
+ context = 'js';
172
+ }
173
+ else if( token.type == 'meta.tag.name.script' && context == 'js' ){
174
+ context = 'html';
175
+ }
176
+
177
+ nextToken = iterator.stepForward();
178
+ if (nextToken && nextToken.type.indexOf('meta.tag.name') == 0) {
179
+ nextTag = nextToken.value;
180
+ }
181
+ if ( lastToken.type == 'support.php_tag' && lastToken.value == '<?=') {
182
+ dontBreak = true;
183
+ }
184
+ if (token.type == 'meta.tag.name') {
185
+ token.value = token.value.toLowerCase();
186
+ }
187
+ if (token.type == 'text') {
188
+ token.value = token.value.trim();
189
+ }
190
+ if (!token.value) {
191
+ token = nextToken;
192
+ continue;
193
+ }
194
+ value = token.value;
195
+ for (var i in spaces) {
196
+ if (
197
+ token.type == spaces[i].type &&
198
+ (!spaces[i].value || token.value == spaces[i].value) &&
199
+ (
200
+ nextToken &&
201
+ (!spaces[i].next || spaces[i].next.test(nextToken.value))
202
+ )
203
+ ) {
204
+ if (spaces[i].prepend) {
205
+ value = ' ' + token.value;
206
+ }
207
+
208
+ if (spaces[i].append) {
209
+ value += ' ';
210
+ }
211
+ }
212
+ }
213
+ if (token.type.indexOf('meta.tag.name') == 0) {
214
+ tag = token.value;
215
+ }
216
+ breakAdded = false;
217
+ for (i in newLines) {
218
+ if (
219
+ token.type == newLines[i].type &&
220
+ (
221
+ !newLines[i].value ||
222
+ token.value == newLines[i].value
223
+ ) &&
224
+ (
225
+ !newLines[i].blockTag ||
226
+ singleTags.indexOf(nextTag) === -1
227
+ ) &&
228
+ (
229
+ !newLines[i].context ||
230
+ newLines[i].context === context
231
+ )
232
+ ) {
233
+ if (newLines[i].indent === false) {
234
+ indentation--;
235
+ }
236
+
237
+ if (
238
+ newLines[i].breakBefore &&
239
+ ( !newLines[i].prev || newLines[i].prev.test(lastToken.value) )
240
+ ) {
241
+ code += "\n";
242
+ breakAdded = true;
243
+ for (i = 0; i < indentation; i++) {
244
+ code += "\t";
245
+ }
246
+ }
247
+
248
+ break;
249
+ }
250
+ }
251
+
252
+ if (dontBreak===false) {
253
+ for (i in newLines) {
254
+ if (
255
+ lastToken.type == newLines[i].type &&
256
+ (
257
+ !newLines[i].value || lastToken.value == newLines[i].value
258
+ ) &&
259
+ (
260
+ !newLines[i].blockTag ||
261
+ singleTags.indexOf(tag) === -1
262
+ ) &&
263
+ (
264
+ !newLines[i].context ||
265
+ newLines[i].context === context
266
+ )
267
+ ) {
268
+ if (newLines[i].indent === true) {
269
+ indentation++;
270
+ }
271
+
272
+ if (!newLines[i].dontBreak && !breakAdded) {
273
+ code += "\n";
274
+ for (i = 0; i < indentation; i++) {
275
+ code += "\t";
276
+ }
277
+ }
278
+
279
+ break;
280
+ }
281
+ }
282
+ }
283
+
284
+ code += value;
285
+ if ( lastToken.type == 'support.php_tag' && lastToken.value == '?>' ) {
286
+ dontBreak = false;
287
+ }
288
+ lastTag = tag;
289
+
290
+ lastToken = token;
291
+
292
+ token = nextToken;
293
+
294
+ if (token===null) {
295
+ break;
296
+ }
297
+ }
298
+
299
+ return code;
300
+ };
301
+
302
+
303
+
304
+ });
305
+
306
+ define("ace/ext/beautify",["require","exports","module","ace/token_iterator","ace/ext/beautify/php_rules"], function(require, exports, module) {
307
+ "use strict";
308
+ var TokenIterator = require("ace/token_iterator").TokenIterator;
309
+
310
+ var phpTransform = require("./beautify/php_rules").transform;
311
+
312
+ exports.beautify = function(session) {
313
+ var iterator = new TokenIterator(session, 0, 0);
314
+ var token = iterator.getCurrentToken();
315
+
316
+ var context = session.$modeId.split("/").pop();
317
+
318
+ var code = phpTransform(iterator, context);
319
+ session.doc.setValue(code);
320
+ };
321
+
322
+ exports.commands = [{
323
+ name: "beautify",
324
+ exec: function(editor) {
325
+ exports.beautify(editor.session);
326
+ },
327
+ bindKey: "Ctrl-Shift-B"
328
+ }]
329
+
330
+ });
331
+ ;
332
+ (function() {
333
+ window.require(["ace/ext/beautify"], function() {});
334
+ })();
335
+
@@ -1,4 +1,4 @@
1
- define('ace/ext/chromevox', ['require', 'exports', 'module' , 'ace/editor', 'ace/config'], function(require, exports, module) {
1
+ define("ace/ext/chromevox",["require","exports","module","ace/editor","ace/config"], function(require, exports, module) {
2
2
  var cvoxAce = {};
3
3
  cvoxAce.SpeechProperty;
4
4
  cvoxAce.Cursor;
@@ -535,3 +535,8 @@ require('../config').defineOptions(Editor.prototype, 'editor', {
535
535
  });
536
536
 
537
537
  });
538
+ ;
539
+ (function() {
540
+ window.require(["ace/ext/chromevox"], function() {});
541
+ })();
542
+
@@ -1,35 +1,5 @@
1
- /* ***** BEGIN LICENSE BLOCK *****
2
- * Distributed under the BSD license:
3
- *
4
- * Copyright (c) 2012, Ajax.org B.V.
5
- * All rights reserved.
6
- *
7
- * Redistribution and use in source and binary forms, with or without
8
- * modification, are permitted provided that the following conditions are met:
9
- * * Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- * * Redistributions in binary form must reproduce the above copyright
12
- * notice, this list of conditions and the following disclaimer in the
13
- * documentation and/or other materials provided with the distribution.
14
- * * Neither the name of Ajax.org B.V. nor the
15
- * names of its contributors may be used to endorse or promote products
16
- * derived from this software without specific prior written permission.
17
- *
18
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
- * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
- *
29
- * ***** END LICENSE BLOCK ***** */
30
-
31
- define('ace/ext/elastic_tabstops_lite', ['require', 'exports', 'module' , 'ace/editor', 'ace/config'], function(require, exports, module) {
32
-
1
+ define("ace/ext/elastic_tabstops_lite",["require","exports","module","ace/editor","ace/config"], function(require, exports, module) {
2
+ "use strict";
33
3
 
34
4
  var ElasticTabstopsLite = function(editor) {
35
5
  this.$editor = editor;
@@ -298,4 +268,9 @@ require("../config").defineOptions(Editor.prototype, "editor", {
298
268
  }
299
269
  });
300
270
 
301
- });
271
+ });
272
+ ;
273
+ (function() {
274
+ window.require(["ace/ext/elastic_tabstops_lite"], function() {});
275
+ })();
276
+
@@ -1,302 +1,10 @@
1
- /* ***** BEGIN LICENSE BLOCK *****
2
- * Distributed under the BSD license:
3
- *
4
- * Copyright (c) 2010, Ajax.org B.V.
5
- * All rights reserved.
6
- *
7
- * Redistribution and use in source and binary forms, with or without
8
- * modification, are permitted provided that the following conditions are met:
9
- * * Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- * * Redistributions in binary form must reproduce the above copyright
12
- * notice, this list of conditions and the following disclaimer in the
13
- * documentation and/or other materials provided with the distribution.
14
- * * Neither the name of Ajax.org B.V. nor the
15
- * names of its contributors may be used to endorse or promote products
16
- * derived from this software without specific prior written permission.
17
- *
18
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
- * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
- *
29
- * ***** END LICENSE BLOCK ***** */
30
-
31
- define('ace/ext/emmet', ['require', 'exports', 'module' , 'ace/keyboard/hash_handler', 'ace/editor', 'ace/snippets', 'ace/range', 'ace/config'], function(require, exports, module) {
32
-
33
- var HashHandler = require("ace/keyboard/hash_handler").HashHandler;
34
- var Editor = require("ace/editor").Editor;
35
- var snippetManager = require("ace/snippets").snippetManager;
36
- var Range = require("ace/range").Range;
37
- var emmet;
38
-
39
- Editor.prototype.indexToPosition = function(index) {
40
- return this.session.doc.indexToPosition(index);
41
- };
42
-
43
- Editor.prototype.positionToIndex = function(pos) {
44
- return this.session.doc.positionToIndex(pos);
45
- };
46
- function AceEmmetEditor() {}
47
-
48
- AceEmmetEditor.prototype = {
49
- setupContext: function(editor) {
50
- this.ace = editor;
51
- this.indentation = editor.session.getTabString();
52
- if (!emmet)
53
- emmet = window.emmet;
54
- emmet.require("resources").setVariable("indentation", this.indentation);
55
- this.$syntax = null;
56
- this.$syntax = this.getSyntax();
57
- },
58
- getSelectionRange: function() {
59
- var range = this.ace.getSelectionRange();
60
- return {
61
- start: this.ace.positionToIndex(range.start),
62
- end: this.ace.positionToIndex(range.end)
63
- };
64
- },
65
- createSelection: function(start, end) {
66
- this.ace.selection.setRange({
67
- start: this.ace.indexToPosition(start),
68
- end: this.ace.indexToPosition(end)
69
- });
70
- },
71
- getCurrentLineRange: function() {
72
- var row = this.ace.getCursorPosition().row;
73
- var lineLength = this.ace.session.getLine(row).length;
74
- var index = this.ace.positionToIndex({row: row, column: 0});
75
- return {
76
- start: index,
77
- end: index + lineLength
78
- };
79
- },
80
- getCaretPos: function(){
81
- var pos = this.ace.getCursorPosition();
82
- return this.ace.positionToIndex(pos);
83
- },
84
- setCaretPos: function(index){
85
- var pos = this.ace.indexToPosition(index);
86
- this.ace.clearSelection();
87
- this.ace.selection.moveCursorToPosition(pos);
88
- },
89
- getCurrentLine: function() {
90
- var row = this.ace.getCursorPosition().row;
91
- return this.ace.session.getLine(row);
92
- },
93
- replaceContent: function(value, start, end, noIndent) {
94
- if (end == null)
95
- end = start == null ? this.getContent().length : start;
96
- if (start == null)
97
- start = 0;
98
-
99
- var editor = this.ace;
100
- var range = Range.fromPoints(editor.indexToPosition(start), editor.indexToPosition(end));
101
- editor.session.remove(range);
102
-
103
- range.end = range.start;
104
-
105
- value = this.$updateTabstops(value);
106
- snippetManager.insertSnippet(editor, value)
107
- },
108
- getContent: function(){
109
- return this.ace.getValue();
110
- },
111
- getSyntax: function() {
112
- if (this.$syntax)
113
- return this.$syntax;
114
- var syntax = this.ace.session.$modeId.split("/").pop();
115
- if (syntax == "html" || syntax == "php") {
116
- var cursor = this.ace.getCursorPosition();
117
- var state = this.ace.session.getState(cursor.row);
118
- if (typeof state != "string")
119
- state = state[0];
120
- if (state) {
121
- state = state.split("-");
122
- if (state.length > 1)
123
- syntax = state[0];
124
- else if (syntax == "php")
125
- syntax = "html";
126
- }
127
- }
128
- return syntax;
129
- },
130
- getProfileName: function() {
131
- switch(this.getSyntax()) {
132
- case "css": return "css";
133
- case "xml":
134
- case "xsl":
135
- return "xml";
136
- case "html":
137
- var profile = emmet.require("resources").getVariable("profile");
138
- if (!profile)
139
- profile = this.ace.session.getLines(0,2).join("").search(/<!DOCTYPE[^>]+XHTML/i) != -1 ? "xhtml": "html";
140
- return profile;
141
- }
142
- return "xhtml";
143
- },
144
- prompt: function(title) {
145
- return prompt(title);
146
- },
147
- getSelection: function() {
148
- return this.ace.session.getTextRange();
149
- },
150
- getFilePath: function() {
151
- return "";
152
- },
153
- $updateTabstops: function(value) {
154
- var base = 1000;
155
- var zeroBase = 0;
156
- var lastZero = null;
157
- var range = emmet.require('range');
158
- var ts = emmet.require('tabStops');
159
- var settings = emmet.require('resources').getVocabulary("user");
160
- var tabstopOptions = {
161
- tabstop: function(data) {
162
- var group = parseInt(data.group, 10);
163
- var isZero = group === 0;
164
- if (isZero)
165
- group = ++zeroBase;
166
- else
167
- group += base;
168
-
169
- var placeholder = data.placeholder;
170
- if (placeholder) {
171
- placeholder = ts.processText(placeholder, tabstopOptions);
172
- }
173
-
174
- var result = '${' + group + (placeholder ? ':' + placeholder : '') + '}';
175
-
176
- if (isZero) {
177
- lastZero = range.create(data.start, result);
178
- }
179
-
180
- return result
181
- },
182
- escape: function(ch) {
183
- if (ch == '$') return '\\$';
184
- if (ch == '\\') return '\\\\';
185
- return ch;
186
- }
187
- };
188
-
189
- value = ts.processText(value, tabstopOptions);
190
-
191
- if (settings.variables['insert_final_tabstop'] && !/\$\{0\}$/.test(value)) {
192
- value += '${0}';
193
- } else if (lastZero) {
194
- value = emmet.require('utils').replaceSubstring(value, '${0}', lastZero);
195
- }
196
-
197
- return value;
198
- }
199
- };
200
-
201
-
202
- var keymap = {
203
- expand_abbreviation: {"mac": "ctrl+alt+e", "win": "alt+e"},
204
- match_pair_outward: {"mac": "ctrl+d", "win": "ctrl+,"},
205
- match_pair_inward: {"mac": "ctrl+j", "win": "ctrl+shift+0"},
206
- matching_pair: {"mac": "ctrl+alt+j", "win": "alt+j"},
207
- next_edit_point: "alt+right",
208
- prev_edit_point: "alt+left",
209
- toggle_comment: {"mac": "command+/", "win": "ctrl+/"},
210
- split_join_tag: {"mac": "shift+command+'", "win": "shift+ctrl+`"},
211
- remove_tag: {"mac": "command+'", "win": "shift+ctrl+;"},
212
- evaluate_math_expression: {"mac": "shift+command+y", "win": "shift+ctrl+y"},
213
- increment_number_by_1: "ctrl+up",
214
- decrement_number_by_1: "ctrl+down",
215
- increment_number_by_01: "alt+up",
216
- decrement_number_by_01: "alt+down",
217
- increment_number_by_10: {"mac": "alt+command+up", "win": "shift+alt+up"},
218
- decrement_number_by_10: {"mac": "alt+command+down", "win": "shift+alt+down"},
219
- select_next_item: {"mac": "shift+command+.", "win": "shift+ctrl+."},
220
- select_previous_item: {"mac": "shift+command+,", "win": "shift+ctrl+,"},
221
- reflect_css_value: {"mac": "shift+command+r", "win": "shift+ctrl+r"},
222
-
223
- encode_decode_data_url: {"mac": "shift+ctrl+d", "win": "ctrl+'"},
224
- expand_abbreviation_with_tab: "Tab",
225
- wrap_with_abbreviation: {"mac": "shift+ctrl+a", "win": "shift+ctrl+a"}
226
- };
227
-
228
- var editorProxy = new AceEmmetEditor();
229
- exports.commands = new HashHandler();
230
- exports.runEmmetCommand = function(editor) {
231
- editorProxy.setupContext(editor);
232
- if (editorProxy.getSyntax() == "php")
233
- return false;
234
- var actions = emmet.require("actions");
235
-
236
- if (this.action == "expand_abbreviation_with_tab") {
237
- if (!editor.selection.isEmpty())
238
- return false;
239
- }
240
-
241
- if (this.action == "wrap_with_abbreviation") {
242
- return setTimeout(function() {
243
- actions.run("wrap_with_abbreviation", editorProxy);
244
- }, 0);
245
- }
246
-
247
- try {
248
- var result = actions.run(this.action, editorProxy);
249
- } catch(e) {
250
- editor._signal("changeStatus", typeof e == "string" ? e : e.message);
251
- console.log(e);
252
- }
253
- return result;
254
- };
255
-
256
- for (var command in keymap) {
257
- exports.commands.addCommand({
258
- name: "emmet:" + command,
259
- action: command,
260
- bindKey: keymap[command],
261
- exec: exports.runEmmetCommand,
262
- multiSelectAction: "forEach"
263
- });
264
- }
265
-
266
- var onChangeMode = function(e, target) {
267
- var editor = target;
268
- if (!editor)
269
- return;
270
- var modeId = editor.session.$modeId;
271
- var enabled = modeId && /css|less|scss|sass|stylus|html|php/.test(modeId);
272
- if (e.enableEmmet === false)
273
- enabled = false;
274
- if (enabled)
275
- editor.keyBinding.addKeyboardHandler(exports.commands);
276
- else
277
- editor.keyBinding.removeKeyboardHandler(exports.commands);
278
- };
279
-
280
-
281
- exports.AceEmmetEditor = AceEmmetEditor;
282
- require("ace/config").defineOptions(Editor.prototype, "editor", {
283
- enableEmmet: {
284
- set: function(val) {
285
- this[val ? "on" : "removeListener"]("changeMode", onChangeMode);
286
- onChangeMode({enableEmmet: !!val}, this);
287
- },
288
- value: true
289
- }
290
- });
291
-
292
-
293
- exports.setCore = function(e) {emmet = e;};
294
- });
295
-
296
- define('ace/snippets', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/range', 'ace/keyboard/hash_handler', 'ace/tokenizer', 'ace/lib/dom'], function(require, exports, module) {
297
-
298
- var lang = require("./lib/lang")
299
- var Range = require("./range").Range
1
+ define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/anchor","ace/keyboard/hash_handler","ace/tokenizer","ace/lib/dom","ace/editor"], function(require, exports, module) {
2
+ "use strict";
3
+ var oop = require("./lib/oop");
4
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
5
+ var lang = require("./lib/lang");
6
+ var Range = require("./range").Range;
7
+ var Anchor = require("./anchor").Anchor;
300
8
  var HashHandler = require("./keyboard/hash_handler").HashHandler;
301
9
  var Tokenizer = require("./tokenizer").Tokenizer;
302
10
  var comparePoints = Range.comparePoints;
@@ -307,12 +15,14 @@ var SnippetManager = function() {
307
15
  };
308
16
 
309
17
  (function() {
18
+ oop.implement(this, EventEmitter);
19
+
310
20
  this.getTokenizer = function() {
311
21
  function TabstopToken(str, _, stack) {
312
22
  str = str.substr(1);
313
23
  if (/^\d+$/.test(str) && !stack.inFormatString)
314
24
  return [{tabstopId: parseInt(str, 10)}];
315
- return [{text: str}]
25
+ return [{text: str}];
316
26
  }
317
27
  function escape(ch) {
318
28
  return "(?:[^\\\\" + ch + "]|\\\\.)";
@@ -390,7 +100,7 @@ var SnippetManager = function() {
390
100
  });
391
101
  SnippetManager.prototype.getTokenizer = function() {
392
102
  return SnippetManager.$tokenizer;
393
- }
103
+ };
394
104
  return SnippetManager.$tokenizer;
395
105
  };
396
106
 
@@ -433,7 +143,7 @@ var SnippetManager = function() {
433
143
  return s.getTabSize();
434
144
  case "FILENAME":
435
145
  case "FILEPATH":
436
- return "ace.ajax.org";
146
+ return "";
437
147
  case "FULLNAME":
438
148
  return "Ace";
439
149
  }
@@ -524,11 +234,14 @@ var SnippetManager = function() {
524
234
  return result;
525
235
  };
526
236
 
527
- this.insertSnippet = function(editor, snippetText) {
237
+ this.insertSnippetForSelection = function(editor, snippetText) {
528
238
  var cursor = editor.getCursorPosition();
529
239
  var line = editor.session.getLine(cursor.row);
530
- var indentString = line.match(/^\s*/)[0];
531
240
  var tabString = editor.session.getTabString();
241
+ var indentString = line.match(/^\s*/)[0];
242
+
243
+ if (cursor.column < indentString.length)
244
+ indentString = indentString.slice(0, cursor.column);
532
245
 
533
246
  var tokens = this.tokenizeTmSnippet(snippetText);
534
247
  tokens = this.resolveVariables(tokens, editor);
@@ -568,7 +281,7 @@ var SnippetManager = function() {
568
281
  tabstops.forEach(function(ts) {ts.length = 0});
569
282
  var expanding = {};
570
283
  function copyValue(val) {
571
- var copy = []
284
+ var copy = [];
572
285
  for (var i = 0; i < val.length; i++) {
573
286
  var p = val[i];
574
287
  if (typeof p == "object") {
@@ -587,8 +300,9 @@ var SnippetManager = function() {
587
300
  continue;
588
301
  var id = p.tabstopId;
589
302
  var i1 = tokens.indexOf(p, i + 1);
590
- if (expanding[id] == p) {
591
- expanding[id] = null;
303
+ if (expanding[id]) {
304
+ if (expanding[id] === p)
305
+ expanding[id] = null;
592
306
  continue;
593
307
  }
594
308
 
@@ -601,7 +315,7 @@ var SnippetManager = function() {
601
315
 
602
316
  if (ts.indexOf(p) === -1)
603
317
  ts.push(p);
604
- };
318
+ }
605
319
  var row = 0, column = 0;
606
320
  var text = "";
607
321
  tokens.forEach(function(t) {
@@ -623,17 +337,30 @@ var SnippetManager = function() {
623
337
  var end = editor.session.replace(range, text);
624
338
 
625
339
  var tabstopManager = new TabstopManager(editor);
626
- tabstopManager.addTabstops(tabstops, range.start, end);
627
- tabstopManager.tabNext();
340
+ var selectionId = editor.inVirtualSelectionMode && editor.selection.index;
341
+ tabstopManager.addTabstops(tabstops, range.start, end, selectionId);
342
+ };
343
+
344
+ this.insertSnippet = function(editor, snippetText) {
345
+ var self = this;
346
+ if (editor.inVirtualSelectionMode)
347
+ return self.insertSnippetForSelection(editor, snippetText);
348
+
349
+ editor.forEachSelection(function() {
350
+ self.insertSnippetForSelection(editor, snippetText);
351
+ }, null, {keepOrder: true});
352
+
353
+ if (editor.tabstopManager)
354
+ editor.tabstopManager.tabNext();
628
355
  };
629
356
 
630
357
  this.$getScope = function(editor) {
631
358
  var scope = editor.session.$mode.$id || "";
632
359
  scope = scope.split("/").pop();
633
360
  if (scope === "html" || scope === "php") {
634
- if (scope === "php")
361
+ if (scope === "php" && !editor.session.$mode.inlinePhp)
635
362
  scope = "html";
636
- var c = editor.getCursorPosition()
363
+ var c = editor.getCursorPosition();
637
364
  var state = editor.session.getState(c.row);
638
365
  if (typeof state === "object") {
639
366
  state = state[0];
@@ -662,7 +389,17 @@ var SnippetManager = function() {
662
389
  return scopes;
663
390
  };
664
391
 
665
- this.expandWithTab = function(editor) {
392
+ this.expandWithTab = function(editor, options) {
393
+ var self = this;
394
+ var result = editor.forEachSelection(function() {
395
+ return self.expandSnippetForSelection(editor, options);
396
+ }, null, {keepOrder: true});
397
+ if (result && editor.tabstopManager)
398
+ editor.tabstopManager.tabNext();
399
+ return result;
400
+ };
401
+
402
+ this.expandSnippetForSelection = function(editor, options) {
666
403
  var cursor = editor.getCursorPosition();
667
404
  var line = editor.session.getLine(cursor.row);
668
405
  var before = line.substring(0, cursor.column);
@@ -678,7 +415,8 @@ var SnippetManager = function() {
678
415
  }, this);
679
416
  if (!snippet)
680
417
  return false;
681
-
418
+ if (options && options.dryRun)
419
+ return true;
682
420
  editor.session.doc.removeInLine(cursor.row,
683
421
  cursor.column - snippet.replaceBefore.length,
684
422
  cursor.column + snippet.replaceAfter.length
@@ -686,7 +424,7 @@ var SnippetManager = function() {
686
424
 
687
425
  this.variables.M__ = snippet.matchBefore;
688
426
  this.variables.T__ = snippet.matchAfter;
689
- this.insertSnippet(editor, snippet.content);
427
+ this.insertSnippetForSelection(editor, snippet.content);
690
428
 
691
429
  this.variables.M__ = this.variables.T__ = null;
692
430
  return true;
@@ -716,9 +454,13 @@ var SnippetManager = function() {
716
454
  var snippetMap = this.snippetMap;
717
455
  var snippetNameMap = this.snippetNameMap;
718
456
  var self = this;
457
+
458
+ if (!snippets)
459
+ snippets = [];
460
+
719
461
  function wrapRegexp(src) {
720
462
  if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
721
- src = "(?:" + src + ")"
463
+ src = "(?:" + src + ")";
722
464
 
723
465
  return src || "";
724
466
  }
@@ -740,7 +482,7 @@ var SnippetManager = function() {
740
482
  function addSnippet(s) {
741
483
  if (!s.scope)
742
484
  s.scope = scope || "_";
743
- scope = s.scope
485
+ scope = s.scope;
744
486
  if (!snippetMap[scope]) {
745
487
  snippetMap[scope] = [];
746
488
  snippetNameMap[scope] = {};
@@ -766,12 +508,14 @@ var SnippetManager = function() {
766
508
 
767
509
  s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
768
510
  s.endTriggerRe = new RegExp(s.endTrigger, "", true);
769
- };
511
+ }
770
512
 
771
- if (snippets.content)
513
+ if (snippets && snippets.content)
772
514
  addSnippet(snippets);
773
515
  else if (Array.isArray(snippets))
774
516
  snippets.forEach(addSnippet);
517
+
518
+ this._signal("registerSnippets", {scope: scope});
775
519
  };
776
520
  this.unregister = function(snippets, scope) {
777
521
  var snippetMap = this.snippetMap;
@@ -800,7 +544,7 @@ var SnippetManager = function() {
800
544
  while (m = re.exec(str)) {
801
545
  if (m[1]) {
802
546
  try {
803
- snippet = JSON.parse(m[1])
547
+ snippet = JSON.parse(m[1]);
804
548
  list.push(snippet);
805
549
  } catch (e) {}
806
550
  } if (m[4]) {
@@ -853,9 +597,10 @@ var TabstopManager = function(editor) {
853
597
  };
854
598
  (function() {
855
599
  this.attach = function(editor) {
856
- this.index = -1;
600
+ this.index = 0;
857
601
  this.ranges = [];
858
602
  this.tabstops = [];
603
+ this.$openTabstops = null;
859
604
  this.selectedTabstop = null;
860
605
 
861
606
  this.editor = editor;
@@ -895,7 +640,7 @@ var TabstopManager = function(editor) {
895
640
  }
896
641
  if (!this.$inChange && isRemove) {
897
642
  var ts = this.selectedTabstop;
898
- var changedOutside = !ts.some(function(r) {
643
+ var changedOutside = ts && !ts.some(function(r) {
899
644
  return comparePoints(r.start, start) <= 0 && comparePoints(r.end, end) >= 0;
900
645
  });
901
646
  if (changedOutside)
@@ -907,7 +652,7 @@ var TabstopManager = function(editor) {
907
652
  if (r.end.row < start.row)
908
653
  continue;
909
654
 
910
- if (comparePoints(start, r.start) < 0 && comparePoints(end, r.end) > 0) {
655
+ if (isRemove && comparePoints(start, r.start) < 0 && comparePoints(end, r.end) > 0) {
911
656
  this.removeRange(r);
912
657
  i--;
913
658
  continue;
@@ -930,7 +675,7 @@ var TabstopManager = function(editor) {
930
675
  };
931
676
  this.updateLinkedFields = function() {
932
677
  var ts = this.selectedTabstop;
933
- if (!ts.hasLinkedRanges)
678
+ if (!ts || !ts.hasLinkedRanges)
934
679
  return;
935
680
  this.$inChange = true;
936
681
  var session = this.editor.session;
@@ -939,7 +684,7 @@ var TabstopManager = function(editor) {
939
684
  var range = ts[i];
940
685
  if (!range.linked)
941
686
  continue;
942
- var fmt = exports.snippetManager.tmStrFormat(text, range.original)
687
+ var fmt = exports.snippetManager.tmStrFormat(text, range.original);
943
688
  session.replace(range, fmt);
944
689
  }
945
690
  this.$inChange = false;
@@ -950,7 +695,7 @@ var TabstopManager = function(editor) {
950
695
  };
951
696
  this.onChangeSelection = function() {
952
697
  if (!this.editor)
953
- return
698
+ return;
954
699
  var lead = this.editor.selection.lead;
955
700
  var anchor = this.editor.selection.anchor;
956
701
  var isEmpty = this.editor.selection.isEmpty();
@@ -968,14 +713,17 @@ var TabstopManager = function(editor) {
968
713
  this.detach();
969
714
  };
970
715
  this.tabNext = function(dir) {
971
- var max = this.tabstops.length - 1;
716
+ var max = this.tabstops.length;
972
717
  var index = this.index + (dir || 1);
973
- index = Math.min(Math.max(index, 0), max);
974
- this.selectTabstop(index);
718
+ index = Math.min(Math.max(index, 1), max);
975
719
  if (index == max)
720
+ index = 0;
721
+ this.selectTabstop(index);
722
+ if (index === 0)
976
723
  this.detach();
977
724
  };
978
725
  this.selectTabstop = function(index) {
726
+ this.$openTabstops = null;
979
727
  var ts = this.tabstops[this.index];
980
728
  if (ts)
981
729
  this.addTabstopMarkers(ts);
@@ -993,117 +741,432 @@ var TabstopManager = function(editor) {
993
741
  continue;
994
742
  sel.addRange(ts[i].clone(), true);
995
743
  }
996
- } else {
997
- this.editor.selection.setRange(ts.firstNonLinked);
744
+ if (sel.ranges[0])
745
+ sel.addRange(sel.ranges[0].clone());
746
+ } else {
747
+ this.editor.selection.setRange(ts.firstNonLinked);
748
+ }
749
+
750
+ this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
751
+ };
752
+ this.addTabstops = function(tabstops, start, end) {
753
+ if (!this.$openTabstops)
754
+ this.$openTabstops = [];
755
+ if (!tabstops[0]) {
756
+ var p = Range.fromPoints(end, end);
757
+ moveRelative(p.start, start);
758
+ moveRelative(p.end, start);
759
+ tabstops[0] = [p];
760
+ tabstops[0].index = 0;
761
+ }
762
+
763
+ var i = this.index;
764
+ var arg = [i + 1, 0];
765
+ var ranges = this.ranges;
766
+ tabstops.forEach(function(ts, index) {
767
+ var dest = this.$openTabstops[index] || ts;
768
+
769
+ for (var i = ts.length; i--;) {
770
+ var p = ts[i];
771
+ var range = Range.fromPoints(p.start, p.end || p.start);
772
+ movePoint(range.start, start);
773
+ movePoint(range.end, start);
774
+ range.original = p;
775
+ range.tabstop = dest;
776
+ ranges.push(range);
777
+ if (dest != ts)
778
+ dest.unshift(range);
779
+ else
780
+ dest[i] = range;
781
+ if (p.fmtString) {
782
+ range.linked = true;
783
+ dest.hasLinkedRanges = true;
784
+ } else if (!dest.firstNonLinked)
785
+ dest.firstNonLinked = range;
786
+ }
787
+ if (!dest.firstNonLinked)
788
+ dest.hasLinkedRanges = false;
789
+ if (dest === ts) {
790
+ arg.push(dest);
791
+ this.$openTabstops[index] = dest;
792
+ }
793
+ this.addTabstopMarkers(dest);
794
+ }, this);
795
+
796
+ if (arg.length > 2) {
797
+ if (this.tabstops.length)
798
+ arg.push(arg.splice(2, 1)[0]);
799
+ this.tabstops.splice.apply(this.tabstops, arg);
800
+ }
801
+ };
802
+
803
+ this.addTabstopMarkers = function(ts) {
804
+ var session = this.editor.session;
805
+ ts.forEach(function(range) {
806
+ if (!range.markerId)
807
+ range.markerId = session.addMarker(range, "ace_snippet-marker", "text");
808
+ });
809
+ };
810
+ this.removeTabstopMarkers = function(ts) {
811
+ var session = this.editor.session;
812
+ ts.forEach(function(range) {
813
+ session.removeMarker(range.markerId);
814
+ range.markerId = null;
815
+ });
816
+ };
817
+ this.removeRange = function(range) {
818
+ var i = range.tabstop.indexOf(range);
819
+ range.tabstop.splice(i, 1);
820
+ i = this.ranges.indexOf(range);
821
+ this.ranges.splice(i, 1);
822
+ this.editor.session.removeMarker(range.markerId);
823
+ if (!range.tabstop.length) {
824
+ i = this.tabstops.indexOf(range.tabstop);
825
+ if (i != -1)
826
+ this.tabstops.splice(i, 1);
827
+ if (!this.tabstops.length)
828
+ this.detach();
829
+ }
830
+ };
831
+
832
+ this.keyboardHandler = new HashHandler();
833
+ this.keyboardHandler.bindKeys({
834
+ "Tab": function(ed) {
835
+ if (exports.snippetManager && exports.snippetManager.expandWithTab(ed)) {
836
+ return;
837
+ }
838
+
839
+ ed.tabstopManager.tabNext(1);
840
+ },
841
+ "Shift-Tab": function(ed) {
842
+ ed.tabstopManager.tabNext(-1);
843
+ },
844
+ "Esc": function(ed) {
845
+ ed.tabstopManager.detach();
846
+ },
847
+ "Return": function(ed) {
848
+ return false;
849
+ }
850
+ });
851
+ }).call(TabstopManager.prototype);
852
+
853
+
854
+
855
+ var changeTracker = {};
856
+ changeTracker.onChange = Anchor.prototype.onChange;
857
+ changeTracker.setPosition = function(row, column) {
858
+ this.pos.row = row;
859
+ this.pos.column = column;
860
+ };
861
+ changeTracker.update = function(pos, delta, $insertRight) {
862
+ this.$insertRight = $insertRight;
863
+ this.pos = pos;
864
+ this.onChange(delta);
865
+ };
866
+
867
+ var movePoint = function(point, diff) {
868
+ if (point.row == 0)
869
+ point.column += diff.column;
870
+ point.row += diff.row;
871
+ };
872
+
873
+ var moveRelative = function(point, start) {
874
+ if (point.row == start.row)
875
+ point.column -= start.column;
876
+ point.row -= start.row;
877
+ };
878
+
879
+
880
+ require("./lib/dom").importCssString("\
881
+ .ace_snippet-marker {\
882
+ -moz-box-sizing: border-box;\
883
+ box-sizing: border-box;\
884
+ background: rgba(194, 193, 208, 0.09);\
885
+ border: 1px dotted rgba(211, 208, 235, 0.62);\
886
+ position: absolute;\
887
+ }");
888
+
889
+ exports.snippetManager = new SnippetManager();
890
+
891
+
892
+ var Editor = require("./editor").Editor;
893
+ (function() {
894
+ this.insertSnippet = function(content, options) {
895
+ return exports.snippetManager.insertSnippet(this, content, options);
896
+ };
897
+ this.expandSnippet = function(options) {
898
+ return exports.snippetManager.expandWithTab(this, options);
899
+ };
900
+ }).call(Editor.prototype);
901
+
902
+ });
903
+
904
+ define("ace/ext/emmet",["require","exports","module","ace/keyboard/hash_handler","ace/editor","ace/snippets","ace/range","resources","resources","range","tabStops","resources","utils","actions","ace/config"], function(require, exports, module) {
905
+ "use strict";
906
+ var HashHandler = require("ace/keyboard/hash_handler").HashHandler;
907
+ var Editor = require("ace/editor").Editor;
908
+ var snippetManager = require("ace/snippets").snippetManager;
909
+ var Range = require("ace/range").Range;
910
+ var emmet;
911
+
912
+ Editor.prototype.indexToPosition = function(index) {
913
+ return this.session.doc.indexToPosition(index);
914
+ };
915
+
916
+ Editor.prototype.positionToIndex = function(pos) {
917
+ return this.session.doc.positionToIndex(pos);
918
+ };
919
+ function AceEmmetEditor() {}
920
+
921
+ AceEmmetEditor.prototype = {
922
+ setupContext: function(editor) {
923
+ this.ace = editor;
924
+ this.indentation = editor.session.getTabString();
925
+ if (!emmet)
926
+ emmet = window.emmet;
927
+ emmet.require("resources").setVariable("indentation", this.indentation);
928
+ this.$syntax = null;
929
+ this.$syntax = this.getSyntax();
930
+ },
931
+ getSelectionRange: function() {
932
+ var range = this.ace.getSelectionRange();
933
+ return {
934
+ start: this.ace.positionToIndex(range.start),
935
+ end: this.ace.positionToIndex(range.end)
936
+ };
937
+ },
938
+ createSelection: function(start, end) {
939
+ this.ace.selection.setRange({
940
+ start: this.ace.indexToPosition(start),
941
+ end: this.ace.indexToPosition(end)
942
+ });
943
+ },
944
+ getCurrentLineRange: function() {
945
+ var row = this.ace.getCursorPosition().row;
946
+ var lineLength = this.ace.session.getLine(row).length;
947
+ var index = this.ace.positionToIndex({row: row, column: 0});
948
+ return {
949
+ start: index,
950
+ end: index + lineLength
951
+ };
952
+ },
953
+ getCaretPos: function(){
954
+ var pos = this.ace.getCursorPosition();
955
+ return this.ace.positionToIndex(pos);
956
+ },
957
+ setCaretPos: function(index){
958
+ var pos = this.ace.indexToPosition(index);
959
+ this.ace.selection.moveToPosition(pos);
960
+ },
961
+ getCurrentLine: function() {
962
+ var row = this.ace.getCursorPosition().row;
963
+ return this.ace.session.getLine(row);
964
+ },
965
+ replaceContent: function(value, start, end, noIndent) {
966
+ if (end == null)
967
+ end = start == null ? this.getContent().length : start;
968
+ if (start == null)
969
+ start = 0;
970
+
971
+ var editor = this.ace;
972
+ var range = Range.fromPoints(editor.indexToPosition(start), editor.indexToPosition(end));
973
+ editor.session.remove(range);
974
+
975
+ range.end = range.start;
976
+
977
+ value = this.$updateTabstops(value);
978
+ snippetManager.insertSnippet(editor, value)
979
+ },
980
+ getContent: function(){
981
+ return this.ace.getValue();
982
+ },
983
+ getSyntax: function() {
984
+ if (this.$syntax)
985
+ return this.$syntax;
986
+ var syntax = this.ace.session.$modeId.split("/").pop();
987
+ if (syntax == "html" || syntax == "php") {
988
+ var cursor = this.ace.getCursorPosition();
989
+ var state = this.ace.session.getState(cursor.row);
990
+ if (typeof state != "string")
991
+ state = state[0];
992
+ if (state) {
993
+ state = state.split("-");
994
+ if (state.length > 1)
995
+ syntax = state[0];
996
+ else if (syntax == "php")
997
+ syntax = "html";
998
+ }
998
999
  }
999
-
1000
- this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
1001
- };
1002
- this.addTabstops = function(tabstops, start, end) {
1003
- if (!tabstops[0]) {
1004
- var p = Range.fromPoints(end, end);
1005
- moveRelative(p.start, start);
1006
- moveRelative(p.end, start);
1007
- tabstops[0] = [p];
1008
- tabstops[0].index = 0;
1000
+ return syntax;
1001
+ },
1002
+ getProfileName: function() {
1003
+ switch(this.getSyntax()) {
1004
+ case "css": return "css";
1005
+ case "xml":
1006
+ case "xsl":
1007
+ return "xml";
1008
+ case "html":
1009
+ var profile = emmet.require("resources").getVariable("profile");
1010
+ if (!profile)
1011
+ profile = this.ace.session.getLines(0,2).join("").search(/<!DOCTYPE[^>]+XHTML/i) != -1 ? "xhtml": "html";
1012
+ return profile;
1009
1013
  }
1014
+ return "xhtml";
1015
+ },
1016
+ prompt: function(title) {
1017
+ return prompt(title);
1018
+ },
1019
+ getSelection: function() {
1020
+ return this.ace.session.getTextRange();
1021
+ },
1022
+ getFilePath: function() {
1023
+ return "";
1024
+ },
1025
+ $updateTabstops: function(value) {
1026
+ var base = 1000;
1027
+ var zeroBase = 0;
1028
+ var lastZero = null;
1029
+ var range = emmet.require('range');
1030
+ var ts = emmet.require('tabStops');
1031
+ var settings = emmet.require('resources').getVocabulary("user");
1032
+ var tabstopOptions = {
1033
+ tabstop: function(data) {
1034
+ var group = parseInt(data.group, 10);
1035
+ var isZero = group === 0;
1036
+ if (isZero)
1037
+ group = ++zeroBase;
1038
+ else
1039
+ group += base;
1010
1040
 
1011
- var i = this.index;
1012
- var arg = [i, 0];
1013
- var ranges = this.ranges;
1014
- var editor = this.editor;
1015
- tabstops.forEach(function(ts) {
1016
- for (var i = ts.length; i--;) {
1017
- var p = ts[i];
1018
- var range = Range.fromPoints(p.start, p.end || p.start);
1019
- movePoint(range.start, start);
1020
- movePoint(range.end, start);
1021
- range.original = p;
1022
- range.tabstop = ts;
1023
- ranges.push(range);
1024
- ts[i] = range;
1025
- if (p.fmtString) {
1026
- range.linked = true;
1027
- ts.hasLinkedRanges = true;
1028
- } else if (!ts.firstNonLinked)
1029
- ts.firstNonLinked = range;
1030
- }
1031
- if (!ts.firstNonLinked)
1032
- ts.hasLinkedRanges = false;
1033
- arg.push(ts);
1034
- this.addTabstopMarkers(ts);
1035
- }, this);
1036
- arg.push(arg.splice(2, 1)[0]);
1037
- this.tabstops.splice.apply(this.tabstops, arg);
1038
- };
1041
+ var placeholder = data.placeholder;
1042
+ if (placeholder) {
1043
+ placeholder = ts.processText(placeholder, tabstopOptions);
1044
+ }
1039
1045
 
1040
- this.addTabstopMarkers = function(ts) {
1041
- var session = this.editor.session;
1042
- ts.forEach(function(range) {
1043
- if (!range.markerId)
1044
- range.markerId = session.addMarker(range, "ace_snippet-marker", "text");
1045
- });
1046
- };
1047
- this.removeTabstopMarkers = function(ts) {
1048
- var session = this.editor.session;
1049
- ts.forEach(function(range) {
1050
- session.removeMarker(range.markerId);
1051
- range.markerId = null;
1052
- });
1053
- };
1054
- this.removeRange = function(range) {
1055
- var i = range.tabstop.indexOf(range);
1056
- range.tabstop.splice(i, 1);
1057
- i = this.ranges.indexOf(range);
1058
- this.ranges.splice(i, 1);
1059
- this.editor.session.removeMarker(range.markerId);
1060
- };
1046
+ var result = '${' + group + (placeholder ? ':' + placeholder : '') + '}';
1061
1047
 
1062
- this.keyboardHandler = new HashHandler();
1063
- this.keyboardHandler.bindKeys({
1064
- "Tab": function(ed) {
1065
- if (exports.snippetManager && exports.snippetManager.expandWithTab(ed)) {
1066
- return;
1048
+ if (isZero) {
1049
+ lastZero = range.create(data.start, result);
1050
+ }
1051
+
1052
+ return result
1053
+ },
1054
+ escape: function(ch) {
1055
+ if (ch == '$') return '\\$';
1056
+ if (ch == '\\') return '\\\\';
1057
+ return ch;
1067
1058
  }
1059
+ };
1068
1060
 
1069
- ed.tabstopManager.tabNext(1);
1070
- },
1071
- "Shift-Tab": function(ed) {
1072
- ed.tabstopManager.tabNext(-1);
1073
- },
1074
- "Esc": function(ed) {
1075
- ed.tabstopManager.detach();
1076
- },
1077
- "Return": function(ed) {
1078
- return false;
1061
+ value = ts.processText(value, tabstopOptions);
1062
+
1063
+ if (settings.variables['insert_final_tabstop'] && !/\$\{0\}$/.test(value)) {
1064
+ value += '${0}';
1065
+ } else if (lastZero) {
1066
+ value = emmet.require('utils').replaceSubstring(value, '${0}', lastZero);
1079
1067
  }
1080
- });
1081
- }).call(TabstopManager.prototype);
1068
+
1069
+ return value;
1070
+ }
1071
+ };
1082
1072
 
1083
1073
 
1084
- var movePoint = function(point, diff) {
1085
- if (point.row == 0)
1086
- point.column += diff.column;
1087
- point.row += diff.row;
1074
+ var keymap = {
1075
+ expand_abbreviation: {"mac": "ctrl+alt+e", "win": "alt+e"},
1076
+ match_pair_outward: {"mac": "ctrl+d", "win": "ctrl+,"},
1077
+ match_pair_inward: {"mac": "ctrl+j", "win": "ctrl+shift+0"},
1078
+ matching_pair: {"mac": "ctrl+alt+j", "win": "alt+j"},
1079
+ next_edit_point: "alt+right",
1080
+ prev_edit_point: "alt+left",
1081
+ toggle_comment: {"mac": "command+/", "win": "ctrl+/"},
1082
+ split_join_tag: {"mac": "shift+command+'", "win": "shift+ctrl+`"},
1083
+ remove_tag: {"mac": "command+'", "win": "shift+ctrl+;"},
1084
+ evaluate_math_expression: {"mac": "shift+command+y", "win": "shift+ctrl+y"},
1085
+ increment_number_by_1: "ctrl+up",
1086
+ decrement_number_by_1: "ctrl+down",
1087
+ increment_number_by_01: "alt+up",
1088
+ decrement_number_by_01: "alt+down",
1089
+ increment_number_by_10: {"mac": "alt+command+up", "win": "shift+alt+up"},
1090
+ decrement_number_by_10: {"mac": "alt+command+down", "win": "shift+alt+down"},
1091
+ select_next_item: {"mac": "shift+command+.", "win": "shift+ctrl+."},
1092
+ select_previous_item: {"mac": "shift+command+,", "win": "shift+ctrl+,"},
1093
+ reflect_css_value: {"mac": "shift+command+r", "win": "shift+ctrl+r"},
1094
+
1095
+ encode_decode_data_url: {"mac": "shift+ctrl+d", "win": "ctrl+'"},
1096
+ expand_abbreviation_with_tab: "Tab",
1097
+ wrap_with_abbreviation: {"mac": "shift+ctrl+a", "win": "shift+ctrl+a"}
1088
1098
  };
1089
1099
 
1090
- var moveRelative = function(point, start) {
1091
- if (point.row == start.row)
1092
- point.column -= start.column;
1093
- point.row -= start.row;
1100
+ var editorProxy = new AceEmmetEditor();
1101
+ exports.commands = new HashHandler();
1102
+ exports.runEmmetCommand = function(editor) {
1103
+ editorProxy.setupContext(editor);
1104
+ if (editorProxy.getSyntax() == "php")
1105
+ return false;
1106
+ var actions = emmet.require("actions");
1107
+
1108
+ if (this.action == "expand_abbreviation_with_tab") {
1109
+ if (!editor.selection.isEmpty())
1110
+ return false;
1111
+ }
1112
+
1113
+ if (this.action == "wrap_with_abbreviation") {
1114
+ return setTimeout(function() {
1115
+ actions.run("wrap_with_abbreviation", editorProxy);
1116
+ }, 0);
1117
+ }
1118
+
1119
+ try {
1120
+ var result = actions.run(this.action, editorProxy);
1121
+ } catch(e) {
1122
+ editor._signal("changeStatus", typeof e == "string" ? e : e.message);
1123
+ console.log(e);
1124
+ result = false
1125
+ }
1126
+ return result;
1094
1127
  };
1095
1128
 
1129
+ for (var command in keymap) {
1130
+ exports.commands.addCommand({
1131
+ name: "emmet:" + command,
1132
+ action: command,
1133
+ bindKey: keymap[command],
1134
+ exec: exports.runEmmetCommand,
1135
+ multiSelectAction: "forEach"
1136
+ });
1137
+ }
1096
1138
 
1097
- require("./lib/dom").importCssString("\
1098
- .ace_snippet-marker {\
1099
- -moz-box-sizing: border-box;\
1100
- box-sizing: border-box;\
1101
- background: rgba(194, 193, 208, 0.09);\
1102
- border: 1px dotted rgba(211, 208, 235, 0.62);\
1103
- position: absolute;\
1104
- }");
1139
+ var onChangeMode = function(e, target) {
1140
+ var editor = target;
1141
+ if (!editor)
1142
+ return;
1143
+ var modeId = editor.session.$modeId;
1144
+ var enabled = modeId && /css|less|scss|sass|stylus|html|php/.test(modeId);
1145
+ if (e.enableEmmet === false)
1146
+ enabled = false;
1147
+ if (enabled)
1148
+ editor.keyBinding.addKeyboardHandler(exports.commands);
1149
+ else
1150
+ editor.keyBinding.removeKeyboardHandler(exports.commands);
1151
+ };
1105
1152
 
1106
- exports.snippetManager = new SnippetManager();
1153
+
1154
+ exports.AceEmmetEditor = AceEmmetEditor;
1155
+ require("ace/config").defineOptions(Editor.prototype, "editor", {
1156
+ enableEmmet: {
1157
+ set: function(val) {
1158
+ this[val ? "on" : "removeListener"]("changeMode", onChangeMode);
1159
+ onChangeMode({enableEmmet: !!val}, this);
1160
+ },
1161
+ value: true
1162
+ }
1163
+ });
1107
1164
 
1108
1165
 
1166
+ exports.setCore = function(e) {emmet = e;};
1109
1167
  });
1168
+ ;
1169
+ (function() {
1170
+ window.require(["ace/ext/emmet"], function() {});
1171
+ })();
1172
+