ace-oqc 1.4.13

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 (401) hide show
  1. package/package.json +7 -0
  2. package/src-noconflict/ace.js +21402 -0
  3. package/src-noconflict/ext-beautify.js +331 -0
  4. package/src-noconflict/ext-elastic_tabstops_lite.js +277 -0
  5. package/src-noconflict/ext-emmet.js +1331 -0
  6. package/src-noconflict/ext-error_marker.js +9 -0
  7. package/src-noconflict/ext-keybinding_menu.js +193 -0
  8. package/src-noconflict/ext-language_tools.js +2166 -0
  9. package/src-noconflict/ext-linking.js +64 -0
  10. package/src-noconflict/ext-modelist.js +248 -0
  11. package/src-noconflict/ext-options.js +799 -0
  12. package/src-noconflict/ext-prompt.js +2806 -0
  13. package/src-noconflict/ext-rtl.js +122 -0
  14. package/src-noconflict/ext-searchbox.js +514 -0
  15. package/src-noconflict/ext-settings_menu.js +820 -0
  16. package/src-noconflict/ext-spellcheck.js +73 -0
  17. package/src-noconflict/ext-split.js +207 -0
  18. package/src-noconflict/ext-static_highlight.js +229 -0
  19. package/src-noconflict/ext-statusbar.js +56 -0
  20. package/src-noconflict/ext-textarea.js +430 -0
  21. package/src-noconflict/ext-themelist.js +67 -0
  22. package/src-noconflict/ext-whitespace.js +213 -0
  23. package/src-noconflict/keybinding-emacs.js +1169 -0
  24. package/src-noconflict/keybinding-sublime.js +422 -0
  25. package/src-noconflict/keybinding-vim.js +6198 -0
  26. package/src-noconflict/mode-abap.js +221 -0
  27. package/src-noconflict/mode-abc.js +271 -0
  28. package/src-noconflict/mode-actionscript.js +275 -0
  29. package/src-noconflict/mode-ada.js +137 -0
  30. package/src-noconflict/mode-apache_conf.js +363 -0
  31. package/src-noconflict/mode-apex.js +457 -0
  32. package/src-noconflict/mode-applescript.js +278 -0
  33. package/src-noconflict/mode-aql.js +102 -0
  34. package/src-noconflict/mode-asciidoc.js +349 -0
  35. package/src-noconflict/mode-asl.js +422 -0
  36. package/src-noconflict/mode-assembly_x86.js +193 -0
  37. package/src-noconflict/mode-autohotkey.js +244 -0
  38. package/src-noconflict/mode-batchfile.js +230 -0
  39. package/src-noconflict/mode-c9search.js +293 -0
  40. package/src-noconflict/mode-c_cpp.js +503 -0
  41. package/src-noconflict/mode-cirru.js +210 -0
  42. package/src-noconflict/mode-clojure.js +315 -0
  43. package/src-noconflict/mode-cobol.js +101 -0
  44. package/src-noconflict/mode-coffee.js +400 -0
  45. package/src-noconflict/mode-coldfusion.js +2596 -0
  46. package/src-noconflict/mode-crystal.js +642 -0
  47. package/src-noconflict/mode-csharp.js +502 -0
  48. package/src-noconflict/mode-csound_document.js +4105 -0
  49. package/src-noconflict/mode-csound_orchestra.js +3035 -0
  50. package/src-noconflict/mode-csound_score.js +462 -0
  51. package/src-noconflict/mode-csp.js +59 -0
  52. package/src-noconflict/mode-css.js +720 -0
  53. package/src-noconflict/mode-curly.js +2564 -0
  54. package/src-noconflict/mode-d.js +520 -0
  55. package/src-noconflict/mode-dart.js +715 -0
  56. package/src-noconflict/mode-diff.js +147 -0
  57. package/src-noconflict/mode-django.js +2595 -0
  58. package/src-noconflict/mode-dockerfile.js +500 -0
  59. package/src-noconflict/mode-dot.js +417 -0
  60. package/src-noconflict/mode-drools.js +498 -0
  61. package/src-noconflict/mode-edifact.js +166 -0
  62. package/src-noconflict/mode-eiffel.js +135 -0
  63. package/src-noconflict/mode-ejs.js +3533 -0
  64. package/src-noconflict/mode-elixir.js +501 -0
  65. package/src-noconflict/mode-elm.js +306 -0
  66. package/src-noconflict/mode-erlang.js +1010 -0
  67. package/src-noconflict/mode-forth.js +297 -0
  68. package/src-noconflict/mode-fortran.js +430 -0
  69. package/src-noconflict/mode-fsharp.js +316 -0
  70. package/src-noconflict/mode-fsl.js +259 -0
  71. package/src-noconflict/mode-ftl.js +1193 -0
  72. package/src-noconflict/mode-gcode.js +93 -0
  73. package/src-noconflict/mode-gherkin.js +168 -0
  74. package/src-noconflict/mode-gitignore.js +59 -0
  75. package/src-noconflict/mode-glsl.js +580 -0
  76. package/src-noconflict/mode-gobstones.js +1090 -0
  77. package/src-noconflict/mode-golang.js +413 -0
  78. package/src-noconflict/mode-graphqlschema.js +214 -0
  79. package/src-noconflict/mode-groovy.js +989 -0
  80. package/src-noconflict/mode-haml.js +1873 -0
  81. package/src-noconflict/mode-handlebars.js +2622 -0
  82. package/src-noconflict/mode-haskell.js +380 -0
  83. package/src-noconflict/mode-haskell_cabal.js +141 -0
  84. package/src-noconflict/mode-haxe.js +386 -0
  85. package/src-noconflict/mode-hjson.js +353 -0
  86. package/src-noconflict/mode-html.js +2509 -0
  87. package/src-noconflict/mode-html_elixir.js +3088 -0
  88. package/src-noconflict/mode-html_ruby.js +3550 -0
  89. package/src-noconflict/mode-ini.js +162 -0
  90. package/src-noconflict/mode-io.js +248 -0
  91. package/src-noconflict/mode-jack.js +346 -0
  92. package/src-noconflict/mode-jade.js +2025 -0
  93. package/src-noconflict/mode-java.js +1038 -0
  94. package/src-noconflict/mode-javascript.js +798 -0
  95. package/src-noconflict/mode-json.js +329 -0
  96. package/src-noconflict/mode-jsoniq.js +2632 -0
  97. package/src-noconflict/mode-jsp.js +1433 -0
  98. package/src-noconflict/mode-jssm.js +325 -0
  99. package/src-noconflict/mode-jsx.js +411 -0
  100. package/src-noconflict/mode-julia.js +303 -0
  101. package/src-noconflict/mode-kotlin.js +797 -0
  102. package/src-noconflict/mode-latex.js +296 -0
  103. package/src-noconflict/mode-less.js +839 -0
  104. package/src-noconflict/mode-liquid.js +2742 -0
  105. package/src-noconflict/mode-lisp.js +112 -0
  106. package/src-noconflict/mode-livescript.js +279 -0
  107. package/src-noconflict/mode-logiql.js +317 -0
  108. package/src-noconflict/mode-logtalk.js +352 -0
  109. package/src-noconflict/mode-lsl.js +343 -0
  110. package/src-noconflict/mode-lua.js +452 -0
  111. package/src-noconflict/mode-luapage.js +3028 -0
  112. package/src-noconflict/mode-lucene.js +154 -0
  113. package/src-noconflict/mode-makefile.js +412 -0
  114. package/src-noconflict/mode-markdown.js +3194 -0
  115. package/src-noconflict/mode-mask.js +1803 -0
  116. package/src-noconflict/mode-matlab.js +263 -0
  117. package/src-noconflict/mode-maze.js +292 -0
  118. package/src-noconflict/mode-mel.js +263 -0
  119. package/src-noconflict/mode-mixal.js +122 -0
  120. package/src-noconflict/mode-mushcode.js +681 -0
  121. package/src-noconflict/mode-mysql.js +167 -0
  122. package/src-noconflict/mode-nginx.js +298 -0
  123. package/src-noconflict/mode-nim.js +363 -0
  124. package/src-noconflict/mode-nix.js +647 -0
  125. package/src-noconflict/mode-nsis.js +312 -0
  126. package/src-noconflict/mode-objectivec.js +740 -0
  127. package/src-noconflict/mode-ocaml.js +421 -0
  128. package/src-noconflict/mode-pascal.js +223 -0
  129. package/src-noconflict/mode-perl.js +381 -0
  130. package/src-noconflict/mode-pgsql.js +1743 -0
  131. package/src-noconflict/mode-php.js +13110 -0
  132. package/src-noconflict/mode-php_laravel_blade.js +13311 -0
  133. package/src-noconflict/mode-pig.js +310 -0
  134. package/src-noconflict/mode-plain_text.js +32 -0
  135. package/src-noconflict/mode-powershell.js +418 -0
  136. package/src-noconflict/mode-praat.js +478 -0
  137. package/src-noconflict/mode-prolog.js +371 -0
  138. package/src-noconflict/mode-properties.js +80 -0
  139. package/src-noconflict/mode-protobuf.js +593 -0
  140. package/src-noconflict/mode-puppet.js +368 -0
  141. package/src-noconflict/mode-python.js +508 -0
  142. package/src-noconflict/mode-r.js +312 -0
  143. package/src-noconflict/mode-razor.js +2875 -0
  144. package/src-noconflict/mode-rdoc.js +243 -0
  145. package/src-noconflict/mode-red.js +450 -0
  146. package/src-noconflict/mode-redshift.js +360 -0
  147. package/src-noconflict/mode-rhtml.js +2808 -0
  148. package/src-noconflict/mode-rst.js +257 -0
  149. package/src-noconflict/mode-ruby.js +1003 -0
  150. package/src-noconflict/mode-rust.js +282 -0
  151. package/src-noconflict/mode-sass.js +529 -0
  152. package/src-noconflict/mode-scad.js +414 -0
  153. package/src-noconflict/mode-scala.js +984 -0
  154. package/src-noconflict/mode-scheme.js +232 -0
  155. package/src-noconflict/mode-scss.js +873 -0
  156. package/src-noconflict/mode-sh.js +449 -0
  157. package/src-noconflict/mode-sjs.js +1015 -0
  158. package/src-noconflict/mode-slim.js +5240 -0
  159. package/src-noconflict/mode-smarty.js +2635 -0
  160. package/src-noconflict/mode-snippets.js +207 -0
  161. package/src-noconflict/mode-soy_template.js +2848 -0
  162. package/src-noconflict/mode-space.js +167 -0
  163. package/src-noconflict/mode-sparql.js +320 -0
  164. package/src-noconflict/mode-sql.js +271 -0
  165. package/src-noconflict/mode-sqlserver.js +445 -0
  166. package/src-noconflict/mode-stylus.js +472 -0
  167. package/src-noconflict/mode-svg.js +1582 -0
  168. package/src-noconflict/mode-swift.js +395 -0
  169. package/src-noconflict/mode-tcl.js +387 -0
  170. package/src-noconflict/mode-terraform.js +400 -0
  171. package/src-noconflict/mode-tex.js +160 -0
  172. package/src-noconflict/mode-text.js +9 -0
  173. package/src-noconflict/mode-textile.js +150 -0
  174. package/src-noconflict/mode-toml.js +153 -0
  175. package/src-noconflict/mode-tsx.js +888 -0
  176. package/src-noconflict/mode-turtle.js +296 -0
  177. package/src-noconflict/mode-twig.js +2693 -0
  178. package/src-noconflict/mode-typescript.js +869 -0
  179. package/src-noconflict/mode-vala.js +677 -0
  180. package/src-noconflict/mode-vbscript.js +635 -0
  181. package/src-noconflict/mode-velocity.js +2792 -0
  182. package/src-noconflict/mode-verilog.js +118 -0
  183. package/src-noconflict/mode-vhdl.js +116 -0
  184. package/src-noconflict/mode-visualforce.js +2640 -0
  185. package/src-noconflict/mode-wollok.js +914 -0
  186. package/src-noconflict/mode-xml.js +676 -0
  187. package/src-noconflict/mode-xquery.js +2644 -0
  188. package/src-noconflict/mode-yaml.js +330 -0
  189. package/src-noconflict/mode-zeek.js +539 -0
  190. package/src-noconflict/qurator-mode.js +120 -0
  191. package/src-noconflict/qurator-worker.js +91 -0
  192. package/src-noconflict/snippets/abap.js +9 -0
  193. package/src-noconflict/snippets/abc.js +45 -0
  194. package/src-noconflict/snippets/actionscript.js +171 -0
  195. package/src-noconflict/snippets/ada.js +9 -0
  196. package/src-noconflict/snippets/apache_conf.js +9 -0
  197. package/src-noconflict/snippets/apex.js +9 -0
  198. package/src-noconflict/snippets/applescript.js +9 -0
  199. package/src-noconflict/snippets/aql.js +9 -0
  200. package/src-noconflict/snippets/asciidoc.js +9 -0
  201. package/src-noconflict/snippets/asl.js +9 -0
  202. package/src-noconflict/snippets/assembly_x86.js +9 -0
  203. package/src-noconflict/snippets/autohotkey.js +9 -0
  204. package/src-noconflict/snippets/batchfile.js +9 -0
  205. package/src-noconflict/snippets/c9search.js +9 -0
  206. package/src-noconflict/snippets/c_cpp.js +145 -0
  207. package/src-noconflict/snippets/cirru.js +9 -0
  208. package/src-noconflict/snippets/clojure.js +104 -0
  209. package/src-noconflict/snippets/cobol.js +9 -0
  210. package/src-noconflict/snippets/coffee.js +109 -0
  211. package/src-noconflict/snippets/coldfusion.js +9 -0
  212. package/src-noconflict/snippets/crystal.js +9 -0
  213. package/src-noconflict/snippets/csharp.js +9 -0
  214. package/src-noconflict/snippets/csound_document.js +24 -0
  215. package/src-noconflict/snippets/csound_orchestra.js +61 -0
  216. package/src-noconflict/snippets/csound_score.js +9 -0
  217. package/src-noconflict/snippets/csp.js +9 -0
  218. package/src-noconflict/snippets/css.js +981 -0
  219. package/src-noconflict/snippets/curly.js +9 -0
  220. package/src-noconflict/snippets/d.js +9 -0
  221. package/src-noconflict/snippets/dart.js +97 -0
  222. package/src-noconflict/snippets/diff.js +25 -0
  223. package/src-noconflict/snippets/django.js +122 -0
  224. package/src-noconflict/snippets/dockerfile.js +9 -0
  225. package/src-noconflict/snippets/dot.js +9 -0
  226. package/src-noconflict/snippets/drools.js +33 -0
  227. package/src-noconflict/snippets/edifact.js +254 -0
  228. package/src-noconflict/snippets/eiffel.js +9 -0
  229. package/src-noconflict/snippets/ejs.js +9 -0
  230. package/src-noconflict/snippets/elixir.js +9 -0
  231. package/src-noconflict/snippets/elm.js +9 -0
  232. package/src-noconflict/snippets/erlang.js +174 -0
  233. package/src-noconflict/snippets/forth.js +9 -0
  234. package/src-noconflict/snippets/fortran.js +9 -0
  235. package/src-noconflict/snippets/fsharp.js +9 -0
  236. package/src-noconflict/snippets/fsl.js +14 -0
  237. package/src-noconflict/snippets/ftl.js +9 -0
  238. package/src-noconflict/snippets/gcode.js +9 -0
  239. package/src-noconflict/snippets/gherkin.js +9 -0
  240. package/src-noconflict/snippets/gitignore.js +9 -0
  241. package/src-noconflict/snippets/glsl.js +9 -0
  242. package/src-noconflict/snippets/gobstones.js +1718 -0
  243. package/src-noconflict/snippets/golang.js +9 -0
  244. package/src-noconflict/snippets/graphqlschema.js +46 -0
  245. package/src-noconflict/snippets/groovy.js +9 -0
  246. package/src-noconflict/snippets/haml.js +34 -0
  247. package/src-noconflict/snippets/handlebars.js +9 -0
  248. package/src-noconflict/snippets/haskell.js +96 -0
  249. package/src-noconflict/snippets/haskell_cabal.js +9 -0
  250. package/src-noconflict/snippets/haxe.js +9 -0
  251. package/src-noconflict/snippets/hjson.js +9 -0
  252. package/src-noconflict/snippets/html.js +867 -0
  253. package/src-noconflict/snippets/html_elixir.js +9 -0
  254. package/src-noconflict/snippets/html_ruby.js +9 -0
  255. package/src-noconflict/snippets/ini.js +9 -0
  256. package/src-noconflict/snippets/io.js +76 -0
  257. package/src-noconflict/snippets/jack.js +9 -0
  258. package/src-noconflict/snippets/jade.js +9 -0
  259. package/src-noconflict/snippets/java.js +254 -0
  260. package/src-noconflict/snippets/javascript.js +209 -0
  261. package/src-noconflict/snippets/json.js +9 -0
  262. package/src-noconflict/snippets/jsoniq.js +75 -0
  263. package/src-noconflict/snippets/jsp.js +113 -0
  264. package/src-noconflict/snippets/jssm.js +9 -0
  265. package/src-noconflict/snippets/jsx.js +9 -0
  266. package/src-noconflict/snippets/julia.js +9 -0
  267. package/src-noconflict/snippets/kotlin.js +9 -0
  268. package/src-noconflict/snippets/latex.js +9 -0
  269. package/src-noconflict/snippets/less.js +9 -0
  270. package/src-noconflict/snippets/liquid.js +895 -0
  271. package/src-noconflict/snippets/lisp.js +9 -0
  272. package/src-noconflict/snippets/livescript.js +9 -0
  273. package/src-noconflict/snippets/logiql.js +9 -0
  274. package/src-noconflict/snippets/logtalk.js +9 -0
  275. package/src-noconflict/snippets/lsl.js +1246 -0
  276. package/src-noconflict/snippets/lua.js +35 -0
  277. package/src-noconflict/snippets/luapage.js +9 -0
  278. package/src-noconflict/snippets/lucene.js +9 -0
  279. package/src-noconflict/snippets/makefile.js +18 -0
  280. package/src-noconflict/snippets/markdown.js +102 -0
  281. package/src-noconflict/snippets/mask.js +9 -0
  282. package/src-noconflict/snippets/matlab.js +9 -0
  283. package/src-noconflict/snippets/maze.js +23 -0
  284. package/src-noconflict/snippets/mel.js +9 -0
  285. package/src-noconflict/snippets/mixal.js +9 -0
  286. package/src-noconflict/snippets/mushcode.js +9 -0
  287. package/src-noconflict/snippets/mysql.js +9 -0
  288. package/src-noconflict/snippets/nginx.js +9 -0
  289. package/src-noconflict/snippets/nim.js +9 -0
  290. package/src-noconflict/snippets/nix.js +9 -0
  291. package/src-noconflict/snippets/nsis.js +9 -0
  292. package/src-noconflict/snippets/objectivec.js +9 -0
  293. package/src-noconflict/snippets/ocaml.js +9 -0
  294. package/src-noconflict/snippets/pascal.js +9 -0
  295. package/src-noconflict/snippets/perl.js +361 -0
  296. package/src-noconflict/snippets/pgsql.js +9 -0
  297. package/src-noconflict/snippets/php.js +397 -0
  298. package/src-noconflict/snippets/php_laravel_blade.js +9 -0
  299. package/src-noconflict/snippets/pig.js +9 -0
  300. package/src-noconflict/snippets/plain_text.js +9 -0
  301. package/src-noconflict/snippets/powershell.js +9 -0
  302. package/src-noconflict/snippets/praat.js +9 -0
  303. package/src-noconflict/snippets/prolog.js +9 -0
  304. package/src-noconflict/snippets/properties.js +9 -0
  305. package/src-noconflict/snippets/protobuf.js +9 -0
  306. package/src-noconflict/snippets/puppet.js +9 -0
  307. package/src-noconflict/snippets/python.js +172 -0
  308. package/src-noconflict/snippets/r.js +135 -0
  309. package/src-noconflict/snippets/razor.js +17 -0
  310. package/src-noconflict/snippets/rdoc.js +9 -0
  311. package/src-noconflict/snippets/red.js +9 -0
  312. package/src-noconflict/snippets/redshift.js +9 -0
  313. package/src-noconflict/snippets/rhtml.js +9 -0
  314. package/src-noconflict/snippets/rst.js +36 -0
  315. package/src-noconflict/snippets/ruby.js +942 -0
  316. package/src-noconflict/snippets/rust.js +9 -0
  317. package/src-noconflict/snippets/sass.js +9 -0
  318. package/src-noconflict/snippets/scad.js +9 -0
  319. package/src-noconflict/snippets/scala.js +9 -0
  320. package/src-noconflict/snippets/scheme.js +9 -0
  321. package/src-noconflict/snippets/scss.js +9 -0
  322. package/src-noconflict/snippets/sh.js +97 -0
  323. package/src-noconflict/snippets/sjs.js +9 -0
  324. package/src-noconflict/snippets/slim.js +9 -0
  325. package/src-noconflict/snippets/smarty.js +9 -0
  326. package/src-noconflict/snippets/snippets.js +23 -0
  327. package/src-noconflict/snippets/soy_template.js +9 -0
  328. package/src-noconflict/snippets/space.js +9 -0
  329. package/src-noconflict/snippets/sparql.js +9 -0
  330. package/src-noconflict/snippets/sql.js +40 -0
  331. package/src-noconflict/snippets/sqlserver.js +83 -0
  332. package/src-noconflict/snippets/stylus.js +9 -0
  333. package/src-noconflict/snippets/svg.js +9 -0
  334. package/src-noconflict/snippets/swift.js +9 -0
  335. package/src-noconflict/snippets/tcl.js +106 -0
  336. package/src-noconflict/snippets/terraform.js +9 -0
  337. package/src-noconflict/snippets/tex.js +204 -0
  338. package/src-noconflict/snippets/text.js +9 -0
  339. package/src-noconflict/snippets/textile.js +44 -0
  340. package/src-noconflict/snippets/toml.js +9 -0
  341. package/src-noconflict/snippets/tsx.js +9 -0
  342. package/src-noconflict/snippets/turtle.js +9 -0
  343. package/src-noconflict/snippets/twig.js +9 -0
  344. package/src-noconflict/snippets/typescript.js +9 -0
  345. package/src-noconflict/snippets/vala.js +200 -0
  346. package/src-noconflict/snippets/vbscript.js +9 -0
  347. package/src-noconflict/snippets/velocity.js +43 -0
  348. package/src-noconflict/snippets/verilog.js +9 -0
  349. package/src-noconflict/snippets/vhdl.js +9 -0
  350. package/src-noconflict/snippets/visualforce.js +9 -0
  351. package/src-noconflict/snippets/wollok.js +98 -0
  352. package/src-noconflict/snippets/xml.js +9 -0
  353. package/src-noconflict/snippets/xquery.js +75 -0
  354. package/src-noconflict/snippets/yaml.js +9 -0
  355. package/src-noconflict/snippets/zeek.js +9 -0
  356. package/src-noconflict/theme-ambiance.js +185 -0
  357. package/src-noconflict/theme-chaos.js +163 -0
  358. package/src-noconflict/theme-chrome.js +135 -0
  359. package/src-noconflict/theme-clouds.js +102 -0
  360. package/src-noconflict/theme-clouds_midnight.js +103 -0
  361. package/src-noconflict/theme-cobalt.js +120 -0
  362. package/src-noconflict/theme-crimson_editor.js +125 -0
  363. package/src-noconflict/theme-dawn.js +115 -0
  364. package/src-noconflict/theme-dracula.js +135 -0
  365. package/src-noconflict/theme-dreamweaver.js +148 -0
  366. package/src-noconflict/theme-eclipse.js +105 -0
  367. package/src-noconflict/theme-github.js +110 -0
  368. package/src-noconflict/theme-gob.js +119 -0
  369. package/src-noconflict/theme-gruvbox.js +89 -0
  370. package/src-noconflict/theme-idle_fingers.js +103 -0
  371. package/src-noconflict/theme-iplastic.js +128 -0
  372. package/src-noconflict/theme-katzenmilch.js +128 -0
  373. package/src-noconflict/theme-kr_theme.js +111 -0
  374. package/src-noconflict/theme-kuroir.js +68 -0
  375. package/src-noconflict/theme-merbivore.js +102 -0
  376. package/src-noconflict/theme-merbivore_soft.js +103 -0
  377. package/src-noconflict/theme-mono_industrial.js +114 -0
  378. package/src-noconflict/theme-monokai.js +112 -0
  379. package/src-noconflict/theme-pastel_on_dark.js +115 -0
  380. package/src-noconflict/theme-solarized_dark.js +95 -0
  381. package/src-noconflict/theme-solarized_light.js +98 -0
  382. package/src-noconflict/theme-sqlserver.js +145 -0
  383. package/src-noconflict/theme-terminal.js +121 -0
  384. package/src-noconflict/theme-textmate.js +137 -0
  385. package/src-noconflict/theme-tomorrow.js +115 -0
  386. package/src-noconflict/theme-tomorrow_night.js +115 -0
  387. package/src-noconflict/theme-tomorrow_night_blue.js +113 -0
  388. package/src-noconflict/theme-tomorrow_night_bright.js +128 -0
  389. package/src-noconflict/theme-tomorrow_night_eighties.js +115 -0
  390. package/src-noconflict/theme-twilight.js +116 -0
  391. package/src-noconflict/theme-vibrant_ink.js +101 -0
  392. package/src-noconflict/theme-xcode.js +95 -0
  393. package/src-noconflict/worker-coffee.js +1470 -0
  394. package/src-noconflict/worker-css.js +9000 -0
  395. package/src-noconflict/worker-html.js +10922 -0
  396. package/src-noconflict/worker-javascript.js +15001 -0
  397. package/src-noconflict/worker-json.js +1715 -0
  398. package/src-noconflict/worker-lua.js +3608 -0
  399. package/src-noconflict/worker-php.js +3687 -0
  400. package/src-noconflict/worker-xml.js +3208 -0
  401. package/src-noconflict/worker-xquery.js +57668 -0
@@ -0,0 +1,2166 @@
1
+ ace.define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"], function(require, exports, module) {
2
+ "use strict";
3
+ var dom = require("./lib/dom");
4
+ var oop = require("./lib/oop");
5
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
6
+ var lang = require("./lib/lang");
7
+ var Range = require("./range").Range;
8
+ var RangeList = require("./range_list").RangeList;
9
+ var HashHandler = require("./keyboard/hash_handler").HashHandler;
10
+ var Tokenizer = require("./tokenizer").Tokenizer;
11
+ var clipboard = require("./clipboard");
12
+
13
+ var VARIABLES = {
14
+ CURRENT_WORD: function(editor) {
15
+ return editor.session.getTextRange(editor.session.getWordRange());
16
+ },
17
+ SELECTION: function(editor, name, indentation) {
18
+ var text = editor.session.getTextRange();
19
+ if (indentation)
20
+ return text.replace(/\n\r?([ \t]*\S)/g, "\n" + indentation + "$1");
21
+ return text;
22
+ },
23
+ CURRENT_LINE: function(editor) {
24
+ return editor.session.getLine(editor.getCursorPosition().row);
25
+ },
26
+ PREV_LINE: function(editor) {
27
+ return editor.session.getLine(editor.getCursorPosition().row - 1);
28
+ },
29
+ LINE_INDEX: function(editor) {
30
+ return editor.getCursorPosition().row;
31
+ },
32
+ LINE_NUMBER: function(editor) {
33
+ return editor.getCursorPosition().row + 1;
34
+ },
35
+ SOFT_TABS: function(editor) {
36
+ return editor.session.getUseSoftTabs() ? "YES" : "NO";
37
+ },
38
+ TAB_SIZE: function(editor) {
39
+ return editor.session.getTabSize();
40
+ },
41
+ CLIPBOARD: function(editor) {
42
+ return clipboard.getText && clipboard.getText();
43
+ },
44
+ FILENAME: function(editor) {
45
+ return /[^/\\]*$/.exec(this.FILEPATH(editor))[0];
46
+ },
47
+ FILENAME_BASE: function(editor) {
48
+ return /[^/\\]*$/.exec(this.FILEPATH(editor))[0].replace(/\.[^.]*$/, "");
49
+ },
50
+ DIRECTORY: function(editor) {
51
+ return this.FILEPATH(editor).replace(/[^/\\]*$/, "");
52
+ },
53
+ FILEPATH: function(editor) { return "/not implemented.txt"; },
54
+ WORKSPACE_NAME: function() { return "Unknown"; },
55
+ FULLNAME: function() { return "Unknown"; },
56
+ BLOCK_COMMENT_START: function(editor) {
57
+ var mode = editor.session.$mode || {};
58
+ return mode.blockComment && mode.blockComment.start || "";
59
+ },
60
+ BLOCK_COMMENT_END: function(editor) {
61
+ var mode = editor.session.$mode || {};
62
+ return mode.blockComment && mode.blockComment.end || "";
63
+ },
64
+ LINE_COMMENT: function(editor) {
65
+ var mode = editor.session.$mode || {};
66
+ return mode.lineCommentStart || "";
67
+ },
68
+ CURRENT_YEAR: date.bind(null, {year: "numeric"}),
69
+ CURRENT_YEAR_SHORT: date.bind(null, {year: "2-digit"}),
70
+ CURRENT_MONTH: date.bind(null, {month: "numeric"}),
71
+ CURRENT_MONTH_NAME: date.bind(null, {month: "long"}),
72
+ CURRENT_MONTH_NAME_SHORT: date.bind(null, {month: "short"}),
73
+ CURRENT_DATE: date.bind(null, {day: "2-digit"}),
74
+ CURRENT_DAY_NAME: date.bind(null, {weekday: "long"}),
75
+ CURRENT_DAY_NAME_SHORT: date.bind(null, {weekday: "short"}),
76
+ CURRENT_HOUR: date.bind(null, {hour: "2-digit", hour12: false}),
77
+ CURRENT_MINUTE: date.bind(null, {minute: "2-digit"}),
78
+ CURRENT_SECOND: date.bind(null, {second: "2-digit"})
79
+ };
80
+
81
+ VARIABLES.SELECTED_TEXT = VARIABLES.SELECTION;
82
+
83
+ function date(dateFormat) {
84
+ var str = new Date().toLocaleString("en-us", dateFormat);
85
+ return str.length == 1 ? "0" + str : str;
86
+ }
87
+
88
+ var SnippetManager = function() {
89
+ this.snippetMap = {};
90
+ this.snippetNameMap = {};
91
+ };
92
+
93
+ (function() {
94
+ oop.implement(this, EventEmitter);
95
+
96
+ this.getTokenizer = function() {
97
+ return SnippetManager.$tokenizer || this.createTokenizer();
98
+ };
99
+
100
+ this.createTokenizer = function() {
101
+ function TabstopToken(str) {
102
+ str = str.substr(1);
103
+ if (/^\d+$/.test(str))
104
+ return [{tabstopId: parseInt(str, 10)}];
105
+ return [{text: str}];
106
+ }
107
+ function escape(ch) {
108
+ return "(?:[^\\\\" + ch + "]|\\\\.)";
109
+ }
110
+ var formatMatcher = {
111
+ regex: "/(" + escape("/") + "+)/",
112
+ onMatch: function(val, state, stack) {
113
+ var ts = stack[0];
114
+ ts.fmtString = true;
115
+ ts.guard = val.slice(1, -1);
116
+ ts.flag = "";
117
+ return "";
118
+ },
119
+ next: "formatString"
120
+ };
121
+
122
+ SnippetManager.$tokenizer = new Tokenizer({
123
+ start: [
124
+ {regex: /\\./, onMatch: function(val, state, stack) {
125
+ var ch = val[1];
126
+ if (ch == "}" && stack.length) {
127
+ val = ch;
128
+ } else if ("`$\\".indexOf(ch) != -1) {
129
+ val = ch;
130
+ }
131
+ return [val];
132
+ }},
133
+ {regex: /}/, onMatch: function(val, state, stack) {
134
+ return [stack.length ? stack.shift() : val];
135
+ }},
136
+ {regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken},
137
+ {regex: /\$\{[\dA-Z_a-z]+/, onMatch: function(str, state, stack) {
138
+ var t = TabstopToken(str.substr(1));
139
+ stack.unshift(t[0]);
140
+ return t;
141
+ }, next: "snippetVar"},
142
+ {regex: /\n/, token: "newline", merge: false}
143
+ ],
144
+ snippetVar: [
145
+ {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) {
146
+ var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function(operator) {
147
+ return operator.length == 2 ? operator[1] : "\x00";
148
+ }).split("\x00").map(function(value){
149
+ return {value: value};
150
+ });
151
+ stack[0].choices = choices;
152
+ return [choices[0]];
153
+ }, next: "start"},
154
+ formatMatcher,
155
+ {regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start"}
156
+ ],
157
+ formatString: [
158
+ {regex: /:/, onMatch: function(val, state, stack) {
159
+ if (stack.length && stack[0].expectElse) {
160
+ stack[0].expectElse = false;
161
+ stack[0].ifEnd = {elseEnd: stack[0]};
162
+ return [stack[0].ifEnd];
163
+ }
164
+ return ":";
165
+ }},
166
+ {regex: /\\./, onMatch: function(val, state, stack) {
167
+ var ch = val[1];
168
+ if (ch == "}" && stack.length)
169
+ val = ch;
170
+ else if ("`$\\".indexOf(ch) != -1)
171
+ val = ch;
172
+ else if (ch == "n")
173
+ val = "\n";
174
+ else if (ch == "t")
175
+ val = "\t";
176
+ else if ("ulULE".indexOf(ch) != -1)
177
+ val = {changeCase: ch, local: ch > "a"};
178
+ return [val];
179
+ }},
180
+ {regex: "/\\w*}", onMatch: function(val, state, stack) {
181
+ var next = stack.shift();
182
+ if (next)
183
+ next.flag = val.slice(1, -1);
184
+ this.next = next && next.tabstopId ? "start" : "";
185
+ return [next || val];
186
+ }, next: "start"},
187
+ {regex: /\$(?:\d+|\w+)/, onMatch: function(val, state, stack) {
188
+ return [{text: val.slice(1)}];
189
+ }},
190
+ {regex: /\${\w+/, onMatch: function(val, state, stack) {
191
+ var token = {text: val.slice(2)};
192
+ stack.unshift(token);
193
+ return [token];
194
+ }, next: "formatStringVar"},
195
+ {regex: /\n/, token: "newline", merge: false},
196
+ {regex: /}/, onMatch: function(val, state, stack) {
197
+ var next = stack.shift();
198
+ this.next = next && next.tabstopId ? "start" : "";
199
+ return [next || val];
200
+ }, next: "start"}
201
+ ],
202
+ formatStringVar: [
203
+ {regex: /:\/\w+}/, onMatch: function(val, state, stack) {
204
+ var ts = stack[0];
205
+ ts.formatFunction = val.slice(2, -1);
206
+ return [stack.shift()];
207
+ }, next: "formatString"},
208
+ formatMatcher,
209
+ {regex: /:[\?\-+]?/, onMatch: function(val, state, stack) {
210
+ if (val[1] == "+")
211
+ stack[0].ifEnd = stack[0];
212
+ if (val[1] == "?")
213
+ stack[0].expectElse = true;
214
+ }, next: "formatString"},
215
+ {regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "formatString"}
216
+ ]
217
+ });
218
+ return SnippetManager.$tokenizer;
219
+ };
220
+
221
+ this.tokenizeTmSnippet = function(str, startState) {
222
+ return this.getTokenizer().getLineTokens(str, startState).tokens.map(function(x) {
223
+ return x.value || x;
224
+ });
225
+ };
226
+
227
+ this.getVariableValue = function(editor, name, indentation) {
228
+ if (/^\d+$/.test(name))
229
+ return (this.variables.__ || {})[name] || "";
230
+ if (/^[A-Z]\d+$/.test(name))
231
+ return (this.variables[name[0] + "__"] || {})[name.substr(1)] || "";
232
+
233
+ name = name.replace(/^TM_/, "");
234
+ if (!this.variables.hasOwnProperty(name))
235
+ return "";
236
+ var value = this.variables[name];
237
+ if (typeof value == "function")
238
+ value = this.variables[name](editor, name, indentation);
239
+ return value == null ? "" : value;
240
+ };
241
+
242
+ this.variables = VARIABLES;
243
+ this.tmStrFormat = function(str, ch, editor) {
244
+ if (!ch.fmt) return str;
245
+ var flag = ch.flag || "";
246
+ var re = ch.guard;
247
+ re = new RegExp(re, flag.replace(/[^gim]/g, ""));
248
+ var fmtTokens = typeof ch.fmt == "string" ? this.tokenizeTmSnippet(ch.fmt, "formatString") : ch.fmt;
249
+ var _self = this;
250
+ var formatted = str.replace(re, function() {
251
+ var oldArgs = _self.variables.__;
252
+ _self.variables.__ = [].slice.call(arguments);
253
+ var fmtParts = _self.resolveVariables(fmtTokens, editor);
254
+ var gChangeCase = "E";
255
+ for (var i = 0; i < fmtParts.length; i++) {
256
+ var ch = fmtParts[i];
257
+ if (typeof ch == "object") {
258
+ fmtParts[i] = "";
259
+ if (ch.changeCase && ch.local) {
260
+ var next = fmtParts[i + 1];
261
+ if (next && typeof next == "string") {
262
+ if (ch.changeCase == "u")
263
+ fmtParts[i] = next[0].toUpperCase();
264
+ else
265
+ fmtParts[i] = next[0].toLowerCase();
266
+ fmtParts[i + 1] = next.substr(1);
267
+ }
268
+ } else if (ch.changeCase) {
269
+ gChangeCase = ch.changeCase;
270
+ }
271
+ } else if (gChangeCase == "U") {
272
+ fmtParts[i] = ch.toUpperCase();
273
+ } else if (gChangeCase == "L") {
274
+ fmtParts[i] = ch.toLowerCase();
275
+ }
276
+ }
277
+ _self.variables.__ = oldArgs;
278
+ return fmtParts.join("");
279
+ });
280
+ return formatted;
281
+ };
282
+
283
+ this.tmFormatFunction = function(str, ch, editor) {
284
+ if (ch.formatFunction == "upcase")
285
+ return str.toUpperCase();
286
+ if (ch.formatFunction == "downcase")
287
+ return str.toLowerCase();
288
+ return str;
289
+ };
290
+
291
+ this.resolveVariables = function(snippet, editor) {
292
+ var result = [];
293
+ var indentation = "";
294
+ var afterNewLine = true;
295
+ for (var i = 0; i < snippet.length; i++) {
296
+ var ch = snippet[i];
297
+ if (typeof ch == "string") {
298
+ result.push(ch);
299
+ if (ch == "\n") {
300
+ afterNewLine = true;
301
+ indentation = "";
302
+ }
303
+ else if (afterNewLine) {
304
+ indentation = /^\t*/.exec(ch)[0];
305
+ afterNewLine = /\S/.test(ch);
306
+ }
307
+ continue;
308
+ }
309
+ if (!ch) continue;
310
+ afterNewLine = false;
311
+
312
+ if (ch.fmtString) {
313
+ var j = snippet.indexOf(ch, i + 1);
314
+ if (j == -1) j = snippet.length;
315
+ ch.fmt = snippet.slice(i + 1, j);
316
+ i = j;
317
+ }
318
+
319
+ if (ch.text) {
320
+ var value = this.getVariableValue(editor, ch.text, indentation) + "";
321
+ if (ch.fmtString)
322
+ value = this.tmStrFormat(value, ch, editor);
323
+ if (ch.formatFunction)
324
+ value = this.tmFormatFunction(value, ch, editor);
325
+
326
+ if (value && !ch.ifEnd) {
327
+ result.push(value);
328
+ gotoNext(ch);
329
+ } else if (!value && ch.ifEnd) {
330
+ gotoNext(ch.ifEnd);
331
+ }
332
+ } else if (ch.elseEnd) {
333
+ gotoNext(ch.elseEnd);
334
+ } else if (ch.tabstopId != null) {
335
+ result.push(ch);
336
+ } else if (ch.changeCase != null) {
337
+ result.push(ch);
338
+ }
339
+ }
340
+ function gotoNext(ch) {
341
+ var i1 = snippet.indexOf(ch, i + 1);
342
+ if (i1 != -1)
343
+ i = i1;
344
+ }
345
+ return result;
346
+ };
347
+
348
+ this.insertSnippetForSelection = function(editor, snippetText) {
349
+ var cursor = editor.getCursorPosition();
350
+ var line = editor.session.getLine(cursor.row);
351
+ var tabString = editor.session.getTabString();
352
+ var indentString = line.match(/^\s*/)[0];
353
+
354
+ if (cursor.column < indentString.length)
355
+ indentString = indentString.slice(0, cursor.column);
356
+
357
+ snippetText = snippetText.replace(/\r/g, "");
358
+ var tokens = this.tokenizeTmSnippet(snippetText);
359
+ tokens = this.resolveVariables(tokens, editor);
360
+ tokens = tokens.map(function(x) {
361
+ if (x == "\n")
362
+ return x + indentString;
363
+ if (typeof x == "string")
364
+ return x.replace(/\t/g, tabString);
365
+ return x;
366
+ });
367
+ var tabstops = [];
368
+ tokens.forEach(function(p, i) {
369
+ if (typeof p != "object")
370
+ return;
371
+ var id = p.tabstopId;
372
+ var ts = tabstops[id];
373
+ if (!ts) {
374
+ ts = tabstops[id] = [];
375
+ ts.index = id;
376
+ ts.value = "";
377
+ ts.parents = {};
378
+ }
379
+ if (ts.indexOf(p) !== -1)
380
+ return;
381
+ if (p.choices && !ts.choices)
382
+ ts.choices = p.choices;
383
+ ts.push(p);
384
+ var i1 = tokens.indexOf(p, i + 1);
385
+ if (i1 === -1)
386
+ return;
387
+
388
+ var value = tokens.slice(i + 1, i1);
389
+ var isNested = value.some(function(t) {return typeof t === "object";});
390
+ if (isNested && !ts.value) {
391
+ ts.value = value;
392
+ } else if (value.length && (!ts.value || typeof ts.value !== "string")) {
393
+ ts.value = value.join("");
394
+ }
395
+ });
396
+ tabstops.forEach(function(ts) {ts.length = 0;});
397
+ var expanding = {};
398
+ function copyValue(val) {
399
+ var copy = [];
400
+ for (var i = 0; i < val.length; i++) {
401
+ var p = val[i];
402
+ if (typeof p == "object") {
403
+ if (expanding[p.tabstopId])
404
+ continue;
405
+ var j = val.lastIndexOf(p, i - 1);
406
+ p = copy[j] || {tabstopId: p.tabstopId};
407
+ }
408
+ copy[i] = p;
409
+ }
410
+ return copy;
411
+ }
412
+ for (var i = 0; i < tokens.length; i++) {
413
+ var p = tokens[i];
414
+ if (typeof p != "object")
415
+ continue;
416
+ var id = p.tabstopId;
417
+ var ts = tabstops[id];
418
+ var i1 = tokens.indexOf(p, i + 1);
419
+ if (expanding[id]) {
420
+ if (expanding[id] === p) {
421
+ delete expanding[id];
422
+ Object.keys(expanding).forEach(function(parentId) {
423
+ ts.parents[parentId] = true;
424
+ });
425
+ }
426
+ continue;
427
+ }
428
+ expanding[id] = p;
429
+ var value = ts.value;
430
+ if (typeof value !== "string")
431
+ value = copyValue(value);
432
+ else if (p.fmt)
433
+ value = this.tmStrFormat(value, p, editor);
434
+ tokens.splice.apply(tokens, [i + 1, Math.max(0, i1 - i)].concat(value, p));
435
+
436
+ if (ts.indexOf(p) === -1)
437
+ ts.push(p);
438
+ }
439
+ var row = 0, column = 0;
440
+ var text = "";
441
+ tokens.forEach(function(t) {
442
+ if (typeof t === "string") {
443
+ var lines = t.split("\n");
444
+ if (lines.length > 1){
445
+ column = lines[lines.length - 1].length;
446
+ row += lines.length - 1;
447
+ } else
448
+ column += t.length;
449
+ text += t;
450
+ } else if (t) {
451
+ if (!t.start)
452
+ t.start = {row: row, column: column};
453
+ else
454
+ t.end = {row: row, column: column};
455
+ }
456
+ });
457
+ var range = editor.getSelectionRange();
458
+ var end = editor.session.replace(range, text);
459
+
460
+ var tabstopManager = new TabstopManager(editor);
461
+ var selectionId = editor.inVirtualSelectionMode && editor.selection.index;
462
+ tabstopManager.addTabstops(tabstops, range.start, end, selectionId);
463
+ };
464
+
465
+ this.insertSnippet = function(editor, snippetText) {
466
+ var self = this;
467
+ if (editor.inVirtualSelectionMode)
468
+ return self.insertSnippetForSelection(editor, snippetText);
469
+
470
+ editor.forEachSelection(function() {
471
+ self.insertSnippetForSelection(editor, snippetText);
472
+ }, null, {keepOrder: true});
473
+
474
+ if (editor.tabstopManager)
475
+ editor.tabstopManager.tabNext();
476
+ };
477
+
478
+ this.$getScope = function(editor) {
479
+ var scope = editor.session.$mode.$id || "";
480
+ scope = scope.split("/").pop();
481
+ if (scope === "html" || scope === "php") {
482
+ if (scope === "php" && !editor.session.$mode.inlinePhp)
483
+ scope = "html";
484
+ var c = editor.getCursorPosition();
485
+ var state = editor.session.getState(c.row);
486
+ if (typeof state === "object") {
487
+ state = state[0];
488
+ }
489
+ if (state.substring) {
490
+ if (state.substring(0, 3) == "js-")
491
+ scope = "javascript";
492
+ else if (state.substring(0, 4) == "css-")
493
+ scope = "css";
494
+ else if (state.substring(0, 4) == "php-")
495
+ scope = "php";
496
+ }
497
+ }
498
+
499
+ return scope;
500
+ };
501
+
502
+ this.getActiveScopes = function(editor) {
503
+ var scope = this.$getScope(editor);
504
+ var scopes = [scope];
505
+ var snippetMap = this.snippetMap;
506
+ if (snippetMap[scope] && snippetMap[scope].includeScopes) {
507
+ scopes.push.apply(scopes, snippetMap[scope].includeScopes);
508
+ }
509
+ scopes.push("_");
510
+ return scopes;
511
+ };
512
+
513
+ this.expandWithTab = function(editor, options) {
514
+ var self = this;
515
+ var result = editor.forEachSelection(function() {
516
+ return self.expandSnippetForSelection(editor, options);
517
+ }, null, {keepOrder: true});
518
+ if (result && editor.tabstopManager)
519
+ editor.tabstopManager.tabNext();
520
+ return result;
521
+ };
522
+
523
+ this.expandSnippetForSelection = function(editor, options) {
524
+ var cursor = editor.getCursorPosition();
525
+ var line = editor.session.getLine(cursor.row);
526
+ var before = line.substring(0, cursor.column);
527
+ var after = line.substr(cursor.column);
528
+
529
+ var snippetMap = this.snippetMap;
530
+ var snippet;
531
+ this.getActiveScopes(editor).some(function(scope) {
532
+ var snippets = snippetMap[scope];
533
+ if (snippets)
534
+ snippet = this.findMatchingSnippet(snippets, before, after);
535
+ return !!snippet;
536
+ }, this);
537
+ if (!snippet)
538
+ return false;
539
+ if (options && options.dryRun)
540
+ return true;
541
+ editor.session.doc.removeInLine(cursor.row,
542
+ cursor.column - snippet.replaceBefore.length,
543
+ cursor.column + snippet.replaceAfter.length
544
+ );
545
+
546
+ this.variables.M__ = snippet.matchBefore;
547
+ this.variables.T__ = snippet.matchAfter;
548
+ this.insertSnippetForSelection(editor, snippet.content);
549
+
550
+ this.variables.M__ = this.variables.T__ = null;
551
+ return true;
552
+ };
553
+
554
+ this.findMatchingSnippet = function(snippetList, before, after) {
555
+ for (var i = snippetList.length; i--;) {
556
+ var s = snippetList[i];
557
+ if (s.startRe && !s.startRe.test(before))
558
+ continue;
559
+ if (s.endRe && !s.endRe.test(after))
560
+ continue;
561
+ if (!s.startRe && !s.endRe)
562
+ continue;
563
+
564
+ s.matchBefore = s.startRe ? s.startRe.exec(before) : [""];
565
+ s.matchAfter = s.endRe ? s.endRe.exec(after) : [""];
566
+ s.replaceBefore = s.triggerRe ? s.triggerRe.exec(before)[0] : "";
567
+ s.replaceAfter = s.endTriggerRe ? s.endTriggerRe.exec(after)[0] : "";
568
+ return s;
569
+ }
570
+ };
571
+
572
+ this.snippetMap = {};
573
+ this.snippetNameMap = {};
574
+ this.register = function(snippets, scope) {
575
+ var snippetMap = this.snippetMap;
576
+ var snippetNameMap = this.snippetNameMap;
577
+ var self = this;
578
+
579
+ if (!snippets)
580
+ snippets = [];
581
+
582
+ function wrapRegexp(src) {
583
+ if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
584
+ src = "(?:" + src + ")";
585
+
586
+ return src || "";
587
+ }
588
+ function guardedRegexp(re, guard, opening) {
589
+ re = wrapRegexp(re);
590
+ guard = wrapRegexp(guard);
591
+ if (opening) {
592
+ re = guard + re;
593
+ if (re && re[re.length - 1] != "$")
594
+ re = re + "$";
595
+ } else {
596
+ re = re + guard;
597
+ if (re && re[0] != "^")
598
+ re = "^" + re;
599
+ }
600
+ return new RegExp(re);
601
+ }
602
+
603
+ function addSnippet(s) {
604
+ if (!s.scope)
605
+ s.scope = scope || "_";
606
+ scope = s.scope;
607
+ if (!snippetMap[scope]) {
608
+ snippetMap[scope] = [];
609
+ snippetNameMap[scope] = {};
610
+ }
611
+
612
+ var map = snippetNameMap[scope];
613
+ if (s.name) {
614
+ var old = map[s.name];
615
+ if (old)
616
+ self.unregister(old);
617
+ map[s.name] = s;
618
+ }
619
+ snippetMap[scope].push(s);
620
+
621
+ if (s.prefix)
622
+ s.tabTrigger = s.prefix;
623
+
624
+ if (!s.content && s.body)
625
+ s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body;
626
+
627
+ if (s.tabTrigger && !s.trigger) {
628
+ if (!s.guard && /^\w/.test(s.tabTrigger))
629
+ s.guard = "\\b";
630
+ s.trigger = lang.escapeRegExp(s.tabTrigger);
631
+ }
632
+
633
+ if (!s.trigger && !s.guard && !s.endTrigger && !s.endGuard)
634
+ return;
635
+
636
+ s.startRe = guardedRegexp(s.trigger, s.guard, true);
637
+ s.triggerRe = new RegExp(s.trigger);
638
+
639
+ s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
640
+ s.endTriggerRe = new RegExp(s.endTrigger);
641
+ }
642
+
643
+ if (Array.isArray(snippets)) {
644
+ snippets.forEach(addSnippet);
645
+ } else {
646
+ Object.keys(snippets).forEach(function(key) {
647
+ addSnippet(snippets[key]);
648
+ });
649
+ }
650
+
651
+ this._signal("registerSnippets", {scope: scope});
652
+ };
653
+ this.unregister = function(snippets, scope) {
654
+ var snippetMap = this.snippetMap;
655
+ var snippetNameMap = this.snippetNameMap;
656
+
657
+ function removeSnippet(s) {
658
+ var nameMap = snippetNameMap[s.scope||scope];
659
+ if (nameMap && nameMap[s.name]) {
660
+ delete nameMap[s.name];
661
+ var map = snippetMap[s.scope||scope];
662
+ var i = map && map.indexOf(s);
663
+ if (i >= 0)
664
+ map.splice(i, 1);
665
+ }
666
+ }
667
+ if (snippets.content)
668
+ removeSnippet(snippets);
669
+ else if (Array.isArray(snippets))
670
+ snippets.forEach(removeSnippet);
671
+ };
672
+ this.parseSnippetFile = function(str) {
673
+ str = str.replace(/\r/g, "");
674
+ var list = [], snippet = {};
675
+ var re = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;
676
+ var m;
677
+ while (m = re.exec(str)) {
678
+ if (m[1]) {
679
+ try {
680
+ snippet = JSON.parse(m[1]);
681
+ list.push(snippet);
682
+ } catch (e) {}
683
+ } if (m[4]) {
684
+ snippet.content = m[4].replace(/^\t/gm, "");
685
+ list.push(snippet);
686
+ snippet = {};
687
+ } else {
688
+ var key = m[2], val = m[3];
689
+ if (key == "regex") {
690
+ var guardRe = /\/((?:[^\/\\]|\\.)*)|$/g;
691
+ snippet.guard = guardRe.exec(val)[1];
692
+ snippet.trigger = guardRe.exec(val)[1];
693
+ snippet.endTrigger = guardRe.exec(val)[1];
694
+ snippet.endGuard = guardRe.exec(val)[1];
695
+ } else if (key == "snippet") {
696
+ snippet.tabTrigger = val.match(/^\S*/)[0];
697
+ if (!snippet.name)
698
+ snippet.name = val;
699
+ } else if (key) {
700
+ snippet[key] = val;
701
+ }
702
+ }
703
+ }
704
+ return list;
705
+ };
706
+ this.getSnippetByName = function(name, editor) {
707
+ var snippetMap = this.snippetNameMap;
708
+ var snippet;
709
+ this.getActiveScopes(editor).some(function(scope) {
710
+ var snippets = snippetMap[scope];
711
+ if (snippets)
712
+ snippet = snippets[name];
713
+ return !!snippet;
714
+ }, this);
715
+ return snippet;
716
+ };
717
+
718
+ }).call(SnippetManager.prototype);
719
+
720
+
721
+ var TabstopManager = function(editor) {
722
+ if (editor.tabstopManager)
723
+ return editor.tabstopManager;
724
+ editor.tabstopManager = this;
725
+ this.$onChange = this.onChange.bind(this);
726
+ this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule;
727
+ this.$onChangeSession = this.onChangeSession.bind(this);
728
+ this.$onAfterExec = this.onAfterExec.bind(this);
729
+ this.attach(editor);
730
+ };
731
+ (function() {
732
+ this.attach = function(editor) {
733
+ this.index = 0;
734
+ this.ranges = [];
735
+ this.tabstops = [];
736
+ this.$openTabstops = null;
737
+ this.selectedTabstop = null;
738
+
739
+ this.editor = editor;
740
+ this.editor.on("change", this.$onChange);
741
+ this.editor.on("changeSelection", this.$onChangeSelection);
742
+ this.editor.on("changeSession", this.$onChangeSession);
743
+ this.editor.commands.on("afterExec", this.$onAfterExec);
744
+ this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
745
+ };
746
+ this.detach = function() {
747
+ this.tabstops.forEach(this.removeTabstopMarkers, this);
748
+ this.ranges = null;
749
+ this.tabstops = null;
750
+ this.selectedTabstop = null;
751
+ this.editor.removeListener("change", this.$onChange);
752
+ this.editor.removeListener("changeSelection", this.$onChangeSelection);
753
+ this.editor.removeListener("changeSession", this.$onChangeSession);
754
+ this.editor.commands.removeListener("afterExec", this.$onAfterExec);
755
+ this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
756
+ this.editor.tabstopManager = null;
757
+ this.editor = null;
758
+ };
759
+
760
+ this.onChange = function(delta) {
761
+ var isRemove = delta.action[0] == "r";
762
+ var selectedTabstop = this.selectedTabstop || {};
763
+ var parents = selectedTabstop.parents || {};
764
+ var tabstops = (this.tabstops || []).slice();
765
+ for (var i = 0; i < tabstops.length; i++) {
766
+ var ts = tabstops[i];
767
+ var active = ts == selectedTabstop || parents[ts.index];
768
+ ts.rangeList.$bias = active ? 0 : 1;
769
+
770
+ if (delta.action == "remove" && ts !== selectedTabstop) {
771
+ var parentActive = ts.parents && ts.parents[selectedTabstop.index];
772
+ var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
773
+ startIndex = startIndex < 0 ? -startIndex - 1 : startIndex + 1;
774
+ var endIndex = ts.rangeList.pointIndex(delta.end, parentActive);
775
+ endIndex = endIndex < 0 ? -endIndex - 1 : endIndex - 1;
776
+ var toRemove = ts.rangeList.ranges.slice(startIndex, endIndex);
777
+ for (var j = 0; j < toRemove.length; j++)
778
+ this.removeRange(toRemove[j]);
779
+ }
780
+ ts.rangeList.$onChange(delta);
781
+ }
782
+ var session = this.editor.session;
783
+ if (!this.$inChange && isRemove && session.getLength() == 1 && !session.getValue())
784
+ this.detach();
785
+ };
786
+ this.updateLinkedFields = function() {
787
+ var ts = this.selectedTabstop;
788
+ if (!ts || !ts.hasLinkedRanges || !ts.firstNonLinked)
789
+ return;
790
+ this.$inChange = true;
791
+ var session = this.editor.session;
792
+ var text = session.getTextRange(ts.firstNonLinked);
793
+ for (var i = 0; i < ts.length; i++) {
794
+ var range = ts[i];
795
+ if (!range.linked)
796
+ continue;
797
+ var original = range.original;
798
+ var fmt = exports.snippetManager.tmStrFormat(text, original, this.editor);
799
+ session.replace(range, fmt);
800
+ }
801
+ this.$inChange = false;
802
+ };
803
+ this.onAfterExec = function(e) {
804
+ if (e.command && !e.command.readOnly)
805
+ this.updateLinkedFields();
806
+ };
807
+ this.onChangeSelection = function() {
808
+ if (!this.editor)
809
+ return;
810
+ var lead = this.editor.selection.lead;
811
+ var anchor = this.editor.selection.anchor;
812
+ var isEmpty = this.editor.selection.isEmpty();
813
+ for (var i = 0; i < this.ranges.length; i++) {
814
+ if (this.ranges[i].linked)
815
+ continue;
816
+ var containsLead = this.ranges[i].contains(lead.row, lead.column);
817
+ var containsAnchor = isEmpty || this.ranges[i].contains(anchor.row, anchor.column);
818
+ if (containsLead && containsAnchor)
819
+ return;
820
+ }
821
+ this.detach();
822
+ };
823
+ this.onChangeSession = function() {
824
+ this.detach();
825
+ };
826
+ this.tabNext = function(dir) {
827
+ var max = this.tabstops.length;
828
+ var index = this.index + (dir || 1);
829
+ index = Math.min(Math.max(index, 1), max);
830
+ if (index == max)
831
+ index = 0;
832
+ this.selectTabstop(index);
833
+ if (index === 0)
834
+ this.detach();
835
+ };
836
+ this.selectTabstop = function(index) {
837
+ this.$openTabstops = null;
838
+ var ts = this.tabstops[this.index];
839
+ if (ts)
840
+ this.addTabstopMarkers(ts);
841
+ this.index = index;
842
+ ts = this.tabstops[this.index];
843
+ if (!ts || !ts.length)
844
+ return;
845
+
846
+ this.selectedTabstop = ts;
847
+ var range = ts.firstNonLinked || ts;
848
+ if (ts.choices) range.cursor = range.start;
849
+ if (!this.editor.inVirtualSelectionMode) {
850
+ var sel = this.editor.multiSelect;
851
+ sel.toSingleRange(range);
852
+ for (var i = 0; i < ts.length; i++) {
853
+ if (ts.hasLinkedRanges && ts[i].linked)
854
+ continue;
855
+ sel.addRange(ts[i].clone(), true);
856
+ }
857
+ } else {
858
+ this.editor.selection.fromOrientedRange(range);
859
+ }
860
+
861
+ this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
862
+ if (this.selectedTabstop && this.selectedTabstop.choices)
863
+ this.editor.execCommand("startAutocomplete", {matches: this.selectedTabstop.choices});
864
+ };
865
+ this.addTabstops = function(tabstops, start, end) {
866
+ var useLink = this.useLink || !this.editor.getOption("enableMultiselect");
867
+
868
+ if (!this.$openTabstops)
869
+ this.$openTabstops = [];
870
+ if (!tabstops[0]) {
871
+ var p = Range.fromPoints(end, end);
872
+ moveRelative(p.start, start);
873
+ moveRelative(p.end, start);
874
+ tabstops[0] = [p];
875
+ tabstops[0].index = 0;
876
+ }
877
+
878
+ var i = this.index;
879
+ var arg = [i + 1, 0];
880
+ var ranges = this.ranges;
881
+ tabstops.forEach(function(ts, index) {
882
+ var dest = this.$openTabstops[index] || ts;
883
+
884
+ for (var i = 0; i < ts.length; i++) {
885
+ var p = ts[i];
886
+ var range = Range.fromPoints(p.start, p.end || p.start);
887
+ movePoint(range.start, start);
888
+ movePoint(range.end, start);
889
+ range.original = p;
890
+ range.tabstop = dest;
891
+ ranges.push(range);
892
+ if (dest != ts)
893
+ dest.unshift(range);
894
+ else
895
+ dest[i] = range;
896
+ if (p.fmtString || (dest.firstNonLinked && useLink)) {
897
+ range.linked = true;
898
+ dest.hasLinkedRanges = true;
899
+ } else if (!dest.firstNonLinked)
900
+ dest.firstNonLinked = range;
901
+ }
902
+ if (!dest.firstNonLinked)
903
+ dest.hasLinkedRanges = false;
904
+ if (dest === ts) {
905
+ arg.push(dest);
906
+ this.$openTabstops[index] = dest;
907
+ }
908
+ this.addTabstopMarkers(dest);
909
+ dest.rangeList = dest.rangeList || new RangeList();
910
+ dest.rangeList.$bias = 0;
911
+ dest.rangeList.addList(dest);
912
+ }, this);
913
+
914
+ if (arg.length > 2) {
915
+ if (this.tabstops.length)
916
+ arg.push(arg.splice(2, 1)[0]);
917
+ this.tabstops.splice.apply(this.tabstops, arg);
918
+ }
919
+ };
920
+
921
+ this.addTabstopMarkers = function(ts) {
922
+ var session = this.editor.session;
923
+ ts.forEach(function(range) {
924
+ if (!range.markerId)
925
+ range.markerId = session.addMarker(range, "ace_snippet-marker", "text");
926
+ });
927
+ };
928
+ this.removeTabstopMarkers = function(ts) {
929
+ var session = this.editor.session;
930
+ ts.forEach(function(range) {
931
+ session.removeMarker(range.markerId);
932
+ range.markerId = null;
933
+ });
934
+ };
935
+ this.removeRange = function(range) {
936
+ var i = range.tabstop.indexOf(range);
937
+ if (i != -1) range.tabstop.splice(i, 1);
938
+ i = this.ranges.indexOf(range);
939
+ if (i != -1) this.ranges.splice(i, 1);
940
+ i = range.tabstop.rangeList.ranges.indexOf(range);
941
+ if (i != -1) range.tabstop.splice(i, 1);
942
+ this.editor.session.removeMarker(range.markerId);
943
+ if (!range.tabstop.length) {
944
+ i = this.tabstops.indexOf(range.tabstop);
945
+ if (i != -1)
946
+ this.tabstops.splice(i, 1);
947
+ if (!this.tabstops.length)
948
+ this.detach();
949
+ }
950
+ };
951
+
952
+ this.keyboardHandler = new HashHandler();
953
+ this.keyboardHandler.bindKeys({
954
+ "Tab": function(editor) {
955
+ if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
956
+ return;
957
+ editor.tabstopManager.tabNext(1);
958
+ editor.renderer.scrollCursorIntoView();
959
+ },
960
+ "Shift-Tab": function(editor) {
961
+ editor.tabstopManager.tabNext(-1);
962
+ editor.renderer.scrollCursorIntoView();
963
+ },
964
+ "Esc": function(editor) {
965
+ editor.tabstopManager.detach();
966
+ }
967
+ });
968
+ }).call(TabstopManager.prototype);
969
+
970
+
971
+
972
+ var movePoint = function(point, diff) {
973
+ if (point.row == 0)
974
+ point.column += diff.column;
975
+ point.row += diff.row;
976
+ };
977
+
978
+ var moveRelative = function(point, start) {
979
+ if (point.row == start.row)
980
+ point.column -= start.column;
981
+ point.row -= start.row;
982
+ };
983
+
984
+
985
+ dom.importCssString("\
986
+ .ace_snippet-marker {\
987
+ -moz-box-sizing: border-box;\
988
+ box-sizing: border-box;\
989
+ background: rgba(194, 193, 208, 0.09);\
990
+ border: 1px dotted rgba(211, 208, 235, 0.62);\
991
+ position: absolute;\
992
+ }", "snippets.css", false);
993
+
994
+ exports.snippetManager = new SnippetManager();
995
+
996
+
997
+ var Editor = require("./editor").Editor;
998
+ (function() {
999
+ this.insertSnippet = function(content, options) {
1000
+ return exports.snippetManager.insertSnippet(this, content, options);
1001
+ };
1002
+ this.expandSnippet = function(options) {
1003
+ return exports.snippetManager.expandWithTab(this, options);
1004
+ };
1005
+ }).call(Editor.prototype);
1006
+
1007
+ });
1008
+
1009
+ ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom"], function(require, exports, module) {
1010
+ "use strict";
1011
+
1012
+ var Renderer = require("../virtual_renderer").VirtualRenderer;
1013
+ var Editor = require("../editor").Editor;
1014
+ var Range = require("../range").Range;
1015
+ var event = require("../lib/event");
1016
+ var lang = require("../lib/lang");
1017
+ var dom = require("../lib/dom");
1018
+
1019
+ var $singleLineEditor = function(el) {
1020
+ var renderer = new Renderer(el);
1021
+
1022
+ renderer.$maxLines = 4;
1023
+
1024
+ var editor = new Editor(renderer);
1025
+
1026
+ editor.setHighlightActiveLine(false);
1027
+ editor.setShowPrintMargin(false);
1028
+ editor.renderer.setShowGutter(false);
1029
+ editor.renderer.setHighlightGutterLine(false);
1030
+
1031
+ editor.$mouseHandler.$focusTimeout = 0;
1032
+ editor.$highlightTagPending = true;
1033
+
1034
+ return editor;
1035
+ };
1036
+
1037
+ var AcePopup = function(parentNode) {
1038
+ var el = dom.createElement("div");
1039
+ var popup = new $singleLineEditor(el);
1040
+
1041
+ if (parentNode)
1042
+ parentNode.appendChild(el);
1043
+ el.style.display = "none";
1044
+ popup.renderer.content.style.cursor = "default";
1045
+ popup.renderer.setStyle("ace_autocomplete");
1046
+
1047
+ popup.setOption("displayIndentGuides", false);
1048
+ popup.setOption("dragDelay", 150);
1049
+
1050
+ var noop = function(){};
1051
+
1052
+ popup.focus = noop;
1053
+ popup.$isFocused = true;
1054
+
1055
+ popup.renderer.$cursorLayer.restartTimer = noop;
1056
+ popup.renderer.$cursorLayer.element.style.opacity = 0;
1057
+
1058
+ popup.renderer.$maxLines = 8;
1059
+ popup.renderer.$keepTextAreaAtCursor = false;
1060
+
1061
+ popup.setHighlightActiveLine(false);
1062
+ popup.session.highlight("");
1063
+ popup.session.$searchHighlight.clazz = "ace_highlight-marker";
1064
+
1065
+ popup.on("mousedown", function(e) {
1066
+ var pos = e.getDocumentPosition();
1067
+ popup.selection.moveToPosition(pos);
1068
+ selectionMarker.start.row = selectionMarker.end.row = pos.row;
1069
+ e.stop();
1070
+ });
1071
+
1072
+ var lastMouseEvent;
1073
+ var hoverMarker = new Range(-1,0,-1,Infinity);
1074
+ var selectionMarker = new Range(-1,0,-1,Infinity);
1075
+ selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
1076
+ popup.setSelectOnHover = function(val) {
1077
+ if (!val) {
1078
+ hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
1079
+ } else if (hoverMarker.id) {
1080
+ popup.session.removeMarker(hoverMarker.id);
1081
+ hoverMarker.id = null;
1082
+ }
1083
+ };
1084
+ popup.setSelectOnHover(false);
1085
+ popup.on("mousemove", function(e) {
1086
+ if (!lastMouseEvent) {
1087
+ lastMouseEvent = e;
1088
+ return;
1089
+ }
1090
+ if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {
1091
+ return;
1092
+ }
1093
+ lastMouseEvent = e;
1094
+ lastMouseEvent.scrollTop = popup.renderer.scrollTop;
1095
+ var row = lastMouseEvent.getDocumentPosition().row;
1096
+ if (hoverMarker.start.row != row) {
1097
+ if (!hoverMarker.id)
1098
+ popup.setRow(row);
1099
+ setHoverMarker(row);
1100
+ }
1101
+ });
1102
+ popup.renderer.on("beforeRender", function() {
1103
+ if (lastMouseEvent && hoverMarker.start.row != -1) {
1104
+ lastMouseEvent.$pos = null;
1105
+ var row = lastMouseEvent.getDocumentPosition().row;
1106
+ if (!hoverMarker.id)
1107
+ popup.setRow(row);
1108
+ setHoverMarker(row, true);
1109
+ }
1110
+ });
1111
+ popup.renderer.on("afterRender", function() {
1112
+ var row = popup.getRow();
1113
+ var t = popup.renderer.$textLayer;
1114
+ var selected = t.element.childNodes[row - t.config.firstRow];
1115
+ if (selected !== t.selectedNode && t.selectedNode)
1116
+ dom.removeCssClass(t.selectedNode, "ace_selected");
1117
+ t.selectedNode = selected;
1118
+ if (selected)
1119
+ dom.addCssClass(selected, "ace_selected");
1120
+ });
1121
+ var hideHoverMarker = function() { setHoverMarker(-1); };
1122
+ var setHoverMarker = function(row, suppressRedraw) {
1123
+ if (row !== hoverMarker.start.row) {
1124
+ hoverMarker.start.row = hoverMarker.end.row = row;
1125
+ if (!suppressRedraw)
1126
+ popup.session._emit("changeBackMarker");
1127
+ popup._emit("changeHoverMarker");
1128
+ }
1129
+ };
1130
+ popup.getHoveredRow = function() {
1131
+ return hoverMarker.start.row;
1132
+ };
1133
+
1134
+ event.addListener(popup.container, "mouseout", hideHoverMarker);
1135
+ popup.on("hide", hideHoverMarker);
1136
+ popup.on("changeSelection", hideHoverMarker);
1137
+
1138
+ popup.session.doc.getLength = function() {
1139
+ return popup.data.length;
1140
+ };
1141
+ popup.session.doc.getLine = function(i) {
1142
+ var data = popup.data[i];
1143
+ if (typeof data == "string")
1144
+ return data;
1145
+ return (data && data.value) || "";
1146
+ };
1147
+
1148
+ var bgTokenizer = popup.session.bgTokenizer;
1149
+ bgTokenizer.$tokenizeRow = function(row) {
1150
+ var data = popup.data[row];
1151
+ var tokens = [];
1152
+ if (!data)
1153
+ return tokens;
1154
+ if (typeof data == "string")
1155
+ data = {value: data};
1156
+ var caption = data.caption || data.value || data.name;
1157
+
1158
+ function addToken(value, className) {
1159
+ value && tokens.push({
1160
+ type: (data.className || "") + (className || ""),
1161
+ value: value
1162
+ });
1163
+ }
1164
+
1165
+ var lower = caption.toLowerCase();
1166
+ var filterText = (popup.filterText || "").toLowerCase();
1167
+ var lastIndex = 0;
1168
+ var lastI = 0;
1169
+ for (var i = 0; i <= filterText.length; i++) {
1170
+ if (i != lastI && (data.matchMask & (1 << i) || i == filterText.length)) {
1171
+ var sub = filterText.slice(lastI, i);
1172
+ lastI = i;
1173
+ var index = lower.indexOf(sub, lastIndex);
1174
+ if (index == -1) continue;
1175
+ addToken(caption.slice(lastIndex, index), "");
1176
+ lastIndex = index + sub.length;
1177
+ addToken(caption.slice(index, lastIndex), "completion-highlight");
1178
+ }
1179
+ }
1180
+ addToken(caption.slice(lastIndex, caption.length), "");
1181
+
1182
+ if (data.meta)
1183
+ tokens.push({type: "completion-meta", value: data.meta});
1184
+ if (data.message)
1185
+ tokens.push({type: "completion-message", value: data.message});
1186
+
1187
+ return tokens;
1188
+ };
1189
+ bgTokenizer.$updateOnChange = noop;
1190
+ bgTokenizer.start = noop;
1191
+
1192
+ popup.session.$computeWidth = function() {
1193
+ return this.screenWidth = 0;
1194
+ };
1195
+ popup.isOpen = false;
1196
+ popup.isTopdown = false;
1197
+ popup.autoSelect = true;
1198
+ popup.filterText = "";
1199
+
1200
+ popup.data = [];
1201
+ popup.setData = function(list, filterText) {
1202
+ popup.filterText = filterText || "";
1203
+ popup.setValue(lang.stringRepeat("\n", list.length), -1);
1204
+ popup.data = list || [];
1205
+ popup.setRow(0);
1206
+ };
1207
+ popup.getData = function(row) {
1208
+ return popup.data[row];
1209
+ };
1210
+
1211
+ popup.getRow = function() {
1212
+ return selectionMarker.start.row;
1213
+ };
1214
+ popup.setRow = function(line) {
1215
+ line = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length, line));
1216
+ if (selectionMarker.start.row != line) {
1217
+ popup.selection.clearSelection();
1218
+ selectionMarker.start.row = selectionMarker.end.row = line || 0;
1219
+ popup.session._emit("changeBackMarker");
1220
+ popup.moveCursorTo(line || 0, 0);
1221
+ if (popup.isOpen)
1222
+ popup._signal("select");
1223
+ }
1224
+ };
1225
+
1226
+ popup.on("changeSelection", function() {
1227
+ if (popup.isOpen)
1228
+ popup.setRow(popup.selection.lead.row);
1229
+ popup.renderer.scrollCursorIntoView();
1230
+ });
1231
+
1232
+ popup.hide = function() {
1233
+ this.container.style.display = "none";
1234
+ this._signal("hide");
1235
+ popup.isOpen = false;
1236
+ };
1237
+ popup.show = function(pos, lineHeight, topdownOnly) {
1238
+ var el = this.container;
1239
+ var screenHeight = window.innerHeight;
1240
+ var screenWidth = window.innerWidth;
1241
+ var renderer = this.renderer;
1242
+ var maxH = renderer.$maxLines * lineHeight * 1.4;
1243
+ var top = pos.top + this.$borderSize;
1244
+ var allowTopdown = top > screenHeight / 2 && !topdownOnly;
1245
+ if (allowTopdown && top + lineHeight + maxH > screenHeight) {
1246
+ renderer.$maxPixelHeight = top - 2 * this.$borderSize;
1247
+ el.style.top = "";
1248
+ el.style.bottom = screenHeight - top + "px";
1249
+ popup.isTopdown = false;
1250
+ } else {
1251
+ top += lineHeight;
1252
+ renderer.$maxPixelHeight = screenHeight - top - 0.2 * lineHeight;
1253
+ el.style.top = top + "px";
1254
+ el.style.bottom = "";
1255
+ popup.isTopdown = true;
1256
+ }
1257
+
1258
+ el.style.display = "";
1259
+
1260
+ var left = pos.left;
1261
+ if (left + el.offsetWidth > screenWidth)
1262
+ left = screenWidth - el.offsetWidth;
1263
+
1264
+ el.style.left = left + "px";
1265
+
1266
+ this._signal("show");
1267
+ lastMouseEvent = null;
1268
+ popup.isOpen = true;
1269
+ };
1270
+
1271
+ popup.goTo = function(where) {
1272
+ var row = this.getRow();
1273
+ var max = this.session.getLength() - 1;
1274
+
1275
+ switch(where) {
1276
+ case "up": row = row <= 0 ? max : row - 1; break;
1277
+ case "down": row = row >= max ? -1 : row + 1; break;
1278
+ case "start": row = 0; break;
1279
+ case "end": row = max; break;
1280
+ }
1281
+
1282
+ this.setRow(row);
1283
+ };
1284
+
1285
+
1286
+ popup.getTextLeftOffset = function() {
1287
+ return this.$borderSize + this.renderer.$padding + this.$imageSize;
1288
+ };
1289
+
1290
+ popup.$imageSize = 0;
1291
+ popup.$borderSize = 1;
1292
+
1293
+ return popup;
1294
+ };
1295
+
1296
+ dom.importCssString("\
1297
+ .ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\
1298
+ background-color: #CAD6FA;\
1299
+ z-index: 1;\
1300
+ }\
1301
+ .ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\
1302
+ background-color: #3a674e;\
1303
+ }\
1304
+ .ace_editor.ace_autocomplete .ace_line-hover {\
1305
+ border: 1px solid #abbffe;\
1306
+ margin-top: -1px;\
1307
+ background: rgba(233,233,253,0.4);\
1308
+ position: absolute;\
1309
+ z-index: 2;\
1310
+ }\
1311
+ .ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\
1312
+ border: 1px solid rgba(109, 150, 13, 0.8);\
1313
+ background: rgba(58, 103, 78, 0.62);\
1314
+ }\
1315
+ .ace_completion-meta {\
1316
+ opacity: 0.5;\
1317
+ margin: 0.9em;\
1318
+ }\
1319
+ .ace_completion-message {\
1320
+ color: blue;\
1321
+ }\
1322
+ .ace_editor.ace_autocomplete .ace_completion-highlight{\
1323
+ color: #2d69c7;\
1324
+ }\
1325
+ .ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\
1326
+ color: #93ca12;\
1327
+ }\
1328
+ .ace_editor.ace_autocomplete {\
1329
+ width: 300px;\
1330
+ z-index: 200000;\
1331
+ border: 1px lightgray solid;\
1332
+ position: fixed;\
1333
+ box-shadow: 2px 3px 5px rgba(0,0,0,.2);\
1334
+ line-height: 1.4;\
1335
+ background: #fefefe;\
1336
+ color: #111;\
1337
+ }\
1338
+ .ace_dark.ace_editor.ace_autocomplete {\
1339
+ border: 1px #484747 solid;\
1340
+ box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\
1341
+ line-height: 1.4;\
1342
+ background: #25282c;\
1343
+ color: #c1c1c1;\
1344
+ }", "autocompletion.css", false);
1345
+
1346
+ exports.AcePopup = AcePopup;
1347
+ exports.$singleLineEditor = $singleLineEditor;
1348
+ });
1349
+
1350
+ ace.define("ace/autocomplete/util",["require","exports","module"], function(require, exports, module) {
1351
+ "use strict";
1352
+
1353
+ exports.parForEach = function(array, fn, callback) {
1354
+ var completed = 0;
1355
+ var arLength = array.length;
1356
+ if (arLength === 0)
1357
+ callback();
1358
+ for (var i = 0; i < arLength; i++) {
1359
+ fn(array[i], function(result, err) {
1360
+ completed++;
1361
+ if (completed === arLength)
1362
+ callback(result, err);
1363
+ });
1364
+ }
1365
+ };
1366
+
1367
+ var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;
1368
+
1369
+ exports.retrievePrecedingIdentifier = function(text, pos, regex) {
1370
+ regex = regex || ID_REGEX;
1371
+ var buf = [];
1372
+ for (var i = pos-1; i >= 0; i--) {
1373
+ if (regex.test(text[i]))
1374
+ buf.push(text[i]);
1375
+ else
1376
+ break;
1377
+ }
1378
+ return buf.reverse().join("");
1379
+ };
1380
+
1381
+ exports.retrieveFollowingIdentifier = function(text, pos, regex) {
1382
+ regex = regex || ID_REGEX;
1383
+ var buf = [];
1384
+ for (var i = pos; i < text.length; i++) {
1385
+ if (regex.test(text[i]))
1386
+ buf.push(text[i]);
1387
+ else
1388
+ break;
1389
+ }
1390
+ return buf;
1391
+ };
1392
+
1393
+ exports.getCompletionPrefix = function (editor) {
1394
+ var pos = editor.getCursorPosition();
1395
+ var line = editor.session.getLine(pos.row);
1396
+ var prefix;
1397
+ editor.completers.forEach(function(completer) {
1398
+ if (completer.identifierRegexps) {
1399
+ completer.identifierRegexps.forEach(function(identifierRegex) {
1400
+ if (!prefix && identifierRegex)
1401
+ prefix = this.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
1402
+ }.bind(this));
1403
+ }
1404
+ }.bind(this));
1405
+ return prefix || this.retrievePrecedingIdentifier(line, pos.column);
1406
+ };
1407
+
1408
+ });
1409
+
1410
+ ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config"], function(require, exports, module) {
1411
+ "use strict";
1412
+
1413
+ var HashHandler = require("./keyboard/hash_handler").HashHandler;
1414
+ var AcePopup = require("./autocomplete/popup").AcePopup;
1415
+ var util = require("./autocomplete/util");
1416
+ var lang = require("./lib/lang");
1417
+ var dom = require("./lib/dom");
1418
+ var snippetManager = require("./snippets").snippetManager;
1419
+ var config = require("./config");
1420
+
1421
+ var Autocomplete = function() {
1422
+ this.autoInsert = false;
1423
+ this.autoSelect = true;
1424
+ this.exactMatch = false;
1425
+ this.gatherCompletionsId = 0;
1426
+ this.keyboardHandler = new HashHandler();
1427
+ this.keyboardHandler.bindKeys(this.commands);
1428
+
1429
+ this.blurListener = this.blurListener.bind(this);
1430
+ this.changeListener = this.changeListener.bind(this);
1431
+ this.mousedownListener = this.mousedownListener.bind(this);
1432
+ this.mousewheelListener = this.mousewheelListener.bind(this);
1433
+
1434
+ this.changeTimer = lang.delayedCall(function() {
1435
+ this.updateCompletions(true);
1436
+ }.bind(this));
1437
+
1438
+ this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
1439
+ };
1440
+
1441
+ (function() {
1442
+
1443
+ this.$init = function() {
1444
+ this.popup = new AcePopup(document.body || document.documentElement);
1445
+ this.popup.on("click", function(e) {
1446
+ this.insertMatch();
1447
+ e.stop();
1448
+ }.bind(this));
1449
+ this.popup.focus = this.editor.focus.bind(this.editor);
1450
+ this.popup.on("show", this.tooltipTimer.bind(null, null));
1451
+ this.popup.on("select", this.tooltipTimer.bind(null, null));
1452
+ this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
1453
+ return this.popup;
1454
+ };
1455
+
1456
+ this.getPopup = function() {
1457
+ return this.popup || this.$init();
1458
+ };
1459
+
1460
+ this.openPopup = function(editor, prefix, keepPopupPosition) {
1461
+ if (!this.popup)
1462
+ this.$init();
1463
+
1464
+ this.popup.autoSelect = this.autoSelect;
1465
+
1466
+ this.popup.setData(this.completions.filtered, this.completions.filterText);
1467
+
1468
+ editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
1469
+
1470
+ var renderer = editor.renderer;
1471
+ this.popup.setRow(this.autoSelect ? 0 : -1);
1472
+ if (!keepPopupPosition) {
1473
+ this.popup.setTheme(editor.getTheme());
1474
+ this.popup.setFontSize(editor.getFontSize());
1475
+
1476
+ var lineHeight = renderer.layerConfig.lineHeight;
1477
+
1478
+ var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);
1479
+ pos.left -= this.popup.getTextLeftOffset();
1480
+
1481
+ var rect = editor.container.getBoundingClientRect();
1482
+ pos.top += rect.top - renderer.layerConfig.offset;
1483
+ pos.left += rect.left - editor.renderer.scrollLeft;
1484
+ pos.left += renderer.gutterWidth;
1485
+
1486
+ this.popup.show(pos, lineHeight);
1487
+ } else if (keepPopupPosition && !prefix) {
1488
+ this.detach();
1489
+ }
1490
+ this.changeTimer.cancel();
1491
+ };
1492
+
1493
+ this.detach = function() {
1494
+ this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
1495
+ this.editor.off("changeSelection", this.changeListener);
1496
+ this.editor.off("blur", this.blurListener);
1497
+ this.editor.off("mousedown", this.mousedownListener);
1498
+ this.editor.off("mousewheel", this.mousewheelListener);
1499
+ this.changeTimer.cancel();
1500
+ this.hideDocTooltip();
1501
+
1502
+ this.gatherCompletionsId += 1;
1503
+ if (this.popup && this.popup.isOpen)
1504
+ this.popup.hide();
1505
+
1506
+ if (this.base)
1507
+ this.base.detach();
1508
+ this.activated = false;
1509
+ this.completions = this.base = null;
1510
+ };
1511
+
1512
+ this.changeListener = function(e) {
1513
+ var cursor = this.editor.selection.lead;
1514
+ if (cursor.row != this.base.row || cursor.column < this.base.column) {
1515
+ this.detach();
1516
+ }
1517
+ if (this.activated)
1518
+ this.changeTimer.schedule();
1519
+ else
1520
+ this.detach();
1521
+ };
1522
+
1523
+ this.blurListener = function(e) {
1524
+ var el = document.activeElement;
1525
+ var text = this.editor.textInput.getElement();
1526
+ var fromTooltip = e.relatedTarget && this.tooltipNode && this.tooltipNode.contains(e.relatedTarget);
1527
+ var container = this.popup && this.popup.container;
1528
+ if (el != text && el.parentNode != container && !fromTooltip
1529
+ && el != this.tooltipNode && e.relatedTarget != text
1530
+ ) {
1531
+ this.detach();
1532
+ }
1533
+ };
1534
+
1535
+ this.mousedownListener = function(e) {
1536
+ this.detach();
1537
+ };
1538
+
1539
+ this.mousewheelListener = function(e) {
1540
+ this.detach();
1541
+ };
1542
+
1543
+ this.goTo = function(where) {
1544
+ this.popup.goTo(where);
1545
+ };
1546
+
1547
+ this.insertMatch = function(data, options) {
1548
+ if (!data)
1549
+ data = this.popup.getData(this.popup.getRow());
1550
+ if (!data)
1551
+ return false;
1552
+
1553
+ var completions = this.completions;
1554
+ this.editor.startOperation({command: {name: "insertMatch"}});
1555
+ if (data.completer && data.completer.insertMatch) {
1556
+ data.completer.insertMatch(this.editor, data);
1557
+ } else {
1558
+ if (completions.filterText) {
1559
+ var ranges = this.editor.selection.getAllRanges();
1560
+ for (var i = 0, range; range = ranges[i]; i++) {
1561
+ range.start.column -= completions.filterText.length;
1562
+ this.editor.session.remove(range);
1563
+ }
1564
+ }
1565
+ if (data.snippet)
1566
+ snippetManager.insertSnippet(this.editor, data.snippet);
1567
+ else
1568
+ this.editor.execCommand("insertstring", data.value || data);
1569
+ }
1570
+ if (this.completions == completions)
1571
+ this.detach();
1572
+ this.editor.endOperation();
1573
+ };
1574
+
1575
+
1576
+ this.commands = {
1577
+ "Up": function(editor) { editor.completer.goTo("up"); },
1578
+ "Down": function(editor) { editor.completer.goTo("down"); },
1579
+ "Ctrl-Up|Ctrl-Home": function(editor) { editor.completer.goTo("start"); },
1580
+ "Ctrl-Down|Ctrl-End": function(editor) { editor.completer.goTo("end"); },
1581
+
1582
+ "Esc": function(editor) { editor.completer.detach(); },
1583
+ "Return": function(editor) { return editor.completer.insertMatch(); },
1584
+ "Shift-Return": function(editor) { editor.completer.insertMatch(null, {deleteSuffix: true}); },
1585
+ "Tab": function(editor) {
1586
+ var result = editor.completer.insertMatch();
1587
+ if (!result && !editor.tabstopManager)
1588
+ editor.completer.goTo("down");
1589
+ else
1590
+ return result;
1591
+ },
1592
+
1593
+ "PageUp": function(editor) { editor.completer.popup.gotoPageUp(); },
1594
+ "PageDown": function(editor) { editor.completer.popup.gotoPageDown(); }
1595
+ };
1596
+
1597
+ this.gatherCompletions = function(editor, callback) {
1598
+ var session = editor.getSession();
1599
+ var pos = editor.getCursorPosition();
1600
+
1601
+ var prefix = util.getCompletionPrefix(editor);
1602
+
1603
+ this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
1604
+ this.base.$insertRight = true;
1605
+
1606
+ var matches = [];
1607
+ var total = editor.completers.length;
1608
+ editor.completers.forEach(function(completer, i) {
1609
+ completer.getCompletions(editor, session, pos, prefix, function(err, results) {
1610
+ if (!err && results)
1611
+ matches = matches.concat(results);
1612
+ callback(null, {
1613
+ prefix: util.getCompletionPrefix(editor),
1614
+ matches: matches,
1615
+ finished: (--total === 0)
1616
+ });
1617
+ });
1618
+ });
1619
+ return true;
1620
+ };
1621
+
1622
+ this.showPopup = function(editor, options) {
1623
+ if (this.editor)
1624
+ this.detach();
1625
+
1626
+ this.activated = true;
1627
+
1628
+ this.editor = editor;
1629
+ if (editor.completer != this) {
1630
+ if (editor.completer)
1631
+ editor.completer.detach();
1632
+ editor.completer = this;
1633
+ }
1634
+
1635
+ editor.on("changeSelection", this.changeListener);
1636
+ editor.on("blur", this.blurListener);
1637
+ editor.on("mousedown", this.mousedownListener);
1638
+ editor.on("mousewheel", this.mousewheelListener);
1639
+
1640
+ this.updateCompletions(false, options);
1641
+ };
1642
+
1643
+ this.updateCompletions = function(keepPopupPosition, options) {
1644
+ if (keepPopupPosition && this.base && this.completions) {
1645
+ var pos = this.editor.getCursorPosition();
1646
+ var prefix = this.editor.session.getTextRange({start: this.base, end: pos});
1647
+ if (prefix == this.completions.filterText)
1648
+ return;
1649
+ this.completions.setFilter(prefix);
1650
+ if (!this.completions.filtered.length)
1651
+ return this.detach();
1652
+ if (this.completions.filtered.length == 1
1653
+ && this.completions.filtered[0].value == prefix
1654
+ && !this.completions.filtered[0].snippet)
1655
+ return this.detach();
1656
+ this.openPopup(this.editor, prefix, keepPopupPosition);
1657
+ return;
1658
+ }
1659
+
1660
+ if (options && options.matches) {
1661
+ var pos = this.editor.getSelectionRange().start;
1662
+ this.base = this.editor.session.doc.createAnchor(pos.row, pos.column);
1663
+ this.base.$insertRight = true;
1664
+ this.completions = new FilteredList(options.matches);
1665
+ return this.openPopup(this.editor, "", keepPopupPosition);
1666
+ }
1667
+ var _id = this.gatherCompletionsId;
1668
+ var detachIfFinished = function(results) {
1669
+ if (!results.finished) return;
1670
+ return this.detach();
1671
+ }.bind(this);
1672
+
1673
+ var processResults = function(results) {
1674
+ var prefix = results.prefix;
1675
+ var matches = results.matches;
1676
+
1677
+ this.completions = new FilteredList(matches);
1678
+
1679
+ if (this.exactMatch)
1680
+ this.completions.exactMatch = true;
1681
+
1682
+ this.completions.setFilter(prefix);
1683
+ var filtered = this.completions.filtered;
1684
+ if (!filtered.length)
1685
+ return detachIfFinished(results);
1686
+ if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet)
1687
+ return detachIfFinished(results);
1688
+ if (this.autoInsert && filtered.length == 1 && results.finished)
1689
+ return this.insertMatch(filtered[0]);
1690
+
1691
+ this.openPopup(this.editor, prefix, keepPopupPosition);
1692
+ }.bind(this);
1693
+
1694
+ var isImmediate = true;
1695
+ var immediateResults = null;
1696
+ this.gatherCompletions(this.editor, function(err, results) {
1697
+ var prefix = results.prefix;
1698
+ var matches = results && results.matches;
1699
+
1700
+ if (!matches || !matches.length)
1701
+ return detachIfFinished(results);
1702
+ if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId)
1703
+ return;
1704
+ if (isImmediate) {
1705
+ immediateResults = results;
1706
+ return;
1707
+ }
1708
+
1709
+ processResults(results);
1710
+ }.bind(this));
1711
+
1712
+ isImmediate = false;
1713
+ if (immediateResults) {
1714
+ var results = immediateResults;
1715
+ immediateResults = null;
1716
+ processResults(results);
1717
+ }
1718
+ };
1719
+
1720
+ this.cancelContextMenu = function() {
1721
+ this.editor.$mouseHandler.cancelContextMenu();
1722
+ };
1723
+
1724
+ this.updateDocTooltip = function() {
1725
+ var popup = this.popup;
1726
+ var all = popup.data;
1727
+ var selected = all && (all[popup.getHoveredRow()] || all[popup.getRow()]);
1728
+ var doc = null;
1729
+ if (!selected || !this.editor || !this.popup.isOpen)
1730
+ return this.hideDocTooltip();
1731
+ this.editor.completers.some(function(completer) {
1732
+ if (completer.getDocTooltip)
1733
+ doc = completer.getDocTooltip(selected);
1734
+ return doc;
1735
+ });
1736
+ if (!doc && typeof selected != "string")
1737
+ doc = selected;
1738
+
1739
+ if (typeof doc == "string")
1740
+ doc = {docText: doc};
1741
+ if (!doc || !(doc.docHTML || doc.docText))
1742
+ return this.hideDocTooltip();
1743
+ this.showDocTooltip(doc);
1744
+ };
1745
+
1746
+ this.showDocTooltip = function(item) {
1747
+ if (!this.tooltipNode) {
1748
+ this.tooltipNode = dom.createElement("div");
1749
+ this.tooltipNode.className = "ace_tooltip ace_doc-tooltip";
1750
+ this.tooltipNode.style.margin = 0;
1751
+ this.tooltipNode.style.pointerEvents = "auto";
1752
+ this.tooltipNode.tabIndex = -1;
1753
+ this.tooltipNode.onblur = this.blurListener.bind(this);
1754
+ this.tooltipNode.onclick = this.onTooltipClick.bind(this);
1755
+ }
1756
+
1757
+ var tooltipNode = this.tooltipNode;
1758
+ if (item.docHTML) {
1759
+ tooltipNode.innerHTML = item.docHTML;
1760
+ } else if (item.docText) {
1761
+ tooltipNode.textContent = item.docText;
1762
+ }
1763
+
1764
+ if (!tooltipNode.parentNode)
1765
+ document.body.appendChild(tooltipNode);
1766
+ var popup = this.popup;
1767
+ var rect = popup.container.getBoundingClientRect();
1768
+ tooltipNode.style.top = popup.container.style.top;
1769
+ tooltipNode.style.bottom = popup.container.style.bottom;
1770
+
1771
+ tooltipNode.style.display = "block";
1772
+ if (window.innerWidth - rect.right < 320) {
1773
+ if (rect.left < 320) {
1774
+ if(popup.isTopdown) {
1775
+ tooltipNode.style.top = rect.bottom + "px";
1776
+ tooltipNode.style.left = rect.left + "px";
1777
+ tooltipNode.style.right = "";
1778
+ tooltipNode.style.bottom = "";
1779
+ } else {
1780
+ tooltipNode.style.top = popup.container.offsetTop - tooltipNode.offsetHeight + "px";
1781
+ tooltipNode.style.left = rect.left + "px";
1782
+ tooltipNode.style.right = "";
1783
+ tooltipNode.style.bottom = "";
1784
+ }
1785
+ } else {
1786
+ tooltipNode.style.right = window.innerWidth - rect.left + "px";
1787
+ tooltipNode.style.left = "";
1788
+ }
1789
+ } else {
1790
+ tooltipNode.style.left = (rect.right + 1) + "px";
1791
+ tooltipNode.style.right = "";
1792
+ }
1793
+ };
1794
+
1795
+ this.hideDocTooltip = function() {
1796
+ this.tooltipTimer.cancel();
1797
+ if (!this.tooltipNode) return;
1798
+ var el = this.tooltipNode;
1799
+ if (!this.editor.isFocused() && document.activeElement == el)
1800
+ this.editor.focus();
1801
+ this.tooltipNode = null;
1802
+ if (el.parentNode)
1803
+ el.parentNode.removeChild(el);
1804
+ };
1805
+
1806
+ this.onTooltipClick = function(e) {
1807
+ var a = e.target;
1808
+ while (a && a != this.tooltipNode) {
1809
+ if (a.nodeName == "A" && a.href) {
1810
+ a.rel = "noreferrer";
1811
+ a.target = "_blank";
1812
+ break;
1813
+ }
1814
+ a = a.parentNode;
1815
+ }
1816
+ };
1817
+
1818
+ this.destroy = function() {
1819
+ this.detach();
1820
+ if (this.popup) {
1821
+ this.popup.destroy();
1822
+ var el = this.popup.container;
1823
+ if (el && el.parentNode)
1824
+ el.parentNode.removeChild(el);
1825
+ }
1826
+ if (this.editor && this.editor.completer == this)
1827
+ this.editor.completer = null;
1828
+ this.popup = null;
1829
+ };
1830
+
1831
+ }).call(Autocomplete.prototype);
1832
+
1833
+
1834
+ Autocomplete.for = function(editor) {
1835
+ if (editor.completer) {
1836
+ return editor.completer;
1837
+ }
1838
+ if (config.get("sharedPopups")) {
1839
+ if (!Autocomplete.$shared)
1840
+ Autocomplete.$sharedInstance = new Autocomplete();
1841
+ editor.completer = Autocomplete.$sharedInstance;
1842
+ } else {
1843
+ editor.completer = new Autocomplete();
1844
+ editor.once("destroy", function(e, editor) {
1845
+ editor.completer.destroy();
1846
+ });
1847
+ }
1848
+ return editor.completer;
1849
+ };
1850
+
1851
+ Autocomplete.startCommand = {
1852
+ name: "startAutocomplete",
1853
+ exec: function(editor, options) {
1854
+ var completer = Autocomplete.for(editor);
1855
+ completer.autoInsert = false;
1856
+ completer.autoSelect = true;
1857
+ completer.showPopup(editor, options);
1858
+ completer.cancelContextMenu();
1859
+ },
1860
+ bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
1861
+ };
1862
+
1863
+ var FilteredList = function(array, filterText) {
1864
+ this.all = array;
1865
+ this.filtered = array;
1866
+ this.filterText = filterText || "";
1867
+ this.exactMatch = false;
1868
+ };
1869
+ (function(){
1870
+ this.setFilter = function(str) {
1871
+ if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0)
1872
+ var matches = this.filtered;
1873
+ else
1874
+ var matches = this.all;
1875
+
1876
+ this.filterText = str;
1877
+ matches = this.filterCompletions(matches, this.filterText);
1878
+ matches = matches.sort(function(a, b) {
1879
+ return b.exactMatch - a.exactMatch || b.$score - a.$score
1880
+ || (a.caption || a.value).localeCompare(b.caption || b.value);
1881
+ });
1882
+ var prev = null;
1883
+ matches = matches.filter(function(item){
1884
+ var caption = item.snippet || item.caption || item.value;
1885
+ if (caption === prev) return false;
1886
+ prev = caption;
1887
+ return true;
1888
+ });
1889
+
1890
+ this.filtered = matches;
1891
+ };
1892
+ this.filterCompletions = function(items, needle) {
1893
+ var results = [];
1894
+ var upper = needle.toUpperCase();
1895
+ var lower = needle.toLowerCase();
1896
+ loop: for (var i = 0, item; item = items[i]; i++) {
1897
+ var caption = item.caption || item.value || item.snippet;
1898
+ if (!caption) continue;
1899
+ var lastIndex = -1;
1900
+ var matchMask = 0;
1901
+ var penalty = 0;
1902
+ var index, distance;
1903
+
1904
+ if (this.exactMatch) {
1905
+ if (needle !== caption.substr(0, needle.length))
1906
+ continue loop;
1907
+ } else {
1908
+ var fullMatchIndex = caption.toLowerCase().indexOf(lower);
1909
+ if (fullMatchIndex > -1) {
1910
+ penalty = fullMatchIndex;
1911
+ } else {
1912
+ for (var j = 0; j < needle.length; j++) {
1913
+ var i1 = caption.indexOf(lower[j], lastIndex + 1);
1914
+ var i2 = caption.indexOf(upper[j], lastIndex + 1);
1915
+ index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2;
1916
+ if (index < 0)
1917
+ continue loop;
1918
+ distance = index - lastIndex - 1;
1919
+ if (distance > 0) {
1920
+ if (lastIndex === -1)
1921
+ penalty += 10;
1922
+ penalty += distance;
1923
+ matchMask = matchMask | (1 << j);
1924
+ }
1925
+ lastIndex = index;
1926
+ }
1927
+ }
1928
+ }
1929
+ item.matchMask = matchMask;
1930
+ item.exactMatch = penalty ? 0 : 1;
1931
+ item.$score = (item.score || 0) - penalty;
1932
+ results.push(item);
1933
+ }
1934
+ return results;
1935
+ };
1936
+ }).call(FilteredList.prototype);
1937
+
1938
+ exports.Autocomplete = Autocomplete;
1939
+ exports.FilteredList = FilteredList;
1940
+
1941
+ });
1942
+
1943
+ ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"], function(require, exports, module) {
1944
+ var Range = require("../range").Range;
1945
+
1946
+ var splitRegex = /[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;
1947
+
1948
+ function getWordIndex(doc, pos) {
1949
+ var textBefore = doc.getTextRange(Range.fromPoints({row: 0, column:0}, pos));
1950
+ return textBefore.split(splitRegex).length - 1;
1951
+ }
1952
+ function wordDistance(doc, pos) {
1953
+ var prefixPos = getWordIndex(doc, pos);
1954
+ var words = doc.getValue().split(splitRegex);
1955
+ var wordScores = Object.create(null);
1956
+
1957
+ var currentWord = words[prefixPos];
1958
+
1959
+ words.forEach(function(word, idx) {
1960
+ if (!word || word === currentWord) return;
1961
+
1962
+ var distance = Math.abs(prefixPos - idx);
1963
+ var score = words.length - distance;
1964
+ if (wordScores[word]) {
1965
+ wordScores[word] = Math.max(score, wordScores[word]);
1966
+ } else {
1967
+ wordScores[word] = score;
1968
+ }
1969
+ });
1970
+ return wordScores;
1971
+ }
1972
+
1973
+ exports.getCompletions = function(editor, session, pos, prefix, callback) {
1974
+ var wordScore = wordDistance(session, pos);
1975
+ var wordList = Object.keys(wordScore);
1976
+ callback(null, wordList.map(function(word) {
1977
+ return {
1978
+ caption: word,
1979
+ value: word,
1980
+ score: wordScore[word],
1981
+ meta: "local"
1982
+ };
1983
+ }));
1984
+ };
1985
+ });
1986
+
1987
+ ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"], function(require, exports, module) {
1988
+ "use strict";
1989
+
1990
+ var snippetManager = require("../snippets").snippetManager;
1991
+ var Autocomplete = require("../autocomplete").Autocomplete;
1992
+ var config = require("../config");
1993
+ var lang = require("../lib/lang");
1994
+ var util = require("../autocomplete/util");
1995
+
1996
+ var textCompleter = require("../autocomplete/text_completer");
1997
+ var keyWordCompleter = {
1998
+ getCompletions: function(editor, session, pos, prefix, callback) {
1999
+ if (session.$mode.completer) {
2000
+ return session.$mode.completer.getCompletions(editor, session, pos, prefix, callback);
2001
+ }
2002
+ var state = editor.session.getState(pos.row);
2003
+ var completions = session.$mode.getCompletions(state, session, pos, prefix);
2004
+ callback(null, completions);
2005
+ }
2006
+ };
2007
+
2008
+ var snippetCompleter = {
2009
+ getCompletions: function(editor, session, pos, prefix, callback) {
2010
+ var scopes = [];
2011
+ var token = session.getTokenAt(pos.row, pos.column);
2012
+ if (token && token.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/))
2013
+ scopes.push('html-tag');
2014
+ else
2015
+ scopes = snippetManager.getActiveScopes(editor);
2016
+
2017
+ var snippetMap = snippetManager.snippetMap;
2018
+ var completions = [];
2019
+ scopes.forEach(function(scope) {
2020
+ var snippets = snippetMap[scope] || [];
2021
+ for (var i = snippets.length; i--;) {
2022
+ var s = snippets[i];
2023
+ var caption = s.name || s.tabTrigger;
2024
+ if (!caption)
2025
+ continue;
2026
+ completions.push({
2027
+ caption: caption,
2028
+ snippet: s.content,
2029
+ meta: s.tabTrigger && !s.name ? s.tabTrigger + "\u21E5 " : "snippet",
2030
+ type: "snippet"
2031
+ });
2032
+ }
2033
+ }, this);
2034
+ callback(null, completions);
2035
+ },
2036
+ getDocTooltip: function(item) {
2037
+ if (item.type == "snippet" && !item.docHTML) {
2038
+ item.docHTML = [
2039
+ "<b>", lang.escapeHTML(item.caption), "</b>", "<hr></hr>",
2040
+ lang.escapeHTML(item.snippet)
2041
+ ].join("");
2042
+ }
2043
+ }
2044
+ };
2045
+
2046
+ var completers = [snippetCompleter, textCompleter, keyWordCompleter];
2047
+ exports.setCompleters = function(val) {
2048
+ completers.length = 0;
2049
+ if (val) completers.push.apply(completers, val);
2050
+ };
2051
+ exports.addCompleter = function(completer) {
2052
+ completers.push(completer);
2053
+ };
2054
+ exports.textCompleter = textCompleter;
2055
+ exports.keyWordCompleter = keyWordCompleter;
2056
+ exports.snippetCompleter = snippetCompleter;
2057
+
2058
+ var expandSnippet = {
2059
+ name: "expandSnippet",
2060
+ exec: function(editor) {
2061
+ return snippetManager.expandWithTab(editor);
2062
+ },
2063
+ bindKey: "Tab"
2064
+ };
2065
+
2066
+ var onChangeMode = function(e, editor) {
2067
+ loadSnippetsForMode(editor.session.$mode);
2068
+ };
2069
+
2070
+ var loadSnippetsForMode = function(mode) {
2071
+ if (typeof mode == "string")
2072
+ mode = config.$modes[mode];
2073
+ if (!mode)
2074
+ return;
2075
+ if (!snippetManager.files)
2076
+ snippetManager.files = {};
2077
+
2078
+ loadSnippetFile(mode.$id, mode.snippetFileId);
2079
+ if (mode.modes)
2080
+ mode.modes.forEach(loadSnippetsForMode);
2081
+ };
2082
+
2083
+ var loadSnippetFile = function(id, snippetFilePath) {
2084
+ if (!snippetFilePath || !id || snippetManager.files[id])
2085
+ return;
2086
+ snippetManager.files[id] = {};
2087
+ config.loadModule(snippetFilePath, function(m) {
2088
+ if (!m) return;
2089
+ snippetManager.files[id] = m;
2090
+ if (!m.snippets && m.snippetText)
2091
+ m.snippets = snippetManager.parseSnippetFile(m.snippetText);
2092
+ snippetManager.register(m.snippets || [], m.scope);
2093
+ if (m.includeScopes) {
2094
+ snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes;
2095
+ m.includeScopes.forEach(function(x) {
2096
+ loadSnippetsForMode("ace/mode/" + x);
2097
+ });
2098
+ }
2099
+ });
2100
+ };
2101
+
2102
+ var doLiveAutocomplete = function(e) {
2103
+ var editor = e.editor;
2104
+ var hasCompleter = editor.completer && editor.completer.activated;
2105
+ if (e.command.name === "backspace") {
2106
+ if (hasCompleter && !util.getCompletionPrefix(editor))
2107
+ editor.completer.detach();
2108
+ }
2109
+ else if (e.command.name === "insertstring") {
2110
+ var prefix = util.getCompletionPrefix(editor);
2111
+ if (prefix && !hasCompleter) {
2112
+ var completer = Autocomplete.for(editor);
2113
+ completer.autoInsert = false;
2114
+ completer.showPopup(editor);
2115
+ }
2116
+ }
2117
+ };
2118
+
2119
+ var Editor = require("../editor").Editor;
2120
+ require("../config").defineOptions(Editor.prototype, "editor", {
2121
+ enableBasicAutocompletion: {
2122
+ set: function(val) {
2123
+ if (val) {
2124
+ if (!this.completers)
2125
+ this.completers = Array.isArray(val)? val: completers;
2126
+ this.commands.addCommand(Autocomplete.startCommand);
2127
+ } else {
2128
+ this.commands.removeCommand(Autocomplete.startCommand);
2129
+ }
2130
+ },
2131
+ value: false
2132
+ },
2133
+ enableLiveAutocompletion: {
2134
+ set: function(val) {
2135
+ if (val) {
2136
+ if (!this.completers)
2137
+ this.completers = Array.isArray(val)? val: completers;
2138
+ this.commands.on('afterExec', doLiveAutocomplete);
2139
+ } else {
2140
+ this.commands.removeListener('afterExec', doLiveAutocomplete);
2141
+ }
2142
+ },
2143
+ value: false
2144
+ },
2145
+ enableSnippets: {
2146
+ set: function(val) {
2147
+ if (val) {
2148
+ this.commands.addCommand(expandSnippet);
2149
+ this.on("changeMode", onChangeMode);
2150
+ onChangeMode(null, this);
2151
+ } else {
2152
+ this.commands.removeCommand(expandSnippet);
2153
+ this.off("changeMode", onChangeMode);
2154
+ }
2155
+ },
2156
+ value: false
2157
+ }
2158
+ });
2159
+ }); (function() {
2160
+ ace.require(["ace/ext/language_tools"], function(m) {
2161
+ if (typeof module == "object" && typeof exports == "object" && module) {
2162
+ module.exports = m;
2163
+ }
2164
+ });
2165
+ })();
2166
+