@openui5/sap.ui.codeeditor 1.120.7 → 1.121.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (457) hide show
  1. package/.reuse/dep5 +23 -21
  2. package/THIRDPARTY.txt +6 -43
  3. package/package.json +2 -2
  4. package/src/sap/ui/codeeditor/.library +2 -2
  5. package/src/sap/ui/codeeditor/CodeEditor.js +41 -27
  6. package/src/sap/ui/codeeditor/js/ace/ace.js +16262 -16597
  7. package/src/sap/ui/codeeditor/js/ace/css/ace.css +358 -86
  8. package/src/sap/ui/codeeditor/js/ace/css/ambiance-3.png +0 -0
  9. package/src/sap/ui/codeeditor/js/ace/css/chrome-2.png +0 -0
  10. package/src/sap/ui/codeeditor/js/ace/css/cloud9_day-1.png +0 -0
  11. package/src/sap/ui/codeeditor/js/ace/css/cloud9_day-2.png +0 -0
  12. package/src/sap/ui/codeeditor/js/ace/css/cloud9_night-1.png +0 -0
  13. package/src/sap/ui/codeeditor/js/ace/css/cloud9_night-2.png +0 -0
  14. package/src/sap/ui/codeeditor/js/ace/css/cloud9_night_low_color-1.png +0 -0
  15. package/src/sap/ui/codeeditor/js/ace/css/cloud9_night_low_color-2.png +0 -0
  16. package/src/sap/ui/codeeditor/js/ace/css/clouds-2.png +0 -0
  17. package/src/sap/ui/codeeditor/js/ace/css/clouds_midnight-2.png +0 -0
  18. package/src/sap/ui/codeeditor/js/ace/css/cobalt-2.png +0 -0
  19. package/src/sap/ui/codeeditor/js/ace/css/crimson_editor-2.png +0 -0
  20. package/src/sap/ui/codeeditor/js/ace/css/dawn-2.png +0 -0
  21. package/src/sap/ui/codeeditor/js/ace/css/dracula-2.png +0 -0
  22. package/src/sap/ui/codeeditor/js/ace/css/dreamweaver-2.png +0 -0
  23. package/src/sap/ui/codeeditor/js/ace/css/eclipse-2.png +0 -0
  24. package/src/sap/ui/codeeditor/js/ace/css/github-2.png +0 -0
  25. package/src/sap/ui/codeeditor/js/ace/css/github_dark-1.png +0 -0
  26. package/src/sap/ui/codeeditor/js/ace/css/github_dark-2.png +0 -0
  27. package/src/sap/ui/codeeditor/js/ace/css/gob-2.png +0 -0
  28. package/src/sap/ui/codeeditor/js/ace/css/gruvbox-2.png +0 -0
  29. package/src/sap/ui/codeeditor/js/ace/css/gruvbox_dark_hard-1.png +0 -0
  30. package/src/sap/ui/codeeditor/js/ace/css/gruvbox_light_hard-1.png +0 -0
  31. package/src/sap/ui/codeeditor/js/ace/css/gruvbox_light_hard-2.png +0 -0
  32. package/src/sap/ui/codeeditor/js/ace/css/idle_fingers-2.png +0 -0
  33. package/src/sap/ui/codeeditor/js/ace/css/iplastic-3.png +0 -0
  34. package/src/sap/ui/codeeditor/js/ace/css/katzenmilch-1.png +0 -0
  35. package/src/sap/ui/codeeditor/js/ace/css/katzenmilch-2.png +0 -0
  36. package/src/sap/ui/codeeditor/js/ace/css/kr_theme-2.png +0 -0
  37. package/src/sap/ui/codeeditor/js/ace/css/kuroir-1.png +0 -0
  38. package/src/sap/ui/codeeditor/js/ace/css/kuroir-2.png +0 -0
  39. package/src/sap/ui/codeeditor/js/ace/css/main-10.png +0 -0
  40. package/src/sap/ui/codeeditor/js/ace/css/main-11.png +0 -0
  41. package/src/sap/ui/codeeditor/js/ace/css/main-12.png +0 -0
  42. package/src/sap/ui/codeeditor/js/ace/css/main-13.png +0 -0
  43. package/src/sap/ui/codeeditor/js/ace/css/main-14.png +0 -0
  44. package/src/sap/ui/codeeditor/js/ace/css/main-15.png +0 -0
  45. package/src/sap/ui/codeeditor/js/ace/css/main-16.png +0 -0
  46. package/src/sap/ui/codeeditor/js/ace/css/main-17.png +0 -0
  47. package/src/sap/ui/codeeditor/js/ace/css/main-18.png +0 -0
  48. package/src/sap/ui/codeeditor/js/ace/css/main-19.png +0 -0
  49. package/src/sap/ui/codeeditor/js/ace/css/main-20.png +0 -0
  50. package/src/sap/ui/codeeditor/js/ace/css/main-21.png +0 -0
  51. package/src/sap/ui/codeeditor/js/ace/css/main-22.png +0 -0
  52. package/src/sap/ui/codeeditor/js/ace/css/main-22.svg +1 -0
  53. package/src/sap/ui/codeeditor/js/ace/css/main-23.png +0 -0
  54. package/src/sap/ui/codeeditor/js/ace/css/main-5.svg +7 -0
  55. package/src/sap/ui/codeeditor/js/ace/css/main-6.svg +7 -0
  56. package/src/sap/ui/codeeditor/js/ace/css/main-7.svg +9 -0
  57. package/src/sap/ui/codeeditor/js/ace/css/main-8.png +0 -0
  58. package/src/sap/ui/codeeditor/js/ace/css/main-8.svg +4 -0
  59. package/src/sap/ui/codeeditor/js/ace/css/main-9.png +0 -0
  60. package/src/sap/ui/codeeditor/js/ace/css/main-9.svg +4 -0
  61. package/src/sap/ui/codeeditor/js/ace/css/merbivore-2.png +0 -0
  62. package/src/sap/ui/codeeditor/js/ace/css/merbivore_soft-2.png +0 -0
  63. package/src/sap/ui/codeeditor/js/ace/css/mono_industrial-2.png +0 -0
  64. package/src/sap/ui/codeeditor/js/ace/css/monokai-2.png +0 -0
  65. package/src/sap/ui/codeeditor/js/ace/css/one_dark-2.png +0 -0
  66. package/src/sap/ui/codeeditor/js/ace/css/pastel_on_dark-2.png +0 -0
  67. package/src/sap/ui/codeeditor/js/ace/css/solarized_dark-2.png +0 -0
  68. package/src/sap/ui/codeeditor/js/ace/css/solarized_light-2.png +0 -0
  69. package/src/sap/ui/codeeditor/js/ace/css/sqlserver-2.png +0 -0
  70. package/src/sap/ui/codeeditor/js/ace/css/terminal-2.png +0 -0
  71. package/src/sap/ui/codeeditor/js/ace/css/textmate-2.png +0 -0
  72. package/src/sap/ui/codeeditor/js/ace/css/theme/ambiance.css +120 -68
  73. package/src/sap/ui/codeeditor/js/ace/css/theme/chaos.css +79 -66
  74. package/src/sap/ui/codeeditor/js/ace/css/theme/chrome.css +82 -43
  75. package/src/sap/ui/codeeditor/js/ace/css/theme/cloud9_day.css +160 -0
  76. package/src/sap/ui/codeeditor/js/ace/css/theme/cloud9_night.css +146 -0
  77. package/src/sap/ui/codeeditor/js/ace/css/theme/cloud9_night_low_color.css +134 -0
  78. package/src/sap/ui/codeeditor/js/ace/css/theme/clouds.css +59 -31
  79. package/src/sap/ui/codeeditor/js/ace/css/theme/clouds_midnight.css +60 -32
  80. package/src/sap/ui/codeeditor/js/ace/css/theme/cobalt.css +71 -38
  81. package/src/sap/ui/codeeditor/js/ace/css/theme/crimson_editor.css +79 -42
  82. package/src/sap/ui/codeeditor/js/ace/css/theme/dawn.css +70 -40
  83. package/src/sap/ui/codeeditor/js/ace/css/theme/dracula.css +95 -49
  84. package/src/sap/ui/codeeditor/js/ace/css/theme/dreamweaver.css +95 -49
  85. package/src/sap/ui/codeeditor/js/ace/css/theme/eclipse.css +62 -33
  86. package/src/sap/ui/codeeditor/js/ace/css/theme/github.css +71 -38
  87. package/src/sap/ui/codeeditor/js/ace/css/theme/github_dark.css +134 -0
  88. package/src/sap/ui/codeeditor/js/ace/css/theme/gob.css +68 -38
  89. package/src/sap/ui/codeeditor/js/ace/css/theme/gruvbox.css +54 -28
  90. package/src/sap/ui/codeeditor/js/ace/css/theme/gruvbox_dark_hard.css +163 -0
  91. package/src/sap/ui/codeeditor/js/ace/css/theme/gruvbox_light_hard.css +167 -0
  92. package/src/sap/ui/codeeditor/js/ace/css/theme/idle_fingers.css +62 -34
  93. package/src/sap/ui/codeeditor/js/ace/css/theme/iplastic.css +76 -45
  94. package/src/sap/ui/codeeditor/js/ace/css/theme/katzenmilch.css +91 -53
  95. package/src/sap/ui/codeeditor/js/ace/css/theme/kr_theme.css +67 -36
  96. package/src/sap/ui/codeeditor/js/ace/css/theme/kuroir.css +43 -17
  97. package/src/sap/ui/codeeditor/js/ace/css/theme/merbivore.css +57 -31
  98. package/src/sap/ui/codeeditor/js/ace/css/theme/merbivore_soft.css +57 -31
  99. package/src/sap/ui/codeeditor/js/ace/css/theme/mono_industrial.css +66 -36
  100. package/src/sap/ui/codeeditor/js/ace/css/theme/monokai.css +63 -35
  101. package/src/sap/ui/codeeditor/js/ace/css/theme/nord_dark.css +55 -29
  102. package/src/sap/ui/codeeditor/js/ace/css/theme/one_dark.css +88 -47
  103. package/src/sap/ui/codeeditor/js/ace/css/theme/pastel_on_dark.css +70 -38
  104. package/src/sap/ui/codeeditor/js/ace/css/theme/solarized_dark.css +52 -28
  105. package/src/sap/ui/codeeditor/js/ace/css/theme/solarized_light.css +55 -29
  106. package/src/sap/ui/codeeditor/js/ace/css/theme/sqlserver.css +90 -48
  107. package/src/sap/ui/codeeditor/js/ace/css/theme/terminal.css +64 -34
  108. package/src/sap/ui/codeeditor/js/ace/css/theme/textmate.css +82 -43
  109. package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow.css +61 -33
  110. package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night.css +61 -33
  111. package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night_blue.css +59 -32
  112. package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night_bright.css +71 -40
  113. package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night_eighties.css +61 -33
  114. package/src/sap/ui/codeeditor/js/ace/css/theme/twilight.css +66 -36
  115. package/src/sap/ui/codeeditor/js/ace/css/theme/vibrant_ink.css +59 -32
  116. package/src/sap/ui/codeeditor/js/ace/css/theme/xcode.css +54 -28
  117. package/src/sap/ui/codeeditor/js/ace/css/tomorrow-2.png +0 -0
  118. package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night-2.png +0 -0
  119. package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night_blue-2.png +0 -0
  120. package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night_bright-2.png +0 -0
  121. package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night_eighties-2.png +0 -0
  122. package/src/sap/ui/codeeditor/js/ace/css/twilight-2.png +0 -0
  123. package/src/sap/ui/codeeditor/js/ace/css/vibrant_ink-2.png +0 -0
  124. package/src/sap/ui/codeeditor/js/ace/css/xcode-2.png +0 -0
  125. package/src/sap/ui/codeeditor/js/ace/ext-beautify.js +90 -91
  126. package/src/sap/ui/codeeditor/js/ace/ext-code_lens.js +39 -75
  127. package/src/sap/ui/codeeditor/js/ace/ext-command_bar.js +457 -0
  128. package/src/sap/ui/codeeditor/js/ace/ext-elastic_tabstops_lite.js +47 -97
  129. package/src/sap/ui/codeeditor/js/ace/ext-emmet.js +496 -552
  130. package/src/sap/ui/codeeditor/js/ace/ext-hardwrap.js +47 -16
  131. package/src/sap/ui/codeeditor/js/ace/ext-inline_autocomplete.js +3269 -0
  132. package/src/sap/ui/codeeditor/js/ace/ext-keybinding_menu.js +45 -105
  133. package/src/sap/ui/codeeditor/js/ace/ext-language_tools.js +1438 -1128
  134. package/src/sap/ui/codeeditor/js/ace/ext-linking.js +8 -16
  135. package/src/sap/ui/codeeditor/js/ace/ext-modelist.js +198 -185
  136. package/src/sap/ui/codeeditor/js/ace/ext-options.js +405 -443
  137. package/src/sap/ui/codeeditor/js/ace/ext-prompt.js +1682 -1508
  138. package/src/sap/ui/codeeditor/js/ace/ext-rtl.js +26 -28
  139. package/src/sap/ui/codeeditor/js/ace/ext-searchbox.js +160 -332
  140. package/src/sap/ui/codeeditor/js/ace/ext-settings_menu.js +409 -446
  141. package/src/sap/ui/codeeditor/js/ace/ext-simple_tokenizer.js +45 -0
  142. package/src/sap/ui/codeeditor/js/ace/ext-spellcheck.js +4 -10
  143. package/src/sap/ui/codeeditor/js/ace/ext-split.js +41 -63
  144. package/src/sap/ui/codeeditor/js/ace/ext-statusbar.js +19 -27
  145. package/src/sap/ui/codeeditor/js/ace/ext-themelist.js +45 -41
  146. package/src/sap/ui/codeeditor/js/ace/ext-whitespace.js +62 -83
  147. package/src/sap/ui/codeeditor/js/ace/keybinding-emacs.js +442 -551
  148. package/src/sap/ui/codeeditor/js/ace/keybinding-sublime.js +338 -351
  149. package/src/sap/ui/codeeditor/js/ace/keybinding-vim.js +5242 -4758
  150. package/src/sap/ui/codeeditor/js/ace/keybinding-vscode.js +228 -235
  151. package/src/sap/ui/codeeditor/js/ace/mode-abap.js +72 -93
  152. package/src/sap/ui/codeeditor/js/ace/mode-abc.js +136 -164
  153. package/src/sap/ui/codeeditor/js/ace/mode-actionscript.js +109 -150
  154. package/src/sap/ui/codeeditor/js/ace/mode-ada.js +45 -74
  155. package/src/sap/ui/codeeditor/js/ace/mode-alda.js +77 -109
  156. package/src/sap/ui/codeeditor/js/ace/mode-apache_conf.js +196 -241
  157. package/src/sap/ui/codeeditor/js/ace/mode-apex.js +192 -247
  158. package/src/sap/ui/codeeditor/js/ace/mode-applescript.js +56 -102
  159. package/src/sap/ui/codeeditor/js/ace/mode-aql.js +85 -95
  160. package/src/sap/ui/codeeditor/js/ace/mode-asciidoc.js +120 -158
  161. package/src/sap/ui/codeeditor/js/ace/mode-asl.js +233 -298
  162. package/src/sap/ui/codeeditor/js/ace/mode-assembly_x86.js +78 -101
  163. package/src/sap/ui/codeeditor/js/ace/mode-astro.js +2414 -0
  164. package/src/sap/ui/codeeditor/js/ace/mode-autohotkey.js +80 -116
  165. package/src/sap/ui/codeeditor/js/ace/mode-batchfile.js +74 -105
  166. package/src/sap/ui/codeeditor/js/ace/mode-bibtex.js +318 -0
  167. package/src/sap/ui/codeeditor/js/ace/mode-c9search.js +72 -115
  168. package/src/sap/ui/codeeditor/js/ace/mode-c_cpp.js +171 -257
  169. package/src/sap/ui/codeeditor/js/ace/mode-cirru.js +97 -115
  170. package/src/sap/ui/codeeditor/js/ace/mode-clojure.js +126 -119
  171. package/src/sap/ui/codeeditor/js/ace/mode-cobol.js +48 -67
  172. package/src/sap/ui/codeeditor/js/ace/mode-coffee.js +203 -268
  173. package/src/sap/ui/codeeditor/js/ace/mode-coldfusion.js +1029 -1276
  174. package/src/sap/ui/codeeditor/js/ace/mode-crystal.js +337 -393
  175. package/src/sap/ui/codeeditor/js/ace/mode-csharp.js +127 -216
  176. package/src/sap/ui/codeeditor/js/ace/mode-csound_document.js +1539 -1569
  177. package/src/sap/ui/codeeditor/js/ace/mode-csound_orchestra.js +786 -898
  178. package/src/sap/ui/codeeditor/js/ace/mode-csound_score.js +184 -237
  179. package/src/sap/ui/codeeditor/js/ace/mode-csp.js +37 -37
  180. package/src/sap/ui/codeeditor/js/ace/mode-css.js +293 -384
  181. package/src/sap/ui/codeeditor/js/ace/mode-curly.js +1019 -1262
  182. package/src/sap/ui/codeeditor/js/ace/mode-cuttlefish.js +56 -0
  183. package/src/sap/ui/codeeditor/js/ace/mode-d.js +163 -233
  184. package/src/sap/ui/codeeditor/js/ace/mode-dart.js +330 -427
  185. package/src/sap/ui/codeeditor/js/ace/mode-diff.js +20 -38
  186. package/src/sap/ui/codeeditor/js/ace/mode-django.js +1032 -1271
  187. package/src/sap/ui/codeeditor/js/ace/mode-dockerfile.js +211 -284
  188. package/src/sap/ui/codeeditor/js/ace/mode-dot.js +131 -200
  189. package/src/sap/ui/codeeditor/js/ace/mode-drools.js +408 -349
  190. package/src/sap/ui/codeeditor/js/ace/mode-edifact.js +89 -125
  191. package/src/sap/ui/codeeditor/js/ace/mode-eiffel.js +47 -62
  192. package/src/sap/ui/codeeditor/js/ace/mode-ejs.js +1350 -1666
  193. package/src/sap/ui/codeeditor/js/ace/mode-elixir.js +349 -407
  194. package/src/sap/ui/codeeditor/js/ace/mode-elm.js +136 -168
  195. package/src/sap/ui/codeeditor/js/ace/mode-erlang.js +707 -881
  196. package/src/sap/ui/codeeditor/js/ace/mode-flix.js +164 -0
  197. package/src/sap/ui/codeeditor/js/ace/mode-forth.js +128 -172
  198. package/src/sap/ui/codeeditor/js/ace/mode-fortran.js +177 -246
  199. package/src/sap/ui/codeeditor/js/ace/mode-fsharp.js +92 -131
  200. package/src/sap/ui/codeeditor/js/ace/mode-fsl.js +91 -124
  201. package/src/sap/ui/codeeditor/js/ace/mode-ftl.js +813 -748
  202. package/src/sap/ui/codeeditor/js/ace/mode-gcode.js +52 -71
  203. package/src/sap/ui/codeeditor/js/ace/mode-gherkin.js +105 -119
  204. package/src/sap/ui/codeeditor/js/ace/mode-gitignore.js +12 -22
  205. package/src/sap/ui/codeeditor/js/ace/mode-glsl.js +184 -289
  206. package/src/sap/ui/codeeditor/js/ace/mode-gobstones.js +686 -623
  207. package/src/sap/ui/codeeditor/js/ace/mode-golang.js +167 -239
  208. package/src/sap/ui/codeeditor/js/ace/mode-graphqlschema.js +48 -88
  209. package/src/sap/ui/codeeditor/js/ace/mode-groovy.js +577 -471
  210. package/src/sap/ui/codeeditor/js/ace/mode-haml.js +1062 -1026
  211. package/src/sap/ui/codeeditor/js/ace/mode-handlebars.js +1061 -1305
  212. package/src/sap/ui/codeeditor/js/ace/mode-haskell.js +199 -255
  213. package/src/sap/ui/codeeditor/js/ace/mode-haskell_cabal.js +81 -87
  214. package/src/sap/ui/codeeditor/js/ace/mode-haxe.js +111 -184
  215. package/src/sap/ui/codeeditor/js/ace/mode-hjson.js +164 -199
  216. package/src/sap/ui/codeeditor/js/ace/mode-html.js +1009 -1239
  217. package/src/sap/ui/codeeditor/js/ace/mode-html_elixir.js +1402 -1705
  218. package/src/sap/ui/codeeditor/js/ace/mode-html_ruby.js +1390 -1706
  219. package/src/sap/ui/codeeditor/js/ace/mode-ini.js +58 -82
  220. package/src/sap/ui/codeeditor/js/ace/mode-io.js +85 -123
  221. package/src/sap/ui/codeeditor/js/ace/mode-ion.js +477 -0
  222. package/src/sap/ui/codeeditor/js/ace/mode-jack.js +109 -162
  223. package/src/sap/ui/codeeditor/js/ace/mode-jade.js +1339 -1344
  224. package/src/sap/ui/codeeditor/js/ace/mode-java.js +710 -498
  225. package/src/sap/ui/codeeditor/js/ace/mode-javascript.js +441 -354
  226. package/src/sap/ui/codeeditor/js/ace/mode-jexl.js +270 -0
  227. package/src/sap/ui/codeeditor/js/ace/mode-json.js +93 -147
  228. package/src/sap/ui/codeeditor/js/ace/mode-json5.js +128 -180
  229. package/src/sap/ui/codeeditor/js/ace/mode-jsoniq.js +58 -112
  230. package/src/sap/ui/codeeditor/js/ace/mode-jsp.js +1045 -865
  231. package/src/sap/ui/codeeditor/js/ace/mode-jssm.js +158 -190
  232. package/src/sap/ui/codeeditor/js/ace/mode-jsx.js +121 -194
  233. package/src/sap/ui/codeeditor/js/ace/mode-julia.js +128 -177
  234. package/src/sap/ui/codeeditor/js/ace/mode-kotlin.js +262 -614
  235. package/src/sap/ui/codeeditor/js/ace/mode-latex.js +94 -138
  236. package/src/sap/ui/codeeditor/js/ace/mode-latte.js +1120 -1366
  237. package/src/sap/ui/codeeditor/js/ace/mode-less.js +342 -442
  238. package/src/sap/ui/codeeditor/js/ace/mode-liquid.js +1353 -1414
  239. package/src/sap/ui/codeeditor/js/ace/mode-lisp.js +65 -73
  240. package/src/sap/ui/codeeditor/js/ace/mode-livescript.js +217 -224
  241. package/src/sap/ui/codeeditor/js/ace/mode-logiql.js +97 -142
  242. package/src/sap/ui/codeeditor/js/ace/mode-logtalk.js +187 -227
  243. package/src/sap/ui/codeeditor/js/ace/mode-lsl.js +99 -155
  244. package/src/sap/ui/codeeditor/js/ace/mode-lua.js +152 -211
  245. package/src/sap/ui/codeeditor/js/ace/mode-luapage.js +1167 -1470
  246. package/src/sap/ui/codeeditor/js/ace/mode-lucene.js +25 -34
  247. package/src/sap/ui/codeeditor/js/ace/mode-makefile.js +244 -282
  248. package/src/sap/ui/codeeditor/js/ace/mode-markdown.js +1858 -2177
  249. package/src/sap/ui/codeeditor/js/ace/mode-mask.js +964 -1007
  250. package/src/sap/ui/codeeditor/js/ace/mode-matlab.js +197 -221
  251. package/src/sap/ui/codeeditor/js/ace/mode-maze.js +127 -163
  252. package/src/sap/ui/codeeditor/js/ace/mode-mediawiki.js +464 -476
  253. package/src/sap/ui/codeeditor/js/ace/mode-mel.js +90 -140
  254. package/src/sap/ui/codeeditor/js/ace/mode-mips.js +101 -134
  255. package/src/sap/ui/codeeditor/js/ace/mode-mixal.js +63 -75
  256. package/src/sap/ui/codeeditor/js/ace/mode-mushcode.js +537 -576
  257. package/src/sap/ui/codeeditor/js/ace/mode-mysql.js +85 -102
  258. package/src/sap/ui/codeeditor/js/ace/mode-nasal.js +513 -0
  259. package/src/sap/ui/codeeditor/js/ace/mode-nginx.js +119 -155
  260. package/src/sap/ui/codeeditor/js/ace/mode-nim.js +159 -197
  261. package/src/sap/ui/codeeditor/js/ace/mode-nix.js +283 -375
  262. package/src/sap/ui/codeeditor/js/ace/mode-nsis.js +139 -172
  263. package/src/sap/ui/codeeditor/js/ace/mode-nunjucks.js +1138 -1378
  264. package/src/sap/ui/codeeditor/js/ace/mode-objectivec.js +400 -514
  265. package/src/sap/ui/codeeditor/js/ace/mode-ocaml.js +77 -120
  266. package/src/sap/ui/codeeditor/js/ace/mode-odin.js +449 -0
  267. package/src/sap/ui/codeeditor/js/ace/mode-partiql.js +750 -0
  268. package/src/sap/ui/codeeditor/js/ace/mode-pascal.js +28 -47
  269. package/src/sap/ui/codeeditor/js/ace/mode-perl.js +122 -185
  270. package/src/sap/ui/codeeditor/js/ace/mode-pgsql.js +974 -851
  271. package/src/sap/ui/codeeditor/js/ace/mode-php.js +2282 -1502
  272. package/src/sap/ui/codeeditor/js/ace/mode-php_laravel_blade.js +2463 -1696
  273. package/src/sap/ui/codeeditor/js/ace/mode-pig.js +133 -165
  274. package/src/sap/ui/codeeditor/js/ace/mode-plain_text.js +5 -10
  275. package/src/sap/ui/codeeditor/js/ace/mode-plsql.js +268 -0
  276. package/src/sap/ui/codeeditor/js/ace/mode-powershell.js +332 -183
  277. package/src/sap/ui/codeeditor/js/ace/mode-praat.js +168 -234
  278. package/src/sap/ui/codeeditor/js/ace/mode-prisma.js +292 -324
  279. package/src/sap/ui/codeeditor/js/ace/mode-prolog.js +180 -246
  280. package/src/sap/ui/codeeditor/js/ace/mode-properties.js +26 -37
  281. package/src/sap/ui/codeeditor/js/ace/mode-protobuf.js +232 -327
  282. package/src/sap/ui/codeeditor/js/ace/mode-prql.js +320 -0
  283. package/src/sap/ui/codeeditor/js/ace/mode-puppet.js +68 -120
  284. package/src/sap/ui/codeeditor/js/ace/mode-python.js +338 -370
  285. package/src/sap/ui/codeeditor/js/ace/mode-qml.js +244 -279
  286. package/src/sap/ui/codeeditor/js/ace/mode-r.js +295 -220
  287. package/src/sap/ui/codeeditor/js/ace/mode-raku.js +356 -433
  288. package/src/sap/ui/codeeditor/js/ace/mode-razor.js +1130 -1374
  289. package/src/sap/ui/codeeditor/js/ace/mode-rdoc.js +214 -171
  290. package/src/sap/ui/codeeditor/js/ace/mode-red.js +212 -274
  291. package/src/sap/ui/codeeditor/js/ace/mode-redshift.js +181 -220
  292. package/src/sap/ui/codeeditor/js/ace/mode-rhtml.js +1325 -1443
  293. package/src/sap/ui/codeeditor/js/ace/mode-robot.js +168 -0
  294. package/src/sap/ui/codeeditor/js/ace/mode-rst.js +217 -229
  295. package/src/sap/ui/codeeditor/js/ace/mode-ruby.js +338 -420
  296. package/src/sap/ui/codeeditor/js/ace/mode-rust.js +258 -155
  297. package/src/sap/ui/codeeditor/js/ace/mode-sac.js +349 -0
  298. package/src/sap/ui/codeeditor/js/ace/mode-sass.js +257 -309
  299. package/src/sap/ui/codeeditor/js/ace/mode-scad.js +127 -191
  300. package/src/sap/ui/codeeditor/js/ace/mode-scala.js +572 -468
  301. package/src/sap/ui/codeeditor/js/ace/mode-scheme.js +104 -126
  302. package/src/sap/ui/codeeditor/js/ace/mode-scrypt.js +181 -228
  303. package/src/sap/ui/codeeditor/js/ace/mode-scss.js +364 -472
  304. package/src/sap/ui/codeeditor/js/ace/mode-sh.js +204 -266
  305. package/src/sap/ui/codeeditor/js/ace/mode-sjs.js +477 -405
  306. package/src/sap/ui/codeeditor/js/ace/mode-slim.js +2631 -3161
  307. package/src/sap/ui/codeeditor/js/ace/mode-smarty.js +1075 -1334
  308. package/src/sap/ui/codeeditor/js/ace/mode-smithy.js +276 -327
  309. package/src/sap/ui/codeeditor/js/ace/mode-snippets.js +78 -102
  310. package/src/sap/ui/codeeditor/js/ace/mode-soy_template.js +1251 -1548
  311. package/src/sap/ui/codeeditor/js/ace/mode-space.js +47 -63
  312. package/src/sap/ui/codeeditor/js/ace/mode-sparql.js +139 -171
  313. package/src/sap/ui/codeeditor/js/ace/mode-sql.js +77 -133
  314. package/src/sap/ui/codeeditor/js/ace/mode-sqlserver.js +138 -192
  315. package/src/sap/ui/codeeditor/js/ace/mode-stylus.js +306 -338
  316. package/src/sap/ui/codeeditor/js/ace/mode-svg.js +642 -794
  317. package/src/sap/ui/codeeditor/js/ace/mode-swift.js +96 -150
  318. package/src/sap/ui/codeeditor/js/ace/mode-tcl.js +151 -200
  319. package/src/sap/ui/codeeditor/js/ace/mode-terraform.js +78 -132
  320. package/src/sap/ui/codeeditor/js/ace/mode-tex.js +148 -96
  321. package/src/sap/ui/codeeditor/js/ace/mode-textile.js +45 -70
  322. package/src/sap/ui/codeeditor/js/ace/mode-toml.js +63 -87
  323. package/src/sap/ui/codeeditor/js/ace/mode-tsx.js +462 -384
  324. package/src/sap/ui/codeeditor/js/ace/mode-turtle.js +119 -151
  325. package/src/sap/ui/codeeditor/js/ace/mode-twig.js +1099 -1350
  326. package/src/sap/ui/codeeditor/js/ace/mode-typescript.js +455 -376
  327. package/src/sap/ui/codeeditor/js/ace/mode-vala.js +382 -505
  328. package/src/sap/ui/codeeditor/js/ace/mode-vbscript.js +231 -264
  329. package/src/sap/ui/codeeditor/js/ace/mode-velocity.js +1116 -1388
  330. package/src/sap/ui/codeeditor/js/ace/mode-verilog.js +61 -81
  331. package/src/sap/ui/codeeditor/js/ace/mode-vhdl.js +57 -79
  332. package/src/sap/ui/codeeditor/js/ace/mode-visualforce.js +1046 -1292
  333. package/src/sap/ui/codeeditor/js/ace/mode-wollok.js +525 -417
  334. package/src/sap/ui/codeeditor/js/ace/mode-xml.js +182 -389
  335. package/src/sap/ui/codeeditor/js/ace/mode-xquery.js +58 -112
  336. package/src/sap/ui/codeeditor/js/ace/mode-yaml.js +202 -137
  337. package/src/sap/ui/codeeditor/js/ace/mode-zeek.js +237 -274
  338. package/src/sap/ui/codeeditor/js/ace/snippets/abc.js +5 -34
  339. package/src/sap/ui/codeeditor/js/ace/snippets/actionscript.js +5 -160
  340. package/src/sap/ui/codeeditor/js/ace/snippets/astro.js +9 -0
  341. package/src/sap/ui/codeeditor/js/ace/snippets/bibtex.js +9 -0
  342. package/src/sap/ui/codeeditor/js/ace/snippets/c_cpp.js +5 -134
  343. package/src/sap/ui/codeeditor/js/ace/snippets/clojure.js +5 -93
  344. package/src/sap/ui/codeeditor/js/ace/snippets/coffee.js +5 -98
  345. package/src/sap/ui/codeeditor/js/ace/snippets/csound_document.js +5 -13
  346. package/src/sap/ui/codeeditor/js/ace/snippets/csound_orchestra.js +5 -50
  347. package/src/sap/ui/codeeditor/js/ace/snippets/css.js +5 -970
  348. package/src/sap/ui/codeeditor/js/ace/snippets/cuttlefish.js +9 -0
  349. package/src/sap/ui/codeeditor/js/ace/snippets/dart.js +5 -86
  350. package/src/sap/ui/codeeditor/js/ace/snippets/diff.js +5 -14
  351. package/src/sap/ui/codeeditor/js/ace/snippets/django.js +5 -111
  352. package/src/sap/ui/codeeditor/js/ace/snippets/drools.js +5 -22
  353. package/src/sap/ui/codeeditor/js/ace/snippets/edifact.js +8 -246
  354. package/src/sap/ui/codeeditor/js/ace/snippets/erlang.js +5 -163
  355. package/src/sap/ui/codeeditor/js/ace/snippets/flix.js +9 -0
  356. package/src/sap/ui/codeeditor/js/ace/snippets/fsl.js +6 -4
  357. package/src/sap/ui/codeeditor/js/ace/snippets/gobstones.js +5 -1707
  358. package/src/sap/ui/codeeditor/js/ace/snippets/graphqlschema.js +5 -35
  359. package/src/sap/ui/codeeditor/js/ace/snippets/haml.js +5 -23
  360. package/src/sap/ui/codeeditor/js/ace/snippets/haskell.js +5 -85
  361. package/src/sap/ui/codeeditor/js/ace/snippets/html.js +5 -856
  362. package/src/sap/ui/codeeditor/js/ace/snippets/io.js +1 -3
  363. package/src/sap/ui/codeeditor/js/ace/snippets/ion.js +9 -0
  364. package/src/sap/ui/codeeditor/js/ace/snippets/java.js +5 -243
  365. package/src/sap/ui/codeeditor/js/ace/snippets/javascript.js +5 -198
  366. package/src/sap/ui/codeeditor/js/ace/snippets/jexl.js +9 -0
  367. package/src/sap/ui/codeeditor/js/ace/snippets/jsoniq.js +44 -41
  368. package/src/sap/ui/codeeditor/js/ace/snippets/jsp.js +5 -102
  369. package/src/sap/ui/codeeditor/js/ace/snippets/liquid.js +5 -884
  370. package/src/sap/ui/codeeditor/js/ace/snippets/lsl.js +5 -1235
  371. package/src/sap/ui/codeeditor/js/ace/snippets/lua.js +5 -24
  372. package/src/sap/ui/codeeditor/js/ace/snippets/makefile.js +5 -7
  373. package/src/sap/ui/codeeditor/js/ace/snippets/markdown.js +5 -91
  374. package/src/sap/ui/codeeditor/js/ace/snippets/maze.js +5 -12
  375. package/src/sap/ui/codeeditor/js/ace/snippets/nasal.js +9 -0
  376. package/src/sap/ui/codeeditor/js/ace/snippets/odin.js +9 -0
  377. package/src/sap/ui/codeeditor/js/ace/snippets/partiql.js +9 -0
  378. package/src/sap/ui/codeeditor/js/ace/snippets/perl.js +5 -350
  379. package/src/sap/ui/codeeditor/js/ace/snippets/php.js +5 -386
  380. package/src/sap/ui/codeeditor/js/ace/snippets/plsql.js +9 -0
  381. package/src/sap/ui/codeeditor/js/ace/snippets/prql.js +9 -0
  382. package/src/sap/ui/codeeditor/js/ace/snippets/python.js +5 -161
  383. package/src/sap/ui/codeeditor/js/ace/snippets/r.js +5 -124
  384. package/src/sap/ui/codeeditor/js/ace/snippets/razor.js +5 -6
  385. package/src/sap/ui/codeeditor/js/ace/snippets/robot.js +16 -0
  386. package/src/sap/ui/codeeditor/js/ace/snippets/rst.js +5 -25
  387. package/src/sap/ui/codeeditor/js/ace/snippets/ruby.js +5 -931
  388. package/src/sap/ui/codeeditor/js/ace/snippets/sac.js +9 -0
  389. package/src/sap/ui/codeeditor/js/ace/snippets/sh.js +5 -86
  390. package/src/sap/ui/codeeditor/js/ace/snippets/snippets.js +5 -12
  391. package/src/sap/ui/codeeditor/js/ace/snippets/sql.js +5 -29
  392. package/src/sap/ui/codeeditor/js/ace/snippets/sqlserver.js +5 -72
  393. package/src/sap/ui/codeeditor/js/ace/snippets/tcl.js +5 -95
  394. package/src/sap/ui/codeeditor/js/ace/snippets/tex.js +5 -193
  395. package/src/sap/ui/codeeditor/js/ace/snippets/textile.js +5 -33
  396. package/src/sap/ui/codeeditor/js/ace/snippets/vala.js +1 -2
  397. package/src/sap/ui/codeeditor/js/ace/snippets/velocity.js +5 -31
  398. package/src/sap/ui/codeeditor/js/ace/snippets/wollok.js +5 -87
  399. package/src/sap/ui/codeeditor/js/ace/snippets/xquery.js +44 -41
  400. package/src/sap/ui/codeeditor/js/ace/theme-ambiance.js +5 -172
  401. package/src/sap/ui/codeeditor/js/ace/theme-chaos.js +5 -150
  402. package/src/sap/ui/codeeditor/js/ace/theme-chrome.js +6 -123
  403. package/src/sap/ui/codeeditor/js/ace/theme-cloud9_day.js +19 -0
  404. package/src/sap/ui/codeeditor/js/ace/theme-cloud9_night.js +18 -0
  405. package/src/sap/ui/codeeditor/js/ace/theme-cloud9_night_low_color.js +18 -0
  406. package/src/sap/ui/codeeditor/js/ace/theme-clouds.js +6 -90
  407. package/src/sap/ui/codeeditor/js/ace/theme-clouds_midnight.js +6 -91
  408. package/src/sap/ui/codeeditor/js/ace/theme-cobalt.js +6 -108
  409. package/src/sap/ui/codeeditor/js/ace/theme-crimson_editor.js +6 -113
  410. package/src/sap/ui/codeeditor/js/ace/theme-dawn.js +6 -103
  411. package/src/sap/ui/codeeditor/js/ace/theme-dracula.js +6 -122
  412. package/src/sap/ui/codeeditor/js/ace/theme-dreamweaver.js +7 -137
  413. package/src/sap/ui/codeeditor/js/ace/theme-eclipse.js +6 -92
  414. package/src/sap/ui/codeeditor/js/ace/theme-github.js +7 -99
  415. package/src/sap/ui/codeeditor/js/ace/theme-github_dark.js +18 -0
  416. package/src/sap/ui/codeeditor/js/ace/theme-gob.js +6 -107
  417. package/src/sap/ui/codeeditor/js/ace/theme-gruvbox.js +5 -76
  418. package/src/sap/ui/codeeditor/js/ace/theme-gruvbox_dark_hard.js +18 -0
  419. package/src/sap/ui/codeeditor/js/ace/theme-gruvbox_light_hard.js +18 -0
  420. package/src/sap/ui/codeeditor/js/ace/theme-idle_fingers.js +6 -91
  421. package/src/sap/ui/codeeditor/js/ace/theme-iplastic.js +6 -116
  422. package/src/sap/ui/codeeditor/js/ace/theme-katzenmilch.js +6 -116
  423. package/src/sap/ui/codeeditor/js/ace/theme-kr_theme.js +6 -99
  424. package/src/sap/ui/codeeditor/js/ace/theme-kuroir.js +6 -56
  425. package/src/sap/ui/codeeditor/js/ace/theme-merbivore.js +6 -90
  426. package/src/sap/ui/codeeditor/js/ace/theme-merbivore_soft.js +6 -91
  427. package/src/sap/ui/codeeditor/js/ace/theme-mono_industrial.js +6 -102
  428. package/src/sap/ui/codeeditor/js/ace/theme-monokai.js +6 -100
  429. package/src/sap/ui/codeeditor/js/ace/theme-nord_dark.js +6 -89
  430. package/src/sap/ui/codeeditor/js/ace/theme-one_dark.js +10 -131
  431. package/src/sap/ui/codeeditor/js/ace/theme-pastel_on_dark.js +6 -103
  432. package/src/sap/ui/codeeditor/js/ace/theme-solarized_dark.js +6 -83
  433. package/src/sap/ui/codeeditor/js/ace/theme-solarized_light.js +6 -86
  434. package/src/sap/ui/codeeditor/js/ace/theme-sqlserver.js +6 -133
  435. package/src/sap/ui/codeeditor/js/ace/theme-terminal.js +6 -109
  436. package/src/sap/ui/codeeditor/js/ace/theme-textmate.js +3 -124
  437. package/src/sap/ui/codeeditor/js/ace/theme-tomorrow.js +6 -103
  438. package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night.js +6 -103
  439. package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night_blue.js +6 -101
  440. package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night_bright.js +6 -116
  441. package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night_eighties.js +6 -103
  442. package/src/sap/ui/codeeditor/js/ace/theme-twilight.js +6 -104
  443. package/src/sap/ui/codeeditor/js/ace/theme-vibrant_ink.js +6 -89
  444. package/src/sap/ui/codeeditor/js/ace/theme-xcode.js +6 -83
  445. package/src/sap/ui/codeeditor/js/ace/worker-base.js +516 -595
  446. package/src/sap/ui/codeeditor/js/ace/worker-coffee.js +496 -575
  447. package/src/sap/ui/codeeditor/js/ace/worker-css.js +501 -578
  448. package/src/sap/ui/codeeditor/js/ace/worker-html.js +515 -584
  449. package/src/sap/ui/codeeditor/js/ace/worker-javascript.js +2964 -2551
  450. package/src/sap/ui/codeeditor/js/ace/worker-json.js +496 -575
  451. package/src/sap/ui/codeeditor/js/ace/worker-lua.js +497 -576
  452. package/src/sap/ui/codeeditor/js/ace/worker-php.js +2906 -2795
  453. package/src/sap/ui/codeeditor/js/ace/worker-xml.js +496 -575
  454. package/src/sap/ui/codeeditor/js/ace/worker-xquery.js +496 -575
  455. package/src/sap/ui/codeeditor/js/ace/worker-yaml.js +5851 -0
  456. package/src/sap/ui/codeeditor/library.js +6 -5
  457. package/LICENSES/BSD-2-Clause.txt +0 -22
@@ -1,437 +1,345 @@
1
- ace.define("ace/ext/menu_tools/get_editor_keyboard_shortcuts",[], function(require, exports, module) {
2
- "use strict";
3
- var keys = require("../../lib/keys");
4
- module.exports.getEditorKeybordShortcuts = function(editor) {
5
- var KEY_MODS = keys.KEY_MODS;
6
- var keybindings = [];
7
- var commandMap = {};
8
- editor.keyBinding.$handlers.forEach(function(handler) {
9
- var ckb = handler.commandKeyBinding;
10
- for (var i in ckb) {
11
- var key = i.replace(/(^|-)\w/g, function(x) { return x.toUpperCase(); });
12
- var commands = ckb[i];
13
- if (!Array.isArray(commands))
14
- commands = [commands];
15
- commands.forEach(function(command) {
16
- if (typeof command != "string")
17
- command = command.name;
18
- if (commandMap[command]) {
19
- commandMap[command].key += "|" + key;
20
- } else {
21
- commandMap[command] = {key: key, command: command};
22
- keybindings.push(commandMap[command]);
23
- }
24
- });
25
- }
26
- });
27
- return keybindings;
28
- };
29
-
30
- });
31
-
32
- ace.define("ace/autocomplete/popup",[], function(require, exports, module) {
33
- "use strict";
34
-
1
+ ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/config"], function(require, exports, module){"use strict";
35
2
  var Renderer = require("../virtual_renderer").VirtualRenderer;
36
3
  var Editor = require("../editor").Editor;
37
4
  var Range = require("../range").Range;
38
5
  var event = require("../lib/event");
39
6
  var lang = require("../lib/lang");
40
7
  var dom = require("../lib/dom");
41
-
42
- var $singleLineEditor = function(el) {
8
+ var nls = require("../config").nls;
9
+ var getAriaId = function (index) {
10
+ return "suggest-aria-id:".concat(index);
11
+ };
12
+ var $singleLineEditor = function (el) {
43
13
  var renderer = new Renderer(el);
44
-
45
14
  renderer.$maxLines = 4;
46
-
47
15
  var editor = new Editor(renderer);
48
-
49
16
  editor.setHighlightActiveLine(false);
50
17
  editor.setShowPrintMargin(false);
51
18
  editor.renderer.setShowGutter(false);
52
19
  editor.renderer.setHighlightGutterLine(false);
53
-
54
20
  editor.$mouseHandler.$focusTimeout = 0;
55
21
  editor.$highlightTagPending = true;
56
-
57
22
  return editor;
58
23
  };
59
-
60
- var AcePopup = function(parentNode) {
61
- var el = dom.createElement("div");
62
- var popup = new $singleLineEditor(el);
63
-
64
- if (parentNode)
65
- parentNode.appendChild(el);
66
- el.style.display = "none";
67
- popup.renderer.content.style.cursor = "default";
68
- popup.renderer.setStyle("ace_autocomplete");
69
-
70
- popup.setOption("displayIndentGuides", false);
71
- popup.setOption("dragDelay", 150);
72
-
73
- var noop = function(){};
74
-
75
- popup.focus = noop;
76
- popup.$isFocused = true;
77
-
78
- popup.renderer.$cursorLayer.restartTimer = noop;
79
- popup.renderer.$cursorLayer.element.style.opacity = 0;
80
-
81
- popup.renderer.$maxLines = 8;
82
- popup.renderer.$keepTextAreaAtCursor = false;
83
-
84
- popup.setHighlightActiveLine(false);
85
- popup.session.highlight("");
86
- popup.session.$searchHighlight.clazz = "ace_highlight-marker";
87
-
88
- popup.on("mousedown", function(e) {
89
- var pos = e.getDocumentPosition();
90
- popup.selection.moveToPosition(pos);
91
- selectionMarker.start.row = selectionMarker.end.row = pos.row;
92
- e.stop();
93
- });
94
-
95
- var lastMouseEvent;
96
- var hoverMarker = new Range(-1,0,-1,Infinity);
97
- var selectionMarker = new Range(-1,0,-1,Infinity);
98
- selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
99
- popup.setSelectOnHover = function(val) {
100
- if (!val) {
101
- hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
102
- } else if (hoverMarker.id) {
103
- popup.session.removeMarker(hoverMarker.id);
104
- hoverMarker.id = null;
105
- }
106
- };
107
- popup.setSelectOnHover(false);
108
- popup.on("mousemove", function(e) {
109
- if (!lastMouseEvent) {
110
- lastMouseEvent = e;
111
- return;
112
- }
113
- if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {
114
- return;
24
+ var AcePopup = /** @class */ (function () {
25
+ function AcePopup(parentNode) {
26
+ var el = dom.createElement("div");
27
+ var popup = new $singleLineEditor(el);
28
+ if (parentNode) {
29
+ parentNode.appendChild(el);
115
30
  }
116
- lastMouseEvent = e;
117
- lastMouseEvent.scrollTop = popup.renderer.scrollTop;
118
- var row = lastMouseEvent.getDocumentPosition().row;
119
- if (hoverMarker.start.row != row) {
120
- if (!hoverMarker.id)
121
- popup.setRow(row);
122
- setHoverMarker(row);
123
- }
124
- });
125
- popup.renderer.on("beforeRender", function() {
126
- if (lastMouseEvent && hoverMarker.start.row != -1) {
127
- lastMouseEvent.$pos = null;
31
+ el.style.display = "none";
32
+ popup.renderer.content.style.cursor = "default";
33
+ popup.renderer.setStyle("ace_autocomplete");
34
+ popup.renderer.$textLayer.element.setAttribute("role", "listbox");
35
+ popup.renderer.$textLayer.element.setAttribute("aria-label", nls("Autocomplete suggestions"));
36
+ popup.renderer.textarea.setAttribute("aria-hidden", "true");
37
+ popup.setOption("displayIndentGuides", false);
38
+ popup.setOption("dragDelay", 150);
39
+ var noop = function () { };
40
+ popup.focus = noop;
41
+ popup.$isFocused = true;
42
+ popup.renderer.$cursorLayer.restartTimer = noop;
43
+ popup.renderer.$cursorLayer.element.style.opacity = 0;
44
+ popup.renderer.$maxLines = 8;
45
+ popup.renderer.$keepTextAreaAtCursor = false;
46
+ popup.setHighlightActiveLine(false);
47
+ popup.session.highlight("");
48
+ popup.session.$searchHighlight.clazz = "ace_highlight-marker";
49
+ popup.on("mousedown", function (e) {
50
+ var pos = e.getDocumentPosition();
51
+ popup.selection.moveToPosition(pos);
52
+ selectionMarker.start.row = selectionMarker.end.row = pos.row;
53
+ e.stop();
54
+ });
55
+ var lastMouseEvent;
56
+ var hoverMarker = new Range(-1, 0, -1, Infinity);
57
+ var selectionMarker = new Range(-1, 0, -1, Infinity);
58
+ selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
59
+ popup.setSelectOnHover = function (val) {
60
+ if (!val) {
61
+ hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
62
+ }
63
+ else if (hoverMarker.id) {
64
+ popup.session.removeMarker(hoverMarker.id);
65
+ hoverMarker.id = null;
66
+ }
67
+ };
68
+ popup.setSelectOnHover(false);
69
+ popup.on("mousemove", function (e) {
70
+ if (!lastMouseEvent) {
71
+ lastMouseEvent = e;
72
+ return;
73
+ }
74
+ if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {
75
+ return;
76
+ }
77
+ lastMouseEvent = e;
78
+ lastMouseEvent.scrollTop = popup.renderer.scrollTop;
79
+ popup.isMouseOver = true;
128
80
  var row = lastMouseEvent.getDocumentPosition().row;
129
- if (!hoverMarker.id)
130
- popup.setRow(row);
131
- setHoverMarker(row, true);
132
- }
133
- });
134
- popup.renderer.on("afterRender", function() {
135
- var row = popup.getRow();
136
- var t = popup.renderer.$textLayer;
137
- var selected = t.element.childNodes[row - t.config.firstRow];
138
- if (selected !== t.selectedNode && t.selectedNode)
139
- dom.removeCssClass(t.selectedNode, "ace_selected");
140
- t.selectedNode = selected;
141
- if (selected)
142
- dom.addCssClass(selected, "ace_selected");
143
- });
144
- var hideHoverMarker = function() { setHoverMarker(-1); };
145
- var setHoverMarker = function(row, suppressRedraw) {
146
- if (row !== hoverMarker.start.row) {
147
- hoverMarker.start.row = hoverMarker.end.row = row;
148
- if (!suppressRedraw)
149
- popup.session._emit("changeBackMarker");
150
- popup._emit("changeHoverMarker");
151
- }
152
- };
153
- popup.getHoveredRow = function() {
154
- return hoverMarker.start.row;
155
- };
156
-
157
- event.addListener(popup.container, "mouseout", hideHoverMarker);
158
- popup.on("hide", hideHoverMarker);
159
- popup.on("changeSelection", hideHoverMarker);
160
-
161
- popup.session.doc.getLength = function() {
162
- return popup.data.length;
163
- };
164
- popup.session.doc.getLine = function(i) {
165
- var data = popup.data[i];
166
- if (typeof data == "string")
167
- return data;
168
- return (data && data.value) || "";
169
- };
170
-
171
- var bgTokenizer = popup.session.bgTokenizer;
172
- bgTokenizer.$tokenizeRow = function(row) {
173
- var data = popup.data[row];
174
- var tokens = [];
175
- if (!data)
81
+ if (hoverMarker.start.row != row) {
82
+ if (!hoverMarker.id)
83
+ popup.setRow(row);
84
+ setHoverMarker(row);
85
+ }
86
+ });
87
+ popup.renderer.on("beforeRender", function () {
88
+ if (lastMouseEvent && hoverMarker.start.row != -1) {
89
+ lastMouseEvent.$pos = null;
90
+ var row = lastMouseEvent.getDocumentPosition().row;
91
+ if (!hoverMarker.id)
92
+ popup.setRow(row);
93
+ setHoverMarker(row, true);
94
+ }
95
+ });
96
+ popup.renderer.on("afterRender", function () {
97
+ var row = popup.getRow();
98
+ var t = popup.renderer.$textLayer;
99
+ var selected = t.element.childNodes[row - t.config.firstRow];
100
+ var el = document.activeElement; // Active element is textarea of main editor
101
+ if (selected !== t.selectedNode && t.selectedNode) {
102
+ dom.removeCssClass(t.selectedNode, "ace_selected");
103
+ el.removeAttribute("aria-activedescendant");
104
+ t.selectedNode.removeAttribute("id");
105
+ }
106
+ t.selectedNode = selected;
107
+ if (selected) {
108
+ dom.addCssClass(selected, "ace_selected");
109
+ var ariaId = getAriaId(row);
110
+ selected.id = ariaId;
111
+ t.element.setAttribute("aria-activedescendant", ariaId);
112
+ el.setAttribute("aria-activedescendant", ariaId);
113
+ selected.setAttribute("role", "option");
114
+ selected.setAttribute("aria-label", popup.getData(row).value);
115
+ selected.setAttribute("aria-setsize", popup.data.length);
116
+ selected.setAttribute("aria-posinset", row + 1);
117
+ selected.setAttribute("aria-describedby", "doc-tooltip");
118
+ }
119
+ });
120
+ var hideHoverMarker = function () { setHoverMarker(-1); };
121
+ var setHoverMarker = function (row, suppressRedraw) {
122
+ if (row !== hoverMarker.start.row) {
123
+ hoverMarker.start.row = hoverMarker.end.row = row;
124
+ if (!suppressRedraw)
125
+ popup.session._emit("changeBackMarker");
126
+ popup._emit("changeHoverMarker");
127
+ }
128
+ };
129
+ popup.getHoveredRow = function () {
130
+ return hoverMarker.start.row;
131
+ };
132
+ event.addListener(popup.container, "mouseout", function () {
133
+ popup.isMouseOver = false;
134
+ hideHoverMarker();
135
+ });
136
+ popup.on("hide", hideHoverMarker);
137
+ popup.on("changeSelection", hideHoverMarker);
138
+ popup.session.doc.getLength = function () {
139
+ return popup.data.length;
140
+ };
141
+ popup.session.doc.getLine = function (i) {
142
+ var data = popup.data[i];
143
+ if (typeof data == "string")
144
+ return data;
145
+ return (data && data.value) || "";
146
+ };
147
+ var bgTokenizer = popup.session.bgTokenizer;
148
+ bgTokenizer.$tokenizeRow = function (row) {
149
+ var data = popup.data[row];
150
+ var tokens = [];
151
+ if (!data)
152
+ return tokens;
153
+ if (typeof data == "string")
154
+ data = { value: data };
155
+ var caption = data.caption || data.value || data.name;
156
+ function addToken(value, className) {
157
+ value && tokens.push({
158
+ type: (data.className || "") + (className || ""),
159
+ value: value
160
+ });
161
+ }
162
+ var lower = caption.toLowerCase();
163
+ var filterText = (popup.filterText || "").toLowerCase();
164
+ var lastIndex = 0;
165
+ var lastI = 0;
166
+ for (var i = 0; i <= filterText.length; i++) {
167
+ if (i != lastI && (data.matchMask & (1 << i) || i == filterText.length)) {
168
+ var sub = filterText.slice(lastI, i);
169
+ lastI = i;
170
+ var index = lower.indexOf(sub, lastIndex);
171
+ if (index == -1)
172
+ continue;
173
+ addToken(caption.slice(lastIndex, index), "");
174
+ lastIndex = index + sub.length;
175
+ addToken(caption.slice(index, lastIndex), "completion-highlight");
176
+ }
177
+ }
178
+ addToken(caption.slice(lastIndex, caption.length), "");
179
+ tokens.push({ type: "completion-spacer", value: " " });
180
+ if (data.meta)
181
+ tokens.push({ type: "completion-meta", value: data.meta });
182
+ if (data.message)
183
+ tokens.push({ type: "completion-message", value: data.message });
176
184
  return tokens;
177
- if (typeof data == "string")
178
- data = {value: data};
179
- var caption = data.caption || data.value || data.name;
180
-
181
- function addToken(value, className) {
182
- value && tokens.push({
183
- type: (data.className || "") + (className || ""),
184
- value: value
185
- });
186
- }
187
-
188
- var lower = caption.toLowerCase();
189
- var filterText = (popup.filterText || "").toLowerCase();
190
- var lastIndex = 0;
191
- var lastI = 0;
192
- for (var i = 0; i <= filterText.length; i++) {
193
- if (i != lastI && (data.matchMask & (1 << i) || i == filterText.length)) {
194
- var sub = filterText.slice(lastI, i);
195
- lastI = i;
196
- var index = lower.indexOf(sub, lastIndex);
197
- if (index == -1) continue;
198
- addToken(caption.slice(lastIndex, index), "");
199
- lastIndex = index + sub.length;
200
- addToken(caption.slice(index, lastIndex), "completion-highlight");
201
- }
202
- }
203
- addToken(caption.slice(lastIndex, caption.length), "");
204
-
205
- if (data.meta)
206
- tokens.push({type: "completion-meta", value: data.meta});
207
- if (data.message)
208
- tokens.push({type: "completion-message", value: data.message});
209
-
210
- return tokens;
211
- };
212
- bgTokenizer.$updateOnChange = noop;
213
- bgTokenizer.start = noop;
214
-
215
- popup.session.$computeWidth = function() {
216
- return this.screenWidth = 0;
217
- };
218
- popup.isOpen = false;
219
- popup.isTopdown = false;
220
- popup.autoSelect = true;
221
- popup.filterText = "";
222
-
223
- popup.data = [];
224
- popup.setData = function(list, filterText) {
225
- popup.filterText = filterText || "";
226
- popup.setValue(lang.stringRepeat("\n", list.length), -1);
227
- popup.data = list || [];
228
- popup.setRow(0);
229
- };
230
- popup.getData = function(row) {
231
- return popup.data[row];
232
- };
233
-
234
- popup.getRow = function() {
235
- return selectionMarker.start.row;
236
- };
237
- popup.setRow = function(line) {
238
- line = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length, line));
239
- if (selectionMarker.start.row != line) {
240
- popup.selection.clearSelection();
241
- selectionMarker.start.row = selectionMarker.end.row = line || 0;
242
- popup.session._emit("changeBackMarker");
243
- popup.moveCursorTo(line || 0, 0);
244
- if (popup.isOpen)
245
- popup._signal("select");
246
- }
247
- };
248
-
249
- popup.on("changeSelection", function() {
250
- if (popup.isOpen)
251
- popup.setRow(popup.selection.lead.row);
252
- popup.renderer.scrollCursorIntoView();
253
- });
254
-
255
- popup.hide = function() {
256
- this.container.style.display = "none";
257
- this._signal("hide");
185
+ };
186
+ bgTokenizer.$updateOnChange = noop;
187
+ bgTokenizer.start = noop;
188
+ popup.session.$computeWidth = function () {
189
+ return this.screenWidth = 0;
190
+ };
258
191
  popup.isOpen = false;
259
- };
260
- popup.show = function(pos, lineHeight, topdownOnly) {
261
- var el = this.container;
262
- var screenHeight = window.innerHeight;
263
- var screenWidth = window.innerWidth;
264
- var renderer = this.renderer;
265
- var maxH = renderer.$maxLines * lineHeight * 1.4;
266
- var top = pos.top + this.$borderSize;
267
- var allowTopdown = top > screenHeight / 2 && !topdownOnly;
268
- if (allowTopdown && top + lineHeight + maxH > screenHeight) {
269
- renderer.$maxPixelHeight = top - 2 * this.$borderSize;
270
- el.style.top = "";
271
- el.style.bottom = screenHeight - top + "px";
272
- popup.isTopdown = false;
273
- } else {
274
- top += lineHeight;
275
- renderer.$maxPixelHeight = screenHeight - top - 0.2 * lineHeight;
276
- el.style.top = top + "px";
277
- el.style.bottom = "";
278
- popup.isTopdown = true;
279
- }
280
-
281
- el.style.display = "";
282
-
283
- var left = pos.left;
284
- if (left + el.offsetWidth > screenWidth)
285
- left = screenWidth - el.offsetWidth;
286
-
287
- el.style.left = left + "px";
288
-
289
- this._signal("show");
290
- lastMouseEvent = null;
291
- popup.isOpen = true;
292
- };
293
-
294
- popup.goTo = function(where) {
295
- var row = this.getRow();
296
- var max = this.session.getLength() - 1;
297
-
298
- switch(where) {
299
- case "up": row = row <= 0 ? max : row - 1; break;
300
- case "down": row = row >= max ? -1 : row + 1; break;
301
- case "start": row = 0; break;
302
- case "end": row = max; break;
303
- }
304
-
305
- this.setRow(row);
306
- };
307
-
308
-
309
- popup.getTextLeftOffset = function() {
310
- return this.$borderSize + this.renderer.$padding + this.$imageSize;
311
- };
312
-
313
- popup.$imageSize = 0;
314
- popup.$borderSize = 1;
315
-
316
- return popup;
317
- };
318
-
319
- dom.importCssString("\
320
- .ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\
321
- background-color: #CAD6FA;\
322
- z-index: 1;\
323
- }\
324
- .ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\
325
- background-color: #3a674e;\
326
- }\
327
- .ace_editor.ace_autocomplete .ace_line-hover {\
328
- border: 1px solid #abbffe;\
329
- margin-top: -1px;\
330
- background: rgba(233,233,253,0.4);\
331
- position: absolute;\
332
- z-index: 2;\
333
- }\
334
- .ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\
335
- border: 1px solid rgba(109, 150, 13, 0.8);\
336
- background: rgba(58, 103, 78, 0.62);\
337
- }\
338
- .ace_completion-meta {\
339
- opacity: 0.5;\
340
- margin: 0.9em;\
341
- }\
342
- .ace_completion-message {\
343
- color: blue;\
344
- }\
345
- .ace_editor.ace_autocomplete .ace_completion-highlight{\
346
- color: #2d69c7;\
347
- }\
348
- .ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\
349
- color: #93ca12;\
350
- }\
351
- .ace_editor.ace_autocomplete {\
352
- width: 300px;\
353
- z-index: 200000;\
354
- border: 1px lightgray solid;\
355
- position: fixed;\
356
- box-shadow: 2px 3px 5px rgba(0,0,0,.2);\
357
- line-height: 1.4;\
358
- background: #fefefe;\
359
- color: #111;\
360
- }\
361
- .ace_dark.ace_editor.ace_autocomplete {\
362
- border: 1px #484747 solid;\
363
- box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\
364
- line-height: 1.4;\
365
- background: #25282c;\
366
- color: #c1c1c1;\
367
- }", "autocompletion.css", false);
368
-
369
- exports.AcePopup = AcePopup;
370
- exports.$singleLineEditor = $singleLineEditor;
371
- });
372
-
373
- ace.define("ace/autocomplete/util",[], function(require, exports, module) {
374
- "use strict";
375
-
376
- exports.parForEach = function(array, fn, callback) {
377
- var completed = 0;
378
- var arLength = array.length;
379
- if (arLength === 0)
380
- callback();
381
- for (var i = 0; i < arLength; i++) {
382
- fn(array[i], function(result, err) {
383
- completed++;
384
- if (completed === arLength)
385
- callback(result, err);
192
+ popup.isTopdown = false;
193
+ popup.autoSelect = true;
194
+ popup.filterText = "";
195
+ popup.isMouseOver = false;
196
+ popup.data = [];
197
+ popup.setData = function (list, filterText) {
198
+ popup.filterText = filterText || "";
199
+ popup.setValue(lang.stringRepeat("\n", list.length), -1);
200
+ popup.data = list || [];
201
+ popup.setRow(0);
202
+ };
203
+ popup.getData = function (row) {
204
+ return popup.data[row];
205
+ };
206
+ popup.getRow = function () {
207
+ return selectionMarker.start.row;
208
+ };
209
+ popup.setRow = function (line) {
210
+ line = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length - 1, line));
211
+ if (selectionMarker.start.row != line) {
212
+ popup.selection.clearSelection();
213
+ selectionMarker.start.row = selectionMarker.end.row = line || 0;
214
+ popup.session._emit("changeBackMarker");
215
+ popup.moveCursorTo(line || 0, 0);
216
+ if (popup.isOpen)
217
+ popup._signal("select");
218
+ }
219
+ };
220
+ popup.on("changeSelection", function () {
221
+ if (popup.isOpen)
222
+ popup.setRow(popup.selection.lead.row);
223
+ popup.renderer.scrollCursorIntoView();
386
224
  });
225
+ popup.hide = function () {
226
+ this.container.style.display = "none";
227
+ popup.anchorPos = null;
228
+ popup.anchor = null;
229
+ if (popup.isOpen) {
230
+ popup.isOpen = false;
231
+ this._signal("hide");
232
+ }
233
+ };
234
+ popup.tryShow = function (pos, lineHeight, anchor, forceShow) {
235
+ if (!forceShow && popup.isOpen && popup.anchorPos && popup.anchor &&
236
+ popup.anchorPos.top === pos.top && popup.anchorPos.left === pos.left &&
237
+ popup.anchor === anchor) {
238
+ return true;
239
+ }
240
+ var el = this.container;
241
+ var screenHeight = window.innerHeight;
242
+ var screenWidth = window.innerWidth;
243
+ var renderer = this.renderer;
244
+ var maxH = renderer.$maxLines * lineHeight * 1.4;
245
+ var dims = { top: 0, bottom: 0, left: 0 };
246
+ var spaceBelow = screenHeight - pos.top - 3 * this.$borderSize - lineHeight;
247
+ var spaceAbove = pos.top - 3 * this.$borderSize;
248
+ if (!anchor) {
249
+ if (spaceAbove <= spaceBelow || spaceBelow >= maxH) {
250
+ anchor = "bottom";
251
+ }
252
+ else {
253
+ anchor = "top";
254
+ }
255
+ }
256
+ if (anchor === "top") {
257
+ dims.bottom = pos.top - this.$borderSize;
258
+ dims.top = dims.bottom - maxH;
259
+ }
260
+ else if (anchor === "bottom") {
261
+ dims.top = pos.top + lineHeight + this.$borderSize;
262
+ dims.bottom = dims.top + maxH;
263
+ }
264
+ var fitsX = dims.top >= 0 && dims.bottom <= screenHeight;
265
+ if (!forceShow && !fitsX) {
266
+ return false;
267
+ }
268
+ if (!fitsX) {
269
+ if (anchor === "top") {
270
+ renderer.$maxPixelHeight = spaceAbove;
271
+ }
272
+ else {
273
+ renderer.$maxPixelHeight = spaceBelow;
274
+ }
275
+ }
276
+ else {
277
+ renderer.$maxPixelHeight = null;
278
+ }
279
+ if (anchor === "top") {
280
+ el.style.top = "";
281
+ el.style.bottom = (screenHeight - dims.bottom) + "px";
282
+ popup.isTopdown = false;
283
+ }
284
+ else {
285
+ el.style.top = dims.top + "px";
286
+ el.style.bottom = "";
287
+ popup.isTopdown = true;
288
+ }
289
+ el.style.display = "";
290
+ var left = pos.left;
291
+ if (left + el.offsetWidth > screenWidth)
292
+ left = screenWidth - el.offsetWidth;
293
+ el.style.left = left + "px";
294
+ el.style.right = "";
295
+ if (!popup.isOpen) {
296
+ popup.isOpen = true;
297
+ this._signal("show");
298
+ lastMouseEvent = null;
299
+ }
300
+ popup.anchorPos = pos;
301
+ popup.anchor = anchor;
302
+ return true;
303
+ };
304
+ popup.show = function (pos, lineHeight, topdownOnly) {
305
+ this.tryShow(pos, lineHeight, topdownOnly ? "bottom" : undefined, true);
306
+ };
307
+ popup.goTo = function (where) {
308
+ var row = this.getRow();
309
+ var max = this.session.getLength() - 1;
310
+ switch (where) {
311
+ case "up":
312
+ row = row <= 0 ? max : row - 1;
313
+ break;
314
+ case "down":
315
+ row = row >= max ? -1 : row + 1;
316
+ break;
317
+ case "start":
318
+ row = 0;
319
+ break;
320
+ case "end":
321
+ row = max;
322
+ break;
323
+ }
324
+ this.setRow(row);
325
+ };
326
+ popup.getTextLeftOffset = function () {
327
+ return this.$borderSize + this.renderer.$padding + this.$imageSize;
328
+ };
329
+ popup.$imageSize = 0;
330
+ popup.$borderSize = 1;
331
+ return popup;
387
332
  }
388
- };
389
-
390
- var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;
391
-
392
- exports.retrievePrecedingIdentifier = function(text, pos, regex) {
393
- regex = regex || ID_REGEX;
394
- var buf = [];
395
- for (var i = pos-1; i >= 0; i--) {
396
- if (regex.test(text[i]))
397
- buf.push(text[i]);
398
- else
399
- break;
400
- }
401
- return buf.reverse().join("");
402
- };
403
-
404
- exports.retrieveFollowingIdentifier = function(text, pos, regex) {
405
- regex = regex || ID_REGEX;
406
- var buf = [];
407
- for (var i = pos; i < text.length; i++) {
408
- if (regex.test(text[i]))
409
- buf.push(text[i]);
410
- else
411
- break;
412
- }
413
- return buf;
414
- };
415
-
416
- exports.getCompletionPrefix = function (editor) {
417
- var pos = editor.getCursorPosition();
418
- var line = editor.session.getLine(pos.row);
419
- var prefix;
420
- editor.completers.forEach(function(completer) {
421
- if (completer.identifierRegexps) {
422
- completer.identifierRegexps.forEach(function(identifierRegex) {
423
- if (!prefix && identifierRegex)
424
- prefix = this.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
425
- }.bind(this));
426
- }
427
- }.bind(this));
428
- return prefix || this.retrievePrecedingIdentifier(line, pos.column);
429
- };
333
+ return AcePopup;
334
+ }());
335
+ dom.importCssString("\n.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #CAD6FA;\n z-index: 1;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #3a674e;\n}\n.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid #abbffe;\n margin-top: -1px;\n background: rgba(233,233,253,0.4);\n position: absolute;\n z-index: 2;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid rgba(109, 150, 13, 0.8);\n background: rgba(58, 103, 78, 0.62);\n}\n.ace_completion-meta {\n opacity: 0.5;\n margin-left: 0.9em;\n}\n.ace_completion-message {\n margin-left: 0.9em;\n color: blue;\n}\n.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #2d69c7;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #93ca12;\n}\n.ace_editor.ace_autocomplete {\n width: 300px;\n z-index: 200000;\n border: 1px lightgray solid;\n position: fixed;\n box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n line-height: 1.4;\n background: #fefefe;\n color: #111;\n}\n.ace_dark.ace_editor.ace_autocomplete {\n border: 1px #484747 solid;\n box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\n line-height: 1.4;\n background: #25282c;\n color: #c1c1c1;\n}\n.ace_autocomplete .ace_text-layer {\n width: calc(100% - 8px);\n}\n.ace_autocomplete .ace_line {\n display: flex;\n align-items: center;\n}\n.ace_autocomplete .ace_line > * {\n min-width: 0;\n flex: 0 0 auto;\n}\n.ace_autocomplete .ace_line .ace_ {\n flex: 0 1 auto;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.ace_autocomplete .ace_completion-spacer {\n flex: 1;\n}\n.ace_autocomplete.ace_loading:after {\n content: \"\";\n position: absolute;\n top: 0px;\n height: 2px;\n width: 8%;\n background: blue;\n z-index: 100;\n animation: ace_progress 3s infinite linear;\n animation-delay: 300ms;\n transform: translateX(-100%) scaleX(1);\n}\n@keyframes ace_progress {\n 0% { transform: translateX(-100%) scaleX(1) }\n 50% { transform: translateX(625%) scaleX(2) } \n 100% { transform: translateX(1500%) scaleX(3) } \n}\n@media (prefers-reduced-motion) {\n .ace_autocomplete.ace_loading:after {\n transform: translateX(625%) scaleX(2);\n animation: none;\n }\n}\n", "autocompletion.css", false);
336
+ exports.AcePopup = AcePopup;
337
+ exports.$singleLineEditor = $singleLineEditor;
338
+ exports.getAriaId = getAriaId;
430
339
 
431
340
  });
432
341
 
433
- ace.define("ace/snippets",[], function(require, exports, module) {
434
- "use strict";
342
+ 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){"use strict";
435
343
  var dom = require("./lib/dom");
436
344
  var oop = require("./lib/oop");
437
345
  var EventEmitter = require("./lib/event_emitter").EventEmitter;
@@ -441,107 +349,100 @@ var RangeList = require("./range_list").RangeList;
441
349
  var HashHandler = require("./keyboard/hash_handler").HashHandler;
442
350
  var Tokenizer = require("./tokenizer").Tokenizer;
443
351
  var clipboard = require("./clipboard");
444
-
445
352
  var VARIABLES = {
446
- CURRENT_WORD: function(editor) {
353
+ CURRENT_WORD: function (editor) {
447
354
  return editor.session.getTextRange(editor.session.getWordRange());
448
355
  },
449
- SELECTION: function(editor, name, indentation) {
356
+ SELECTION: function (editor, name, indentation) {
450
357
  var text = editor.session.getTextRange();
451
358
  if (indentation)
452
359
  return text.replace(/\n\r?([ \t]*\S)/g, "\n" + indentation + "$1");
453
360
  return text;
454
361
  },
455
- CURRENT_LINE: function(editor) {
362
+ CURRENT_LINE: function (editor) {
456
363
  return editor.session.getLine(editor.getCursorPosition().row);
457
364
  },
458
- PREV_LINE: function(editor) {
365
+ PREV_LINE: function (editor) {
459
366
  return editor.session.getLine(editor.getCursorPosition().row - 1);
460
367
  },
461
- LINE_INDEX: function(editor) {
368
+ LINE_INDEX: function (editor) {
462
369
  return editor.getCursorPosition().row;
463
370
  },
464
- LINE_NUMBER: function(editor) {
371
+ LINE_NUMBER: function (editor) {
465
372
  return editor.getCursorPosition().row + 1;
466
373
  },
467
- SOFT_TABS: function(editor) {
374
+ SOFT_TABS: function (editor) {
468
375
  return editor.session.getUseSoftTabs() ? "YES" : "NO";
469
376
  },
470
- TAB_SIZE: function(editor) {
377
+ TAB_SIZE: function (editor) {
471
378
  return editor.session.getTabSize();
472
379
  },
473
- CLIPBOARD: function(editor) {
380
+ CLIPBOARD: function (editor) {
474
381
  return clipboard.getText && clipboard.getText();
475
382
  },
476
- FILENAME: function(editor) {
383
+ FILENAME: function (editor) {
477
384
  return /[^/\\]*$/.exec(this.FILEPATH(editor))[0];
478
385
  },
479
- FILENAME_BASE: function(editor) {
386
+ FILENAME_BASE: function (editor) {
480
387
  return /[^/\\]*$/.exec(this.FILEPATH(editor))[0].replace(/\.[^.]*$/, "");
481
388
  },
482
- DIRECTORY: function(editor) {
389
+ DIRECTORY: function (editor) {
483
390
  return this.FILEPATH(editor).replace(/[^/\\]*$/, "");
484
391
  },
485
- FILEPATH: function(editor) { return "/not implemented.txt"; },
486
- WORKSPACE_NAME: function() { return "Unknown"; },
487
- FULLNAME: function() { return "Unknown"; },
488
- BLOCK_COMMENT_START: function(editor) {
392
+ FILEPATH: function (editor) { return "/not implemented.txt"; },
393
+ WORKSPACE_NAME: function () { return "Unknown"; },
394
+ FULLNAME: function () { return "Unknown"; },
395
+ BLOCK_COMMENT_START: function (editor) {
489
396
  var mode = editor.session.$mode || {};
490
397
  return mode.blockComment && mode.blockComment.start || "";
491
398
  },
492
- BLOCK_COMMENT_END: function(editor) {
399
+ BLOCK_COMMENT_END: function (editor) {
493
400
  var mode = editor.session.$mode || {};
494
401
  return mode.blockComment && mode.blockComment.end || "";
495
402
  },
496
- LINE_COMMENT: function(editor) {
403
+ LINE_COMMENT: function (editor) {
497
404
  var mode = editor.session.$mode || {};
498
405
  return mode.lineCommentStart || "";
499
406
  },
500
- CURRENT_YEAR: date.bind(null, {year: "numeric"}),
501
- CURRENT_YEAR_SHORT: date.bind(null, {year: "2-digit"}),
502
- CURRENT_MONTH: date.bind(null, {month: "numeric"}),
503
- CURRENT_MONTH_NAME: date.bind(null, {month: "long"}),
504
- CURRENT_MONTH_NAME_SHORT: date.bind(null, {month: "short"}),
505
- CURRENT_DATE: date.bind(null, {day: "2-digit"}),
506
- CURRENT_DAY_NAME: date.bind(null, {weekday: "long"}),
507
- CURRENT_DAY_NAME_SHORT: date.bind(null, {weekday: "short"}),
508
- CURRENT_HOUR: date.bind(null, {hour: "2-digit", hour12: false}),
509
- CURRENT_MINUTE: date.bind(null, {minute: "2-digit"}),
510
- CURRENT_SECOND: date.bind(null, {second: "2-digit"})
407
+ CURRENT_YEAR: date.bind(null, { year: "numeric" }),
408
+ CURRENT_YEAR_SHORT: date.bind(null, { year: "2-digit" }),
409
+ CURRENT_MONTH: date.bind(null, { month: "numeric" }),
410
+ CURRENT_MONTH_NAME: date.bind(null, { month: "long" }),
411
+ CURRENT_MONTH_NAME_SHORT: date.bind(null, { month: "short" }),
412
+ CURRENT_DATE: date.bind(null, { day: "2-digit" }),
413
+ CURRENT_DAY_NAME: date.bind(null, { weekday: "long" }),
414
+ CURRENT_DAY_NAME_SHORT: date.bind(null, { weekday: "short" }),
415
+ CURRENT_HOUR: date.bind(null, { hour: "2-digit", hour12: false }),
416
+ CURRENT_MINUTE: date.bind(null, { minute: "2-digit" }),
417
+ CURRENT_SECOND: date.bind(null, { second: "2-digit" })
511
418
  };
512
-
513
419
  VARIABLES.SELECTED_TEXT = VARIABLES.SELECTION;
514
-
515
420
  function date(dateFormat) {
516
421
  var str = new Date().toLocaleString("en-us", dateFormat);
517
422
  return str.length == 1 ? "0" + str : str;
518
423
  }
519
-
520
- var SnippetManager = function() {
521
- this.snippetMap = {};
522
- this.snippetNameMap = {};
523
- };
524
-
525
- (function() {
526
- oop.implement(this, EventEmitter);
527
-
528
- this.getTokenizer = function() {
424
+ var SnippetManager = /** @class */ (function () {
425
+ function SnippetManager() {
426
+ this.snippetMap = {};
427
+ this.snippetNameMap = {};
428
+ this.variables = VARIABLES;
429
+ }
430
+ SnippetManager.prototype.getTokenizer = function () {
529
431
  return SnippetManager.$tokenizer || this.createTokenizer();
530
432
  };
531
-
532
- this.createTokenizer = function() {
433
+ SnippetManager.prototype.createTokenizer = function () {
533
434
  function TabstopToken(str) {
534
435
  str = str.substr(1);
535
436
  if (/^\d+$/.test(str))
536
- return [{tabstopId: parseInt(str, 10)}];
537
- return [{text: str}];
437
+ return [{ tabstopId: parseInt(str, 10) }];
438
+ return [{ text: str }];
538
439
  }
539
440
  function escape(ch) {
540
441
  return "(?:[^\\\\" + ch + "]|\\\\.)";
541
442
  }
542
443
  var formatMatcher = {
543
- regex: "/(" + escape("/") + "+)/",
544
- onMatch: function(val, state, stack) {
444
+ regex: "/(" + escape("/") + "+)/",
445
+ onMatch: function (val, state, stack) {
545
446
  var ts = stack[0];
546
447
  ts.fmtString = true;
547
448
  ts.guard = val.slice(1, -1);
@@ -550,118 +451,115 @@ var SnippetManager = function() {
550
451
  },
551
452
  next: "formatString"
552
453
  };
553
-
554
454
  SnippetManager.$tokenizer = new Tokenizer({
555
455
  start: [
556
- {regex: /\\./, onMatch: function(val, state, stack) {
557
- var ch = val[1];
558
- if (ch == "}" && stack.length) {
559
- val = ch;
560
- } else if ("`$\\".indexOf(ch) != -1) {
561
- val = ch;
562
- }
563
- return [val];
564
- }},
565
- {regex: /}/, onMatch: function(val, state, stack) {
566
- return [stack.length ? stack.shift() : val];
567
- }},
568
- {regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken},
569
- {regex: /\$\{[\dA-Z_a-z]+/, onMatch: function(str, state, stack) {
570
- var t = TabstopToken(str.substr(1));
571
- stack.unshift(t[0]);
572
- return t;
573
- }, next: "snippetVar"},
574
- {regex: /\n/, token: "newline", merge: false}
456
+ { regex: /\\./, onMatch: function (val, state, stack) {
457
+ var ch = val[1];
458
+ if (ch == "}" && stack.length) {
459
+ val = ch;
460
+ }
461
+ else if ("`$\\".indexOf(ch) != -1) {
462
+ val = ch;
463
+ }
464
+ return [val];
465
+ } },
466
+ { regex: /}/, onMatch: function (val, state, stack) {
467
+ return [stack.length ? stack.shift() : val];
468
+ } },
469
+ { regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken },
470
+ { regex: /\$\{[\dA-Z_a-z]+/, onMatch: function (str, state, stack) {
471
+ var t = TabstopToken(str.substr(1));
472
+ stack.unshift(t[0]);
473
+ return t;
474
+ }, next: "snippetVar" },
475
+ { regex: /\n/, token: "newline", merge: false }
575
476
  ],
576
477
  snippetVar: [
577
- {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) {
578
- var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function(operator) {
579
- return operator.length == 2 ? operator[1] : "\x00";
580
- }).split("\x00").map(function(value){
581
- return {value: value};
582
- });
583
- stack[0].choices = choices;
584
- return [choices[0]];
585
- }, next: "start"},
478
+ { regex: "\\|" + escape("\\|") + "*\\|", onMatch: function (val, state, stack) {
479
+ var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function (operator) {
480
+ return operator.length == 2 ? operator[1] : "\x00";
481
+ }).split("\x00").map(function (value) {
482
+ return { value: value };
483
+ });
484
+ stack[0].choices = choices;
485
+ return [choices[0]];
486
+ }, next: "start" },
586
487
  formatMatcher,
587
- {regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start"}
488
+ { regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start" }
588
489
  ],
589
490
  formatString: [
590
- {regex: /:/, onMatch: function(val, state, stack) {
591
- if (stack.length && stack[0].expectElse) {
592
- stack[0].expectElse = false;
593
- stack[0].ifEnd = {elseEnd: stack[0]};
594
- return [stack[0].ifEnd];
595
- }
596
- return ":";
597
- }},
598
- {regex: /\\./, onMatch: function(val, state, stack) {
599
- var ch = val[1];
600
- if (ch == "}" && stack.length)
601
- val = ch;
602
- else if ("`$\\".indexOf(ch) != -1)
603
- val = ch;
604
- else if (ch == "n")
605
- val = "\n";
606
- else if (ch == "t")
607
- val = "\t";
608
- else if ("ulULE".indexOf(ch) != -1)
609
- val = {changeCase: ch, local: ch > "a"};
610
- return [val];
611
- }},
612
- {regex: "/\\w*}", onMatch: function(val, state, stack) {
613
- var next = stack.shift();
614
- if (next)
615
- next.flag = val.slice(1, -1);
616
- this.next = next && next.tabstopId ? "start" : "";
617
- return [next || val];
618
- }, next: "start"},
619
- {regex: /\$(?:\d+|\w+)/, onMatch: function(val, state, stack) {
620
- return [{text: val.slice(1)}];
621
- }},
622
- {regex: /\${\w+/, onMatch: function(val, state, stack) {
623
- var token = {text: val.slice(2)};
624
- stack.unshift(token);
625
- return [token];
626
- }, next: "formatStringVar"},
627
- {regex: /\n/, token: "newline", merge: false},
628
- {regex: /}/, onMatch: function(val, state, stack) {
629
- var next = stack.shift();
630
- this.next = next && next.tabstopId ? "start" : "";
631
- return [next || val];
632
- }, next: "start"}
491
+ { regex: /:/, onMatch: function (val, state, stack) {
492
+ if (stack.length && stack[0].expectElse) {
493
+ stack[0].expectElse = false;
494
+ stack[0].ifEnd = { elseEnd: stack[0] };
495
+ return [stack[0].ifEnd];
496
+ }
497
+ return ":";
498
+ } },
499
+ { regex: /\\./, onMatch: function (val, state, stack) {
500
+ var ch = val[1];
501
+ if (ch == "}" && stack.length)
502
+ val = ch;
503
+ else if ("`$\\".indexOf(ch) != -1)
504
+ val = ch;
505
+ else if (ch == "n")
506
+ val = "\n";
507
+ else if (ch == "t")
508
+ val = "\t";
509
+ else if ("ulULE".indexOf(ch) != -1)
510
+ val = { changeCase: ch, local: ch > "a" };
511
+ return [val];
512
+ } },
513
+ { regex: "/\\w*}", onMatch: function (val, state, stack) {
514
+ var next = stack.shift();
515
+ if (next)
516
+ next.flag = val.slice(1, -1);
517
+ this.next = next && next.tabstopId ? "start" : "";
518
+ return [next || val];
519
+ }, next: "start" },
520
+ { regex: /\$(?:\d+|\w+)/, onMatch: function (val, state, stack) {
521
+ return [{ text: val.slice(1) }];
522
+ } },
523
+ { regex: /\${\w+/, onMatch: function (val, state, stack) {
524
+ var token = { text: val.slice(2) };
525
+ stack.unshift(token);
526
+ return [token];
527
+ }, next: "formatStringVar" },
528
+ { regex: /\n/, token: "newline", merge: false },
529
+ { regex: /}/, onMatch: function (val, state, stack) {
530
+ var next = stack.shift();
531
+ this.next = next && next.tabstopId ? "start" : "";
532
+ return [next || val];
533
+ }, next: "start" }
633
534
  ],
634
535
  formatStringVar: [
635
- {regex: /:\/\w+}/, onMatch: function(val, state, stack) {
636
- var ts = stack[0];
637
- ts.formatFunction = val.slice(2, -1);
638
- return [stack.shift()];
639
- }, next: "formatString"},
536
+ { regex: /:\/\w+}/, onMatch: function (val, state, stack) {
537
+ var ts = stack[0];
538
+ ts.formatFunction = val.slice(2, -1);
539
+ return [stack.shift()];
540
+ }, next: "formatString" },
640
541
  formatMatcher,
641
- {regex: /:[\?\-+]?/, onMatch: function(val, state, stack) {
642
- if (val[1] == "+")
643
- stack[0].ifEnd = stack[0];
644
- if (val[1] == "?")
645
- stack[0].expectElse = true;
646
- }, next: "formatString"},
647
- {regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "formatString"}
542
+ { regex: /:[\?\-+]?/, onMatch: function (val, state, stack) {
543
+ if (val[1] == "+")
544
+ stack[0].ifEnd = stack[0];
545
+ if (val[1] == "?")
546
+ stack[0].expectElse = true;
547
+ }, next: "formatString" },
548
+ { regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "formatString" }
648
549
  ]
649
550
  });
650
551
  return SnippetManager.$tokenizer;
651
552
  };
652
-
653
- this.tokenizeTmSnippet = function(str, startState) {
654
- return this.getTokenizer().getLineTokens(str, startState).tokens.map(function(x) {
553
+ SnippetManager.prototype.tokenizeTmSnippet = function (str, startState) {
554
+ return this.getTokenizer().getLineTokens(str, startState).tokens.map(function (x) {
655
555
  return x.value || x;
656
556
  });
657
557
  };
658
-
659
- this.getVariableValue = function(editor, name, indentation) {
558
+ SnippetManager.prototype.getVariableValue = function (editor, name, indentation) {
660
559
  if (/^\d+$/.test(name))
661
560
  return (this.variables.__ || {})[name] || "";
662
561
  if (/^[A-Z]\d+$/.test(name))
663
562
  return (this.variables[name[0] + "__"] || {})[name.substr(1)] || "";
664
-
665
563
  name = name.replace(/^TM_/, "");
666
564
  if (!this.variables.hasOwnProperty(name))
667
565
  return "";
@@ -670,21 +568,20 @@ var SnippetManager = function() {
670
568
  value = this.variables[name](editor, name, indentation);
671
569
  return value == null ? "" : value;
672
570
  };
673
-
674
- this.variables = VARIABLES;
675
- this.tmStrFormat = function(str, ch, editor) {
676
- if (!ch.fmt) return str;
571
+ SnippetManager.prototype.tmStrFormat = function (str, ch, editor) {
572
+ if (!ch.fmt)
573
+ return str;
677
574
  var flag = ch.flag || "";
678
575
  var re = ch.guard;
679
576
  re = new RegExp(re, flag.replace(/[^gim]/g, ""));
680
577
  var fmtTokens = typeof ch.fmt == "string" ? this.tokenizeTmSnippet(ch.fmt, "formatString") : ch.fmt;
681
578
  var _self = this;
682
- var formatted = str.replace(re, function() {
579
+ var formatted = str.replace(re, function () {
683
580
  var oldArgs = _self.variables.__;
684
581
  _self.variables.__ = [].slice.call(arguments);
685
582
  var fmtParts = _self.resolveVariables(fmtTokens, editor);
686
583
  var gChangeCase = "E";
687
- for (var i = 0; i < fmtParts.length; i++) {
584
+ for (var i = 0; i < fmtParts.length; i++) {
688
585
  var ch = fmtParts[i];
689
586
  if (typeof ch == "object") {
690
587
  fmtParts[i] = "";
@@ -697,12 +594,15 @@ var SnippetManager = function() {
697
594
  fmtParts[i] = next[0].toLowerCase();
698
595
  fmtParts[i + 1] = next.substr(1);
699
596
  }
700
- } else if (ch.changeCase) {
597
+ }
598
+ else if (ch.changeCase) {
701
599
  gChangeCase = ch.changeCase;
702
600
  }
703
- } else if (gChangeCase == "U") {
601
+ }
602
+ else if (gChangeCase == "U") {
704
603
  fmtParts[i] = ch.toUpperCase();
705
- } else if (gChangeCase == "L") {
604
+ }
605
+ else if (gChangeCase == "L") {
706
606
  fmtParts[i] = ch.toLowerCase();
707
607
  }
708
608
  }
@@ -711,16 +611,14 @@ var SnippetManager = function() {
711
611
  });
712
612
  return formatted;
713
613
  };
714
-
715
- this.tmFormatFunction = function(str, ch, editor) {
614
+ SnippetManager.prototype.tmFormatFunction = function (str, ch, editor) {
716
615
  if (ch.formatFunction == "upcase")
717
616
  return str.toUpperCase();
718
617
  if (ch.formatFunction == "downcase")
719
618
  return str.toLowerCase();
720
619
  return str;
721
620
  };
722
-
723
- this.resolveVariables = function(snippet, editor) {
621
+ SnippetManager.prototype.resolveVariables = function (snippet, editor) {
724
622
  var result = [];
725
623
  var indentation = "";
726
624
  var afterNewLine = true;
@@ -738,34 +636,37 @@ var SnippetManager = function() {
738
636
  }
739
637
  continue;
740
638
  }
741
- if (!ch) continue;
639
+ if (!ch)
640
+ continue;
742
641
  afterNewLine = false;
743
-
744
642
  if (ch.fmtString) {
745
643
  var j = snippet.indexOf(ch, i + 1);
746
- if (j == -1) j = snippet.length;
644
+ if (j == -1)
645
+ j = snippet.length;
747
646
  ch.fmt = snippet.slice(i + 1, j);
748
647
  i = j;
749
648
  }
750
-
751
649
  if (ch.text) {
752
650
  var value = this.getVariableValue(editor, ch.text, indentation) + "";
753
651
  if (ch.fmtString)
754
652
  value = this.tmStrFormat(value, ch, editor);
755
653
  if (ch.formatFunction)
756
654
  value = this.tmFormatFunction(value, ch, editor);
757
-
758
655
  if (value && !ch.ifEnd) {
759
656
  result.push(value);
760
657
  gotoNext(ch);
761
- } else if (!value && ch.ifEnd) {
658
+ }
659
+ else if (!value && ch.ifEnd) {
762
660
  gotoNext(ch.ifEnd);
763
661
  }
764
- } else if (ch.elseEnd) {
662
+ }
663
+ else if (ch.elseEnd) {
765
664
  gotoNext(ch.elseEnd);
766
- } else if (ch.tabstopId != null) {
665
+ }
666
+ else if (ch.tabstopId != null) {
767
667
  result.push(ch);
768
- } else if (ch.changeCase != null) {
668
+ }
669
+ else if (ch.changeCase != null) {
769
670
  result.push(ch);
770
671
  }
771
672
  }
@@ -776,142 +677,35 @@ var SnippetManager = function() {
776
677
  }
777
678
  return result;
778
679
  };
779
-
780
- this.insertSnippetForSelection = function(editor, snippetText) {
781
- var cursor = editor.getCursorPosition();
782
- var line = editor.session.getLine(cursor.row);
783
- var tabString = editor.session.getTabString();
784
- var indentString = line.match(/^\s*/)[0];
785
-
786
- if (cursor.column < indentString.length)
787
- indentString = indentString.slice(0, cursor.column);
788
-
789
- snippetText = snippetText.replace(/\r/g, "");
790
- var tokens = this.tokenizeTmSnippet(snippetText);
791
- tokens = this.resolveVariables(tokens, editor);
792
- tokens = tokens.map(function(x) {
793
- if (x == "\n")
794
- return x + indentString;
795
- if (typeof x == "string")
796
- return x.replace(/\t/g, tabString);
797
- return x;
798
- });
799
- var tabstops = [];
800
- tokens.forEach(function(p, i) {
801
- if (typeof p != "object")
802
- return;
803
- var id = p.tabstopId;
804
- var ts = tabstops[id];
805
- if (!ts) {
806
- ts = tabstops[id] = [];
807
- ts.index = id;
808
- ts.value = "";
809
- ts.parents = {};
810
- }
811
- if (ts.indexOf(p) !== -1)
812
- return;
813
- if (p.choices && !ts.choices)
814
- ts.choices = p.choices;
815
- ts.push(p);
816
- var i1 = tokens.indexOf(p, i + 1);
817
- if (i1 === -1)
818
- return;
819
-
820
- var value = tokens.slice(i + 1, i1);
821
- var isNested = value.some(function(t) {return typeof t === "object";});
822
- if (isNested && !ts.value) {
823
- ts.value = value;
824
- } else if (value.length && (!ts.value || typeof ts.value !== "string")) {
825
- ts.value = value.join("");
826
- }
827
- });
828
- tabstops.forEach(function(ts) {ts.length = 0;});
829
- var expanding = {};
830
- function copyValue(val) {
831
- var copy = [];
832
- for (var i = 0; i < val.length; i++) {
833
- var p = val[i];
834
- if (typeof p == "object") {
835
- if (expanding[p.tabstopId])
836
- continue;
837
- var j = val.lastIndexOf(p, i - 1);
838
- p = copy[j] || {tabstopId: p.tabstopId};
839
- }
840
- copy[i] = p;
841
- }
842
- return copy;
843
- }
844
- for (var i = 0; i < tokens.length; i++) {
845
- var p = tokens[i];
846
- if (typeof p != "object")
847
- continue;
848
- var id = p.tabstopId;
849
- var ts = tabstops[id];
850
- var i1 = tokens.indexOf(p, i + 1);
851
- if (expanding[id]) {
852
- if (expanding[id] === p) {
853
- delete expanding[id];
854
- Object.keys(expanding).forEach(function(parentId) {
855
- ts.parents[parentId] = true;
856
- });
857
- }
858
- continue;
859
- }
860
- expanding[id] = p;
861
- var value = ts.value;
862
- if (typeof value !== "string")
863
- value = copyValue(value);
864
- else if (p.fmt)
865
- value = this.tmStrFormat(value, p, editor);
866
- tokens.splice.apply(tokens, [i + 1, Math.max(0, i1 - i)].concat(value, p));
867
-
868
- if (ts.indexOf(p) === -1)
869
- ts.push(p);
870
- }
871
- var row = 0, column = 0;
872
- var text = "";
873
- tokens.forEach(function(t) {
874
- if (typeof t === "string") {
875
- var lines = t.split("\n");
876
- if (lines.length > 1){
877
- column = lines[lines.length - 1].length;
878
- row += lines.length - 1;
879
- } else
880
- column += t.length;
881
- text += t;
882
- } else if (t) {
883
- if (!t.start)
884
- t.start = {row: row, column: column};
885
- else
886
- t.end = {row: row, column: column};
887
- }
888
- });
680
+ SnippetManager.prototype.getDisplayTextForSnippet = function (editor, snippetText) {
681
+ var processedSnippet = processSnippetText.call(this, editor, snippetText);
682
+ return processedSnippet.text;
683
+ };
684
+ SnippetManager.prototype.insertSnippetForSelection = function (editor, snippetText, options) {
685
+ if (options === void 0) { options = {}; }
686
+ var processedSnippet = processSnippetText.call(this, editor, snippetText, options);
889
687
  var range = editor.getSelectionRange();
890
- var end = editor.session.replace(range, text);
891
-
688
+ var end = editor.session.replace(range, processedSnippet.text);
892
689
  var tabstopManager = new TabstopManager(editor);
893
690
  var selectionId = editor.inVirtualSelectionMode && editor.selection.index;
894
- tabstopManager.addTabstops(tabstops, range.start, end, selectionId);
691
+ tabstopManager.addTabstops(processedSnippet.tabstops, range.start, end, selectionId);
895
692
  };
896
-
897
- this.insertSnippet = function(editor, snippetText) {
693
+ SnippetManager.prototype.insertSnippet = function (editor, snippetText, options) {
694
+ if (options === void 0) { options = {}; }
898
695
  var self = this;
899
696
  if (editor.inVirtualSelectionMode)
900
- return self.insertSnippetForSelection(editor, snippetText);
901
-
902
- editor.forEachSelection(function() {
903
- self.insertSnippetForSelection(editor, snippetText);
904
- }, null, {keepOrder: true});
905
-
697
+ return self.insertSnippetForSelection(editor, snippetText, options);
698
+ editor.forEachSelection(function () {
699
+ self.insertSnippetForSelection(editor, snippetText, options);
700
+ }, null, { keepOrder: true });
906
701
  if (editor.tabstopManager)
907
702
  editor.tabstopManager.tabNext();
908
703
  };
909
-
910
- this.$getScope = function(editor) {
704
+ SnippetManager.prototype.$getScope = function (editor) {
911
705
  var scope = editor.session.$mode.$id || "";
912
706
  scope = scope.split("/").pop();
913
707
  if (scope === "html" || scope === "php") {
914
- if (scope === "php" && !editor.session.$mode.inlinePhp)
708
+ if (scope === "php" && !editor.session.$mode.inlinePhp)
915
709
  scope = "html";
916
710
  var c = editor.getCursorPosition();
917
711
  var state = editor.session.getState(c.row);
@@ -927,11 +721,9 @@ var SnippetManager = function() {
927
721
  scope = "php";
928
722
  }
929
723
  }
930
-
931
724
  return scope;
932
725
  };
933
-
934
- this.getActiveScopes = function(editor) {
726
+ SnippetManager.prototype.getActiveScopes = function (editor) {
935
727
  var scope = this.$getScope(editor);
936
728
  var scopes = [scope];
937
729
  var snippetMap = this.snippetMap;
@@ -941,26 +733,23 @@ var SnippetManager = function() {
941
733
  scopes.push("_");
942
734
  return scopes;
943
735
  };
944
-
945
- this.expandWithTab = function(editor, options) {
736
+ SnippetManager.prototype.expandWithTab = function (editor, options) {
946
737
  var self = this;
947
- var result = editor.forEachSelection(function() {
738
+ var result = editor.forEachSelection(function () {
948
739
  return self.expandSnippetForSelection(editor, options);
949
- }, null, {keepOrder: true});
740
+ }, null, { keepOrder: true });
950
741
  if (result && editor.tabstopManager)
951
742
  editor.tabstopManager.tabNext();
952
743
  return result;
953
744
  };
954
-
955
- this.expandSnippetForSelection = function(editor, options) {
745
+ SnippetManager.prototype.expandSnippetForSelection = function (editor, options) {
956
746
  var cursor = editor.getCursorPosition();
957
747
  var line = editor.session.getLine(cursor.row);
958
748
  var before = line.substring(0, cursor.column);
959
749
  var after = line.substr(cursor.column);
960
-
961
750
  var snippetMap = this.snippetMap;
962
751
  var snippet;
963
- this.getActiveScopes(editor).some(function(scope) {
752
+ this.getActiveScopes(editor).some(function (scope) {
964
753
  var snippets = snippetMap[scope];
965
754
  if (snippets)
966
755
  snippet = this.findMatchingSnippet(snippets, before, after);
@@ -970,20 +759,14 @@ var SnippetManager = function() {
970
759
  return false;
971
760
  if (options && options.dryRun)
972
761
  return true;
973
- editor.session.doc.removeInLine(cursor.row,
974
- cursor.column - snippet.replaceBefore.length,
975
- cursor.column + snippet.replaceAfter.length
976
- );
977
-
762
+ editor.session.doc.removeInLine(cursor.row, cursor.column - snippet.replaceBefore.length, cursor.column + snippet.replaceAfter.length);
978
763
  this.variables.M__ = snippet.matchBefore;
979
764
  this.variables.T__ = snippet.matchAfter;
980
765
  this.insertSnippetForSelection(editor, snippet.content);
981
-
982
766
  this.variables.M__ = this.variables.T__ = null;
983
767
  return true;
984
768
  };
985
-
986
- this.findMatchingSnippet = function(snippetList, before, after) {
769
+ SnippetManager.prototype.findMatchingSnippet = function (snippetList, before, after) {
987
770
  for (var i = snippetList.length; i--;) {
988
771
  var s = snippetList[i];
989
772
  if (s.startRe && !s.startRe.test(before))
@@ -992,7 +775,6 @@ var SnippetManager = function() {
992
775
  continue;
993
776
  if (!s.startRe && !s.endRe)
994
777
  continue;
995
-
996
778
  s.matchBefore = s.startRe ? s.startRe.exec(before) : [""];
997
779
  s.matchAfter = s.endRe ? s.endRe.exec(after) : [""];
998
780
  s.replaceBefore = s.triggerRe ? s.triggerRe.exec(before)[0] : "";
@@ -1000,21 +782,15 @@ var SnippetManager = function() {
1000
782
  return s;
1001
783
  }
1002
784
  };
1003
-
1004
- this.snippetMap = {};
1005
- this.snippetNameMap = {};
1006
- this.register = function(snippets, scope) {
785
+ SnippetManager.prototype.register = function (snippets, scope) {
1007
786
  var snippetMap = this.snippetMap;
1008
787
  var snippetNameMap = this.snippetNameMap;
1009
788
  var self = this;
1010
-
1011
- if (!snippets)
789
+ if (!snippets)
1012
790
  snippets = [];
1013
-
1014
791
  function wrapRegexp(src) {
1015
792
  if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
1016
793
  src = "(?:" + src + ")";
1017
-
1018
794
  return src || "";
1019
795
  }
1020
796
  function guardedRegexp(re, guard, opening) {
@@ -1024,14 +800,14 @@ var SnippetManager = function() {
1024
800
  re = guard + re;
1025
801
  if (re && re[re.length - 1] != "$")
1026
802
  re = re + "$";
1027
- } else {
803
+ }
804
+ else {
1028
805
  re = re + guard;
1029
806
  if (re && re[0] != "^")
1030
807
  re = "^" + re;
1031
808
  }
1032
809
  return new RegExp(re);
1033
810
  }
1034
-
1035
811
  function addSnippet(s) {
1036
812
  if (!s.scope)
1037
813
  s.scope = scope || "_";
@@ -1040,7 +816,6 @@ var SnippetManager = function() {
1040
816
  snippetMap[scope] = [];
1041
817
  snippetNameMap[scope] = {};
1042
818
  }
1043
-
1044
819
  var map = snippetNameMap[scope];
1045
820
  if (s.name) {
1046
821
  var old = map[s.name];
@@ -1049,48 +824,40 @@ var SnippetManager = function() {
1049
824
  map[s.name] = s;
1050
825
  }
1051
826
  snippetMap[scope].push(s);
1052
-
1053
827
  if (s.prefix)
1054
828
  s.tabTrigger = s.prefix;
1055
-
1056
829
  if (!s.content && s.body)
1057
830
  s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body;
1058
-
1059
831
  if (s.tabTrigger && !s.trigger) {
1060
832
  if (!s.guard && /^\w/.test(s.tabTrigger))
1061
833
  s.guard = "\\b";
1062
834
  s.trigger = lang.escapeRegExp(s.tabTrigger);
1063
835
  }
1064
-
1065
836
  if (!s.trigger && !s.guard && !s.endTrigger && !s.endGuard)
1066
837
  return;
1067
-
1068
838
  s.startRe = guardedRegexp(s.trigger, s.guard, true);
1069
839
  s.triggerRe = new RegExp(s.trigger);
1070
-
1071
840
  s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
1072
841
  s.endTriggerRe = new RegExp(s.endTrigger);
1073
842
  }
1074
-
1075
843
  if (Array.isArray(snippets)) {
1076
844
  snippets.forEach(addSnippet);
1077
- } else {
1078
- Object.keys(snippets).forEach(function(key) {
845
+ }
846
+ else {
847
+ Object.keys(snippets).forEach(function (key) {
1079
848
  addSnippet(snippets[key]);
1080
849
  });
1081
850
  }
1082
-
1083
- this._signal("registerSnippets", {scope: scope});
851
+ this._signal("registerSnippets", { scope: scope });
1084
852
  };
1085
- this.unregister = function(snippets, scope) {
853
+ SnippetManager.prototype.unregister = function (snippets, scope) {
1086
854
  var snippetMap = this.snippetMap;
1087
855
  var snippetNameMap = this.snippetNameMap;
1088
-
1089
856
  function removeSnippet(s) {
1090
- var nameMap = snippetNameMap[s.scope||scope];
857
+ var nameMap = snippetNameMap[s.scope || scope];
1091
858
  if (nameMap && nameMap[s.name]) {
1092
859
  delete nameMap[s.name];
1093
- var map = snippetMap[s.scope||scope];
860
+ var map = snippetMap[s.scope || scope];
1094
861
  var i = map && map.indexOf(s);
1095
862
  if (i >= 0)
1096
863
  map.splice(i, 1);
@@ -1101,7 +868,7 @@ var SnippetManager = function() {
1101
868
  else if (Array.isArray(snippets))
1102
869
  snippets.forEach(removeSnippet);
1103
870
  };
1104
- this.parseSnippetFile = function(str) {
871
+ SnippetManager.prototype.parseSnippetFile = function (str) {
1105
872
  str = str.replace(/\r/g, "");
1106
873
  var list = [], snippet = {};
1107
874
  var re = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;
@@ -1111,12 +878,15 @@ var SnippetManager = function() {
1111
878
  try {
1112
879
  snippet = JSON.parse(m[1]);
1113
880
  list.push(snippet);
1114
- } catch (e) {}
1115
- } if (m[4]) {
881
+ }
882
+ catch (e) { }
883
+ }
884
+ if (m[4]) {
1116
885
  snippet.content = m[4].replace(/^\t/gm, "");
1117
886
  list.push(snippet);
1118
887
  snippet = {};
1119
- } else {
888
+ }
889
+ else {
1120
890
  var key = m[2], val = m[3];
1121
891
  if (key == "regex") {
1122
892
  var guardRe = /\/((?:[^\/\\]|\\.)*)|$/g;
@@ -1124,21 +894,23 @@ var SnippetManager = function() {
1124
894
  snippet.trigger = guardRe.exec(val)[1];
1125
895
  snippet.endTrigger = guardRe.exec(val)[1];
1126
896
  snippet.endGuard = guardRe.exec(val)[1];
1127
- } else if (key == "snippet") {
897
+ }
898
+ else if (key == "snippet") {
1128
899
  snippet.tabTrigger = val.match(/^\S*/)[0];
1129
900
  if (!snippet.name)
1130
901
  snippet.name = val;
1131
- } else if (key) {
902
+ }
903
+ else if (key) {
1132
904
  snippet[key] = val;
1133
905
  }
1134
906
  }
1135
907
  }
1136
908
  return list;
1137
909
  };
1138
- this.getSnippetByName = function(name, editor) {
910
+ SnippetManager.prototype.getSnippetByName = function (name, editor) {
1139
911
  var snippetMap = this.snippetNameMap;
1140
912
  var snippet;
1141
- this.getActiveScopes(editor).some(function(scope) {
913
+ this.getActiveScopes(editor).some(function (scope) {
1142
914
  var snippets = snippetMap[scope];
1143
915
  if (snippets)
1144
916
  snippet = snippets[name];
@@ -1146,59 +918,172 @@ var SnippetManager = function() {
1146
918
  }, this);
1147
919
  return snippet;
1148
920
  };
1149
-
1150
- }).call(SnippetManager.prototype);
1151
-
1152
-
1153
- var TabstopManager = function(editor) {
1154
- if (editor.tabstopManager)
1155
- return editor.tabstopManager;
1156
- editor.tabstopManager = this;
1157
- this.$onChange = this.onChange.bind(this);
1158
- this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule;
1159
- this.$onChangeSession = this.onChangeSession.bind(this);
1160
- this.$onAfterExec = this.onAfterExec.bind(this);
1161
- this.attach(editor);
921
+ return SnippetManager;
922
+ }());
923
+ oop.implement(SnippetManager.prototype, EventEmitter);
924
+ var processSnippetText = function (editor, snippetText, options) {
925
+ if (options === void 0) { options = {}; }
926
+ var cursor = editor.getCursorPosition();
927
+ var line = editor.session.getLine(cursor.row);
928
+ var tabString = editor.session.getTabString();
929
+ var indentString = line.match(/^\s*/)[0];
930
+ if (cursor.column < indentString.length)
931
+ indentString = indentString.slice(0, cursor.column);
932
+ snippetText = snippetText.replace(/\r/g, "");
933
+ var tokens = this.tokenizeTmSnippet(snippetText);
934
+ tokens = this.resolveVariables(tokens, editor);
935
+ tokens = tokens.map(function (x) {
936
+ if (x == "\n" && !options.excludeExtraIndent)
937
+ return x + indentString;
938
+ if (typeof x == "string")
939
+ return x.replace(/\t/g, tabString);
940
+ return x;
941
+ });
942
+ var tabstops = [];
943
+ tokens.forEach(function (p, i) {
944
+ if (typeof p != "object")
945
+ return;
946
+ var id = p.tabstopId;
947
+ var ts = tabstops[id];
948
+ if (!ts) {
949
+ ts = tabstops[id] = [];
950
+ ts.index = id;
951
+ ts.value = "";
952
+ ts.parents = {};
953
+ }
954
+ if (ts.indexOf(p) !== -1)
955
+ return;
956
+ if (p.choices && !ts.choices)
957
+ ts.choices = p.choices;
958
+ ts.push(p);
959
+ var i1 = tokens.indexOf(p, i + 1);
960
+ if (i1 === -1)
961
+ return;
962
+ var value = tokens.slice(i + 1, i1);
963
+ var isNested = value.some(function (t) { return typeof t === "object"; });
964
+ if (isNested && !ts.value) {
965
+ ts.value = value;
966
+ }
967
+ else if (value.length && (!ts.value || typeof ts.value !== "string")) {
968
+ ts.value = value.join("");
969
+ }
970
+ });
971
+ tabstops.forEach(function (ts) { ts.length = 0; });
972
+ var expanding = {};
973
+ function copyValue(val) {
974
+ var copy = [];
975
+ for (var i = 0; i < val.length; i++) {
976
+ var p = val[i];
977
+ if (typeof p == "object") {
978
+ if (expanding[p.tabstopId])
979
+ continue;
980
+ var j = val.lastIndexOf(p, i - 1);
981
+ p = copy[j] || { tabstopId: p.tabstopId };
982
+ }
983
+ copy[i] = p;
984
+ }
985
+ return copy;
986
+ }
987
+ for (var i = 0; i < tokens.length; i++) {
988
+ var p = tokens[i];
989
+ if (typeof p != "object")
990
+ continue;
991
+ var id = p.tabstopId;
992
+ var ts = tabstops[id];
993
+ var i1 = tokens.indexOf(p, i + 1);
994
+ if (expanding[id]) {
995
+ if (expanding[id] === p) {
996
+ delete expanding[id];
997
+ Object.keys(expanding).forEach(function (parentId) {
998
+ ts.parents[parentId] = true;
999
+ });
1000
+ }
1001
+ continue;
1002
+ }
1003
+ expanding[id] = p;
1004
+ var value = ts.value;
1005
+ if (typeof value !== "string")
1006
+ value = copyValue(value);
1007
+ else if (p.fmt)
1008
+ value = this.tmStrFormat(value, p, editor);
1009
+ tokens.splice.apply(tokens, [i + 1, Math.max(0, i1 - i)].concat(value, p));
1010
+ if (ts.indexOf(p) === -1)
1011
+ ts.push(p);
1012
+ }
1013
+ var row = 0, column = 0;
1014
+ var text = "";
1015
+ tokens.forEach(function (t) {
1016
+ if (typeof t === "string") {
1017
+ var lines = t.split("\n");
1018
+ if (lines.length > 1) {
1019
+ column = lines[lines.length - 1].length;
1020
+ row += lines.length - 1;
1021
+ }
1022
+ else
1023
+ column += t.length;
1024
+ text += t;
1025
+ }
1026
+ else if (t) {
1027
+ if (!t.start)
1028
+ t.start = { row: row, column: column };
1029
+ else
1030
+ t.end = { row: row, column: column };
1031
+ }
1032
+ });
1033
+ return {
1034
+ text: text,
1035
+ tabstops: tabstops,
1036
+ tokens: tokens
1037
+ };
1162
1038
  };
1163
- (function() {
1164
- this.attach = function(editor) {
1039
+ var TabstopManager = /** @class */ (function () {
1040
+ function TabstopManager(editor) {
1165
1041
  this.index = 0;
1166
1042
  this.ranges = [];
1167
1043
  this.tabstops = [];
1044
+ if (editor.tabstopManager)
1045
+ return editor.tabstopManager;
1046
+ editor.tabstopManager = this;
1047
+ this.$onChange = this.onChange.bind(this);
1048
+ this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule;
1049
+ this.$onChangeSession = this.onChangeSession.bind(this);
1050
+ this.$onAfterExec = this.onAfterExec.bind(this);
1051
+ this.attach(editor);
1052
+ }
1053
+ TabstopManager.prototype.attach = function (editor) {
1168
1054
  this.$openTabstops = null;
1169
1055
  this.selectedTabstop = null;
1170
-
1171
1056
  this.editor = editor;
1057
+ this.session = editor.session;
1172
1058
  this.editor.on("change", this.$onChange);
1173
1059
  this.editor.on("changeSelection", this.$onChangeSelection);
1174
1060
  this.editor.on("changeSession", this.$onChangeSession);
1175
1061
  this.editor.commands.on("afterExec", this.$onAfterExec);
1176
1062
  this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
1177
1063
  };
1178
- this.detach = function() {
1064
+ TabstopManager.prototype.detach = function () {
1179
1065
  this.tabstops.forEach(this.removeTabstopMarkers, this);
1180
- this.ranges = null;
1181
- this.tabstops = null;
1066
+ this.ranges.length = 0;
1067
+ this.tabstops.length = 0;
1182
1068
  this.selectedTabstop = null;
1183
- this.editor.removeListener("change", this.$onChange);
1184
- this.editor.removeListener("changeSelection", this.$onChangeSelection);
1185
- this.editor.removeListener("changeSession", this.$onChangeSession);
1186
- this.editor.commands.removeListener("afterExec", this.$onAfterExec);
1069
+ this.editor.off("change", this.$onChange);
1070
+ this.editor.off("changeSelection", this.$onChangeSelection);
1071
+ this.editor.off("changeSession", this.$onChangeSession);
1072
+ this.editor.commands.off("afterExec", this.$onAfterExec);
1187
1073
  this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
1188
1074
  this.editor.tabstopManager = null;
1075
+ this.session = null;
1189
1076
  this.editor = null;
1190
1077
  };
1191
-
1192
- this.onChange = function(delta) {
1078
+ TabstopManager.prototype.onChange = function (delta) {
1193
1079
  var isRemove = delta.action[0] == "r";
1194
1080
  var selectedTabstop = this.selectedTabstop || {};
1195
1081
  var parents = selectedTabstop.parents || {};
1196
- var tabstops = (this.tabstops || []).slice();
1082
+ var tabstops = this.tabstops.slice();
1197
1083
  for (var i = 0; i < tabstops.length; i++) {
1198
1084
  var ts = tabstops[i];
1199
1085
  var active = ts == selectedTabstop || parents[ts.index];
1200
1086
  ts.rangeList.$bias = active ? 0 : 1;
1201
-
1202
1087
  if (delta.action == "remove" && ts !== selectedTabstop) {
1203
1088
  var parentActive = ts.parents && ts.parents[selectedTabstop.index];
1204
1089
  var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
@@ -1211,16 +1096,16 @@ var TabstopManager = function(editor) {
1211
1096
  }
1212
1097
  ts.rangeList.$onChange(delta);
1213
1098
  }
1214
- var session = this.editor.session;
1099
+ var session = this.session;
1215
1100
  if (!this.$inChange && isRemove && session.getLength() == 1 && !session.getValue())
1216
1101
  this.detach();
1217
1102
  };
1218
- this.updateLinkedFields = function() {
1103
+ TabstopManager.prototype.updateLinkedFields = function () {
1219
1104
  var ts = this.selectedTabstop;
1220
1105
  if (!ts || !ts.hasLinkedRanges || !ts.firstNonLinked)
1221
1106
  return;
1222
1107
  this.$inChange = true;
1223
- var session = this.editor.session;
1108
+ var session = this.session;
1224
1109
  var text = session.getTextRange(ts.firstNonLinked);
1225
1110
  for (var i = 0; i < ts.length; i++) {
1226
1111
  var range = ts[i];
@@ -1232,11 +1117,11 @@ var TabstopManager = function(editor) {
1232
1117
  }
1233
1118
  this.$inChange = false;
1234
1119
  };
1235
- this.onAfterExec = function(e) {
1120
+ TabstopManager.prototype.onAfterExec = function (e) {
1236
1121
  if (e.command && !e.command.readOnly)
1237
1122
  this.updateLinkedFields();
1238
1123
  };
1239
- this.onChangeSelection = function() {
1124
+ TabstopManager.prototype.onChangeSelection = function () {
1240
1125
  if (!this.editor)
1241
1126
  return;
1242
1127
  var lead = this.editor.selection.lead;
@@ -1252,10 +1137,10 @@ var TabstopManager = function(editor) {
1252
1137
  }
1253
1138
  this.detach();
1254
1139
  };
1255
- this.onChangeSession = function() {
1140
+ TabstopManager.prototype.onChangeSession = function () {
1256
1141
  this.detach();
1257
1142
  };
1258
- this.tabNext = function(dir) {
1143
+ TabstopManager.prototype.tabNext = function (dir) {
1259
1144
  var max = this.tabstops.length;
1260
1145
  var index = this.index + (dir || 1);
1261
1146
  index = Math.min(Math.max(index, 1), max);
@@ -1265,7 +1150,7 @@ var TabstopManager = function(editor) {
1265
1150
  if (index === 0)
1266
1151
  this.detach();
1267
1152
  };
1268
- this.selectTabstop = function(index) {
1153
+ TabstopManager.prototype.selectTabstop = function (index) {
1269
1154
  this.$openTabstops = null;
1270
1155
  var ts = this.tabstops[this.index];
1271
1156
  if (ts)
@@ -1274,10 +1159,10 @@ var TabstopManager = function(editor) {
1274
1159
  ts = this.tabstops[this.index];
1275
1160
  if (!ts || !ts.length)
1276
1161
  return;
1277
-
1278
1162
  this.selectedTabstop = ts;
1279
1163
  var range = ts.firstNonLinked || ts;
1280
- if (ts.choices) range.cursor = range.start;
1164
+ if (ts.choices)
1165
+ range.cursor = range.start;
1281
1166
  if (!this.editor.inVirtualSelectionMode) {
1282
1167
  var sel = this.editor.multiSelect;
1283
1168
  sel.toSingleRange(range);
@@ -1286,17 +1171,16 @@ var TabstopManager = function(editor) {
1286
1171
  continue;
1287
1172
  sel.addRange(ts[i].clone(), true);
1288
1173
  }
1289
- } else {
1174
+ }
1175
+ else {
1290
1176
  this.editor.selection.fromOrientedRange(range);
1291
1177
  }
1292
-
1293
1178
  this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
1294
1179
  if (this.selectedTabstop && this.selectedTabstop.choices)
1295
- this.editor.execCommand("startAutocomplete", {matches: this.selectedTabstop.choices});
1180
+ this.editor.execCommand("startAutocomplete", { matches: this.selectedTabstop.choices });
1296
1181
  };
1297
- this.addTabstops = function(tabstops, start, end) {
1182
+ TabstopManager.prototype.addTabstops = function (tabstops, start, end) {
1298
1183
  var useLink = this.useLink || !this.editor.getOption("enableMultiselect");
1299
-
1300
1184
  if (!this.$openTabstops)
1301
1185
  this.$openTabstops = [];
1302
1186
  if (!tabstops[0]) {
@@ -1306,13 +1190,11 @@ var TabstopManager = function(editor) {
1306
1190
  tabstops[0] = [p];
1307
1191
  tabstops[0].index = 0;
1308
1192
  }
1309
-
1310
1193
  var i = this.index;
1311
1194
  var arg = [i + 1, 0];
1312
1195
  var ranges = this.ranges;
1313
- tabstops.forEach(function(ts, index) {
1196
+ tabstops.forEach(function (ts, index) {
1314
1197
  var dest = this.$openTabstops[index] || ts;
1315
-
1316
1198
  for (var i = 0; i < ts.length; i++) {
1317
1199
  var p = ts[i];
1318
1200
  var range = Range.fromPoints(p.start, p.end || p.start);
@@ -1328,7 +1210,8 @@ var TabstopManager = function(editor) {
1328
1210
  if (p.fmtString || (dest.firstNonLinked && useLink)) {
1329
1211
  range.linked = true;
1330
1212
  dest.hasLinkedRanges = true;
1331
- } else if (!dest.firstNonLinked)
1213
+ }
1214
+ else if (!dest.firstNonLinked)
1332
1215
  dest.firstNonLinked = range;
1333
1216
  }
1334
1217
  if (!dest.firstNonLinked)
@@ -1342,36 +1225,37 @@ var TabstopManager = function(editor) {
1342
1225
  dest.rangeList.$bias = 0;
1343
1226
  dest.rangeList.addList(dest);
1344
1227
  }, this);
1345
-
1346
1228
  if (arg.length > 2) {
1347
1229
  if (this.tabstops.length)
1348
1230
  arg.push(arg.splice(2, 1)[0]);
1349
1231
  this.tabstops.splice.apply(this.tabstops, arg);
1350
1232
  }
1351
1233
  };
1352
-
1353
- this.addTabstopMarkers = function(ts) {
1354
- var session = this.editor.session;
1355
- ts.forEach(function(range) {
1356
- if (!range.markerId)
1234
+ TabstopManager.prototype.addTabstopMarkers = function (ts) {
1235
+ var session = this.session;
1236
+ ts.forEach(function (range) {
1237
+ if (!range.markerId)
1357
1238
  range.markerId = session.addMarker(range, "ace_snippet-marker", "text");
1358
1239
  });
1359
1240
  };
1360
- this.removeTabstopMarkers = function(ts) {
1361
- var session = this.editor.session;
1362
- ts.forEach(function(range) {
1241
+ TabstopManager.prototype.removeTabstopMarkers = function (ts) {
1242
+ var session = this.session;
1243
+ ts.forEach(function (range) {
1363
1244
  session.removeMarker(range.markerId);
1364
1245
  range.markerId = null;
1365
1246
  });
1366
1247
  };
1367
- this.removeRange = function(range) {
1248
+ TabstopManager.prototype.removeRange = function (range) {
1368
1249
  var i = range.tabstop.indexOf(range);
1369
- if (i != -1) range.tabstop.splice(i, 1);
1250
+ if (i != -1)
1251
+ range.tabstop.splice(i, 1);
1370
1252
  i = this.ranges.indexOf(range);
1371
- if (i != -1) this.ranges.splice(i, 1);
1253
+ if (i != -1)
1254
+ this.ranges.splice(i, 1);
1372
1255
  i = range.tabstop.rangeList.ranges.indexOf(range);
1373
- if (i != -1) range.tabstop.splice(i, 1);
1374
- this.editor.session.removeMarker(range.markerId);
1256
+ if (i != -1)
1257
+ range.tabstop.splice(i, 1);
1258
+ this.session.removeMarker(range.markerId);
1375
1259
  if (!range.tabstop.length) {
1376
1260
  i = this.tabstops.indexOf(range.tabstop);
1377
1261
  if (i != -1)
@@ -1380,167 +1264,445 @@ var TabstopManager = function(editor) {
1380
1264
  this.detach();
1381
1265
  }
1382
1266
  };
1383
-
1384
- this.keyboardHandler = new HashHandler();
1385
- this.keyboardHandler.bindKeys({
1386
- "Tab": function(editor) {
1387
- if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
1388
- return;
1389
- editor.tabstopManager.tabNext(1);
1390
- editor.renderer.scrollCursorIntoView();
1391
- },
1392
- "Shift-Tab": function(editor) {
1393
- editor.tabstopManager.tabNext(-1);
1394
- editor.renderer.scrollCursorIntoView();
1395
- },
1396
- "Esc": function(editor) {
1397
- editor.tabstopManager.detach();
1398
- }
1399
- });
1400
- }).call(TabstopManager.prototype);
1401
-
1402
-
1403
-
1404
- var movePoint = function(point, diff) {
1267
+ return TabstopManager;
1268
+ }());
1269
+ TabstopManager.prototype.keyboardHandler = new HashHandler();
1270
+ TabstopManager.prototype.keyboardHandler.bindKeys({
1271
+ "Tab": function (editor) {
1272
+ if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
1273
+ return;
1274
+ editor.tabstopManager.tabNext(1);
1275
+ editor.renderer.scrollCursorIntoView();
1276
+ },
1277
+ "Shift-Tab": function (editor) {
1278
+ editor.tabstopManager.tabNext(-1);
1279
+ editor.renderer.scrollCursorIntoView();
1280
+ },
1281
+ "Esc": function (editor) {
1282
+ editor.tabstopManager.detach();
1283
+ }
1284
+ });
1285
+ var movePoint = function (point, diff) {
1405
1286
  if (point.row == 0)
1406
1287
  point.column += diff.column;
1407
1288
  point.row += diff.row;
1408
1289
  };
1409
-
1410
- var moveRelative = function(point, start) {
1290
+ var moveRelative = function (point, start) {
1411
1291
  if (point.row == start.row)
1412
1292
  point.column -= start.column;
1413
1293
  point.row -= start.row;
1414
1294
  };
1415
-
1416
-
1417
- dom.importCssString("\
1418
- .ace_snippet-marker {\
1419
- -moz-box-sizing: border-box;\
1420
- box-sizing: border-box;\
1421
- background: rgba(194, 193, 208, 0.09);\
1422
- border: 1px dotted rgba(211, 208, 235, 0.62);\
1423
- position: absolute;\
1424
- }", "snippets.css", false);
1425
-
1295
+ dom.importCssString("\n.ace_snippet-marker {\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n background: rgba(194, 193, 208, 0.09);\n border: 1px dotted rgba(211, 208, 235, 0.62);\n position: absolute;\n}", "snippets.css", false);
1426
1296
  exports.snippetManager = new SnippetManager();
1427
-
1428
-
1429
1297
  var Editor = require("./editor").Editor;
1430
- (function() {
1431
- this.insertSnippet = function(content, options) {
1298
+ (function () {
1299
+ this.insertSnippet = function (content, options) {
1432
1300
  return exports.snippetManager.insertSnippet(this, content, options);
1433
1301
  };
1434
- this.expandSnippet = function(options) {
1302
+ this.expandSnippet = function (options) {
1435
1303
  return exports.snippetManager.expandWithTab(this, options);
1436
1304
  };
1437
1305
  }).call(Editor.prototype);
1438
1306
 
1439
1307
  });
1440
1308
 
1441
- ace.define("ace/autocomplete",[], function(require, exports, module) {
1442
- "use strict";
1309
+ ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"], function(require, exports, module){"use strict";
1310
+ var AceInlineScreenReader = /** @class */ (function () {
1311
+ function AceInlineScreenReader(editor) {
1312
+ this.editor = editor;
1313
+ this.screenReaderDiv = document.createElement("div");
1314
+ this.screenReaderDiv.classList.add("ace_screenreader-only");
1315
+ this.editor.container.appendChild(this.screenReaderDiv);
1316
+ }
1317
+ AceInlineScreenReader.prototype.setScreenReaderContent = function (content) {
1318
+ if (!this.popup && this.editor.completer && this.editor.completer.popup) {
1319
+ this.popup = this.editor.completer.popup;
1320
+ this.popup.renderer.on("afterRender", function () {
1321
+ var row = this.popup.getRow();
1322
+ var t = this.popup.renderer.$textLayer;
1323
+ var selected = t.element.childNodes[row - t.config.firstRow];
1324
+ if (selected) {
1325
+ var idString = "doc-tooltip ";
1326
+ for (var lineIndex = 0; lineIndex < this._lines.length; lineIndex++) {
1327
+ idString += "ace-inline-screenreader-line-".concat(lineIndex, " ");
1328
+ }
1329
+ selected.setAttribute("aria-describedby", idString);
1330
+ }
1331
+ }.bind(this));
1332
+ }
1333
+ while (this.screenReaderDiv.firstChild) {
1334
+ this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);
1335
+ }
1336
+ this._lines = content.split(/\r\n|\r|\n/);
1337
+ var codeElement = this.createCodeBlock();
1338
+ this.screenReaderDiv.appendChild(codeElement);
1339
+ };
1340
+ AceInlineScreenReader.prototype.destroy = function () {
1341
+ this.screenReaderDiv.remove();
1342
+ };
1343
+ AceInlineScreenReader.prototype.createCodeBlock = function () {
1344
+ var container = document.createElement("pre");
1345
+ container.setAttribute("id", "ace-inline-screenreader");
1346
+ for (var lineIndex = 0; lineIndex < this._lines.length; lineIndex++) {
1347
+ var codeElement = document.createElement("code");
1348
+ codeElement.setAttribute("id", "ace-inline-screenreader-line-".concat(lineIndex));
1349
+ var line = document.createTextNode(this._lines[lineIndex]);
1350
+ codeElement.appendChild(line);
1351
+ container.appendChild(codeElement);
1352
+ }
1353
+ return container;
1354
+ };
1355
+ return AceInlineScreenReader;
1356
+ }());
1357
+ exports.AceInlineScreenReader = AceInlineScreenReader;
1358
+
1359
+ });
1360
+
1361
+ ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"], function(require, exports, module){"use strict";
1362
+ var snippetManager = require("../snippets").snippetManager;
1363
+ var AceInlineScreenReader = require("./inline_screenreader").AceInlineScreenReader;
1364
+ var AceInline = /** @class */ (function () {
1365
+ function AceInline() {
1366
+ this.editor = null;
1367
+ }
1368
+ AceInline.prototype.show = function (editor, completion, prefix) {
1369
+ prefix = prefix || "";
1370
+ if (editor && this.editor && this.editor !== editor) {
1371
+ this.hide();
1372
+ this.editor = null;
1373
+ this.inlineScreenReader = null;
1374
+ }
1375
+ if (!editor || !completion) {
1376
+ return false;
1377
+ }
1378
+ if (!this.inlineScreenReader) {
1379
+ this.inlineScreenReader = new AceInlineScreenReader(editor);
1380
+ }
1381
+ var displayText = completion.snippet ? snippetManager.getDisplayTextForSnippet(editor, completion.snippet) : completion.value;
1382
+ if (completion.hideInlinePreview || !displayText || !displayText.startsWith(prefix)) {
1383
+ return false;
1384
+ }
1385
+ this.editor = editor;
1386
+ this.inlineScreenReader.setScreenReaderContent(displayText);
1387
+ displayText = displayText.slice(prefix.length);
1388
+ if (displayText === "") {
1389
+ editor.removeGhostText();
1390
+ }
1391
+ else {
1392
+ editor.setGhostText(displayText);
1393
+ }
1394
+ return true;
1395
+ };
1396
+ AceInline.prototype.isOpen = function () {
1397
+ if (!this.editor) {
1398
+ return false;
1399
+ }
1400
+ return !!this.editor.renderer.$ghostText;
1401
+ };
1402
+ AceInline.prototype.hide = function () {
1403
+ if (!this.editor) {
1404
+ return false;
1405
+ }
1406
+ this.editor.removeGhostText();
1407
+ return true;
1408
+ };
1409
+ AceInline.prototype.destroy = function () {
1410
+ this.hide();
1411
+ this.editor = null;
1412
+ if (this.inlineScreenReader) {
1413
+ this.inlineScreenReader.destroy();
1414
+ this.inlineScreenReader = null;
1415
+ }
1416
+ };
1417
+ return AceInline;
1418
+ }());
1419
+ exports.AceInline = AceInline;
1420
+
1421
+ });
1422
+
1423
+ ace.define("ace/autocomplete/util",["require","exports","module"], function(require, exports, module){"use strict";
1424
+ exports.parForEach = function (array, fn, callback) {
1425
+ var completed = 0;
1426
+ var arLength = array.length;
1427
+ if (arLength === 0)
1428
+ callback();
1429
+ for (var i = 0; i < arLength; i++) {
1430
+ fn(array[i], function (result, err) {
1431
+ completed++;
1432
+ if (completed === arLength)
1433
+ callback(result, err);
1434
+ });
1435
+ }
1436
+ };
1437
+ var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;
1438
+ exports.retrievePrecedingIdentifier = function (text, pos, regex) {
1439
+ regex = regex || ID_REGEX;
1440
+ var buf = [];
1441
+ for (var i = pos - 1; i >= 0; i--) {
1442
+ if (regex.test(text[i]))
1443
+ buf.push(text[i]);
1444
+ else
1445
+ break;
1446
+ }
1447
+ return buf.reverse().join("");
1448
+ };
1449
+ exports.retrieveFollowingIdentifier = function (text, pos, regex) {
1450
+ regex = regex || ID_REGEX;
1451
+ var buf = [];
1452
+ for (var i = pos; i < text.length; i++) {
1453
+ if (regex.test(text[i]))
1454
+ buf.push(text[i]);
1455
+ else
1456
+ break;
1457
+ }
1458
+ return buf;
1459
+ };
1460
+ exports.getCompletionPrefix = function (editor) {
1461
+ var pos = editor.getCursorPosition();
1462
+ var line = editor.session.getLine(pos.row);
1463
+ var prefix;
1464
+ editor.completers.forEach(function (completer) {
1465
+ if (completer.identifierRegexps) {
1466
+ completer.identifierRegexps.forEach(function (identifierRegex) {
1467
+ if (!prefix && identifierRegex)
1468
+ prefix = this.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
1469
+ }.bind(this));
1470
+ }
1471
+ }.bind(this));
1472
+ return prefix || this.retrievePrecedingIdentifier(line, pos.column);
1473
+ };
1474
+ exports.triggerAutocomplete = function (editor) {
1475
+ var pos = editor.getCursorPosition();
1476
+ var line = editor.session.getLine(pos.row);
1477
+ var column = (pos.column === 0) ? 0 : pos.column - 1;
1478
+ var previousChar = line[column];
1479
+ return editor.completers.some(function (el) {
1480
+ if (el.triggerCharacters && Array.isArray(el.triggerCharacters)) {
1481
+ return el.triggerCharacters.includes(previousChar);
1482
+ }
1483
+ });
1484
+ };
1443
1485
 
1486
+ });
1487
+
1488
+ ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/inline","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config","ace/lib/event"], function(require, exports, module){"use strict";
1444
1489
  var HashHandler = require("./keyboard/hash_handler").HashHandler;
1445
1490
  var AcePopup = require("./autocomplete/popup").AcePopup;
1491
+ var AceInline = require("./autocomplete/inline").AceInline;
1492
+ var getAriaId = require("./autocomplete/popup").getAriaId;
1446
1493
  var util = require("./autocomplete/util");
1447
1494
  var lang = require("./lib/lang");
1448
1495
  var dom = require("./lib/dom");
1449
1496
  var snippetManager = require("./snippets").snippetManager;
1450
1497
  var config = require("./config");
1451
-
1452
- var Autocomplete = function() {
1453
- this.autoInsert = false;
1454
- this.autoSelect = true;
1455
- this.exactMatch = false;
1456
- this.gatherCompletionsId = 0;
1457
- this.keyboardHandler = new HashHandler();
1458
- this.keyboardHandler.bindKeys(this.commands);
1459
-
1460
- this.blurListener = this.blurListener.bind(this);
1461
- this.changeListener = this.changeListener.bind(this);
1462
- this.mousedownListener = this.mousedownListener.bind(this);
1463
- this.mousewheelListener = this.mousewheelListener.bind(this);
1464
-
1465
- this.changeTimer = lang.delayedCall(function() {
1466
- this.updateCompletions(true);
1467
- }.bind(this));
1468
-
1469
- this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
1498
+ var event = require("./lib/event");
1499
+ var destroyCompleter = function (e, editor) {
1500
+ editor.completer && editor.completer.destroy();
1470
1501
  };
1471
-
1472
- (function() {
1473
-
1474
- this.$init = function() {
1475
- this.popup = new AcePopup(document.body || document.documentElement);
1476
- this.popup.on("click", function(e) {
1502
+ var Autocomplete = /** @class */ (function () {
1503
+ function Autocomplete() {
1504
+ this.autoInsert = false;
1505
+ this.autoSelect = true;
1506
+ this.autoShown = false;
1507
+ this.exactMatch = false;
1508
+ this.inlineEnabled = false;
1509
+ this.keyboardHandler = new HashHandler();
1510
+ this.keyboardHandler.bindKeys(this.commands);
1511
+ this.parentNode = null;
1512
+ this.setSelectOnHover = false;
1513
+ this.stickySelectionDelay = 500;
1514
+ this.blurListener = this.blurListener.bind(this);
1515
+ this.changeListener = this.changeListener.bind(this);
1516
+ this.mousedownListener = this.mousedownListener.bind(this);
1517
+ this.mousewheelListener = this.mousewheelListener.bind(this);
1518
+ this.onLayoutChange = this.onLayoutChange.bind(this);
1519
+ this.changeTimer = lang.delayedCall(function () {
1520
+ this.updateCompletions(true);
1521
+ }.bind(this));
1522
+ this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
1523
+ this.stickySelectionTimer = lang.delayedCall(function () {
1524
+ this.stickySelection = true;
1525
+ }.bind(this), this.stickySelectionDelay);
1526
+ this.$firstOpenTimer = lang.delayedCall(function () {
1527
+ var initialPosition = this.completionProvider && this.completionProvider.initialPosition;
1528
+ if (this.autoShown || (this.popup && this.popup.isOpen) || !initialPosition)
1529
+ return;
1530
+ var completionsForEmpty = [{
1531
+ caption: config.nls("Loading..."),
1532
+ value: ""
1533
+ }];
1534
+ this.completions = new FilteredList(completionsForEmpty);
1535
+ this.openPopup(this.editor, initialPosition.prefix, false);
1536
+ this.popup.renderer.setStyle("ace_loading", true);
1537
+ }.bind(this), this.stickySelectionDelay);
1538
+ }
1539
+ Autocomplete.prototype.$init = function () {
1540
+ this.popup = new AcePopup(this.parentNode || document.body || document.documentElement);
1541
+ this.popup.on("click", function (e) {
1477
1542
  this.insertMatch();
1478
1543
  e.stop();
1479
1544
  }.bind(this));
1480
1545
  this.popup.focus = this.editor.focus.bind(this.editor);
1481
- this.popup.on("show", this.tooltipTimer.bind(null, null));
1482
- this.popup.on("select", this.tooltipTimer.bind(null, null));
1546
+ this.popup.on("show", this.$onPopupShow.bind(this));
1547
+ this.popup.on("hide", this.$onHidePopup.bind(this));
1548
+ this.popup.on("select", this.$onPopupChange.bind(this));
1549
+ event.addListener(this.popup.container, "mouseout", this.mouseOutListener.bind(this));
1483
1550
  this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
1484
1551
  return this.popup;
1485
1552
  };
1486
-
1487
- this.getPopup = function() {
1553
+ Autocomplete.prototype.$initInline = function () {
1554
+ if (!this.inlineEnabled || this.inlineRenderer)
1555
+ return;
1556
+ this.inlineRenderer = new AceInline();
1557
+ return this.inlineRenderer;
1558
+ };
1559
+ Autocomplete.prototype.getPopup = function () {
1488
1560
  return this.popup || this.$init();
1489
1561
  };
1490
-
1491
- this.openPopup = function(editor, prefix, keepPopupPosition) {
1562
+ Autocomplete.prototype.$onHidePopup = function () {
1563
+ if (this.inlineRenderer) {
1564
+ this.inlineRenderer.hide();
1565
+ }
1566
+ this.hideDocTooltip();
1567
+ this.stickySelectionTimer.cancel();
1568
+ this.stickySelection = false;
1569
+ };
1570
+ Autocomplete.prototype.$onPopupChange = function (hide) {
1571
+ if (this.inlineRenderer && this.inlineEnabled) {
1572
+ var completion = hide ? null : this.popup.getData(this.popup.getRow());
1573
+ var prefix = util.getCompletionPrefix(this.editor);
1574
+ if (!this.inlineRenderer.show(this.editor, completion, prefix)) {
1575
+ this.inlineRenderer.hide();
1576
+ }
1577
+ if (this.popup.isMouseOver && this.setSelectOnHover) {
1578
+ this.tooltipTimer.call(null, null);
1579
+ return;
1580
+ }
1581
+ }
1582
+ this.$updatePopupPosition();
1583
+ this.tooltipTimer.call(null, null);
1584
+ };
1585
+ Autocomplete.prototype.$onPopupShow = function (hide) {
1586
+ this.$onPopupChange(hide);
1587
+ this.stickySelection = false;
1588
+ if (this.stickySelectionDelay >= 0)
1589
+ this.stickySelectionTimer.schedule(this.stickySelectionDelay);
1590
+ };
1591
+ Autocomplete.prototype.observeLayoutChanges = function () {
1592
+ if (this.$elements || !this.editor)
1593
+ return;
1594
+ window.addEventListener("resize", this.onLayoutChange, { passive: true });
1595
+ window.addEventListener("wheel", this.mousewheelListener);
1596
+ var el = this.editor.container.parentNode;
1597
+ var elements = [];
1598
+ while (el) {
1599
+ elements.push(el);
1600
+ el.addEventListener("scroll", this.onLayoutChange, { passive: true });
1601
+ el = el.parentNode;
1602
+ }
1603
+ this.$elements = elements;
1604
+ };
1605
+ Autocomplete.prototype.unObserveLayoutChanges = function () {
1606
+ var _this = this;
1607
+ window.removeEventListener("resize", this.onLayoutChange, { passive: true });
1608
+ window.removeEventListener("wheel", this.mousewheelListener);
1609
+ this.$elements && this.$elements.forEach(function (el) {
1610
+ el.removeEventListener("scroll", _this.onLayoutChange, { passive: true });
1611
+ });
1612
+ this.$elements = null;
1613
+ };
1614
+ Autocomplete.prototype.onLayoutChange = function () {
1615
+ if (!this.popup.isOpen)
1616
+ return this.unObserveLayoutChanges();
1617
+ this.$updatePopupPosition();
1618
+ this.updateDocTooltip();
1619
+ };
1620
+ Autocomplete.prototype.$updatePopupPosition = function () {
1621
+ var editor = this.editor;
1622
+ var renderer = editor.renderer;
1623
+ var lineHeight = renderer.layerConfig.lineHeight;
1624
+ var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);
1625
+ pos.left -= this.popup.getTextLeftOffset();
1626
+ var rect = editor.container.getBoundingClientRect();
1627
+ pos.top += rect.top - renderer.layerConfig.offset;
1628
+ pos.left += rect.left - editor.renderer.scrollLeft;
1629
+ pos.left += renderer.gutterWidth;
1630
+ var posGhostText = {
1631
+ top: pos.top,
1632
+ left: pos.left
1633
+ };
1634
+ if (renderer.$ghostText && renderer.$ghostTextWidget) {
1635
+ if (this.base.row === renderer.$ghostText.position.row) {
1636
+ posGhostText.top += renderer.$ghostTextWidget.el.offsetHeight;
1637
+ }
1638
+ }
1639
+ if (this.popup.tryShow(posGhostText, lineHeight, "bottom")) {
1640
+ return;
1641
+ }
1642
+ if (this.popup.tryShow(pos, lineHeight, "top")) {
1643
+ return;
1644
+ }
1645
+ this.popup.show(pos, lineHeight);
1646
+ };
1647
+ Autocomplete.prototype.openPopup = function (editor, prefix, keepPopupPosition) {
1648
+ this.$firstOpenTimer.cancel();
1492
1649
  if (!this.popup)
1493
1650
  this.$init();
1494
-
1651
+ if (this.inlineEnabled && !this.inlineRenderer)
1652
+ this.$initInline();
1495
1653
  this.popup.autoSelect = this.autoSelect;
1496
-
1654
+ this.popup.setSelectOnHover(this.setSelectOnHover);
1655
+ var previousSelectedItem = this.popup.data[this.popup.getRow()];
1497
1656
  this.popup.setData(this.completions.filtered, this.completions.filterText);
1498
-
1657
+ if (this.editor.textInput.setAriaOptions) {
1658
+ this.editor.textInput.setAriaOptions({
1659
+ activeDescendant: getAriaId(this.popup.getRow()),
1660
+ inline: this.inlineEnabled
1661
+ });
1662
+ }
1499
1663
  editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
1500
-
1501
- var renderer = editor.renderer;
1502
- this.popup.setRow(this.autoSelect ? 0 : -1);
1664
+ var newRow = this.popup.data.indexOf(previousSelectedItem);
1665
+ if (newRow && this.stickySelection)
1666
+ this.popup.setRow(this.autoSelect ? newRow : -1);
1667
+ else
1668
+ this.popup.setRow(this.autoSelect ? 0 : -1);
1503
1669
  if (!keepPopupPosition) {
1504
1670
  this.popup.setTheme(editor.getTheme());
1505
1671
  this.popup.setFontSize(editor.getFontSize());
1506
-
1507
- var lineHeight = renderer.layerConfig.lineHeight;
1508
-
1509
- var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);
1510
- pos.left -= this.popup.getTextLeftOffset();
1511
-
1512
- var rect = editor.container.getBoundingClientRect();
1513
- pos.top += rect.top - renderer.layerConfig.offset;
1514
- pos.left += rect.left - editor.renderer.scrollLeft;
1515
- pos.left += renderer.gutterWidth;
1516
-
1517
- this.popup.show(pos, lineHeight);
1518
- } else if (keepPopupPosition && !prefix) {
1672
+ this.$updatePopupPosition();
1673
+ if (this.tooltipNode) {
1674
+ this.updateDocTooltip();
1675
+ }
1676
+ }
1677
+ else if (keepPopupPosition && !prefix) {
1519
1678
  this.detach();
1520
1679
  }
1521
1680
  this.changeTimer.cancel();
1522
- };
1523
-
1524
- this.detach = function() {
1525
- this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
1526
- this.editor.off("changeSelection", this.changeListener);
1527
- this.editor.off("blur", this.blurListener);
1528
- this.editor.off("mousedown", this.mousedownListener);
1529
- this.editor.off("mousewheel", this.mousewheelListener);
1681
+ this.observeLayoutChanges();
1682
+ };
1683
+ Autocomplete.prototype.detach = function () {
1684
+ if (this.editor) {
1685
+ this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
1686
+ this.editor.off("changeSelection", this.changeListener);
1687
+ this.editor.off("blur", this.blurListener);
1688
+ this.editor.off("mousedown", this.mousedownListener);
1689
+ this.editor.off("mousewheel", this.mousewheelListener);
1690
+ }
1691
+ this.$firstOpenTimer.cancel();
1530
1692
  this.changeTimer.cancel();
1531
1693
  this.hideDocTooltip();
1532
-
1533
- this.gatherCompletionsId += 1;
1694
+ if (this.completionProvider) {
1695
+ this.completionProvider.detach();
1696
+ }
1534
1697
  if (this.popup && this.popup.isOpen)
1535
1698
  this.popup.hide();
1536
-
1537
1699
  if (this.base)
1538
1700
  this.base.detach();
1539
1701
  this.activated = false;
1540
- this.completions = this.base = null;
1702
+ this.completionProvider = this.completions = this.base = null;
1703
+ this.unObserveLayoutChanges();
1541
1704
  };
1542
-
1543
- this.changeListener = function(e) {
1705
+ Autocomplete.prototype.changeListener = function (e) {
1544
1706
  var cursor = this.editor.selection.lead;
1545
1707
  if (cursor.row != this.base.row || cursor.column < this.base.column) {
1546
1708
  this.detach();
@@ -1550,144 +1712,83 @@ var Autocomplete = function() {
1550
1712
  else
1551
1713
  this.detach();
1552
1714
  };
1553
-
1554
- this.blurListener = function(e) {
1715
+ Autocomplete.prototype.blurListener = function (e) {
1555
1716
  var el = document.activeElement;
1556
1717
  var text = this.editor.textInput.getElement();
1557
1718
  var fromTooltip = e.relatedTarget && this.tooltipNode && this.tooltipNode.contains(e.relatedTarget);
1558
1719
  var container = this.popup && this.popup.container;
1559
1720
  if (el != text && el.parentNode != container && !fromTooltip
1560
- && el != this.tooltipNode && e.relatedTarget != text
1561
- ) {
1721
+ && el != this.tooltipNode && e.relatedTarget != text) {
1562
1722
  this.detach();
1563
1723
  }
1564
1724
  };
1565
-
1566
- this.mousedownListener = function(e) {
1725
+ Autocomplete.prototype.mousedownListener = function (e) {
1567
1726
  this.detach();
1568
1727
  };
1569
-
1570
- this.mousewheelListener = function(e) {
1571
- this.detach();
1728
+ Autocomplete.prototype.mousewheelListener = function (e) {
1729
+ if (!this.popup.isMouseOver)
1730
+ this.detach();
1572
1731
  };
1573
-
1574
- this.goTo = function(where) {
1732
+ Autocomplete.prototype.mouseOutListener = function (e) {
1733
+ if (this.popup.isOpen)
1734
+ this.$updatePopupPosition();
1735
+ };
1736
+ Autocomplete.prototype.goTo = function (where) {
1575
1737
  this.popup.goTo(where);
1576
1738
  };
1577
-
1578
- this.insertMatch = function(data, options) {
1739
+ Autocomplete.prototype.insertMatch = function (data, options) {
1579
1740
  if (!data)
1580
- data = this.popup.getData(this.popup.getRow());
1581
- if (!data)
1582
- return false;
1583
-
1584
- var completions = this.completions;
1585
- this.editor.startOperation({command: {name: "insertMatch"}});
1586
- if (data.completer && data.completer.insertMatch) {
1587
- data.completer.insertMatch(this.editor, data);
1588
- } else {
1589
- if (completions.filterText) {
1590
- var ranges = this.editor.selection.getAllRanges();
1591
- for (var i = 0, range; range = ranges[i]; i++) {
1592
- range.start.column -= completions.filterText.length;
1593
- this.editor.session.remove(range);
1594
- }
1595
- }
1596
- if (data.snippet)
1597
- snippetManager.insertSnippet(this.editor, data.snippet);
1598
- else
1599
- this.editor.execCommand("insertstring", data.value || data);
1600
- }
1741
+ data = this.popup.getData(this.popup.getRow());
1742
+ if (!data)
1743
+ return false;
1744
+ if (data.value === "") // Explicitly given nothing to insert, e.g. "No suggestion state"
1745
+ return this.detach();
1746
+ var completions = this.completions;
1747
+ var result = this.getCompletionProvider().insertMatch(this.editor, data, completions.filterText, options);
1601
1748
  if (this.completions == completions)
1602
1749
  this.detach();
1603
- this.editor.endOperation();
1604
- };
1605
-
1606
-
1607
- this.commands = {
1608
- "Up": function(editor) { editor.completer.goTo("up"); },
1609
- "Down": function(editor) { editor.completer.goTo("down"); },
1610
- "Ctrl-Up|Ctrl-Home": function(editor) { editor.completer.goTo("start"); },
1611
- "Ctrl-Down|Ctrl-End": function(editor) { editor.completer.goTo("end"); },
1612
-
1613
- "Esc": function(editor) { editor.completer.detach(); },
1614
- "Return": function(editor) { return editor.completer.insertMatch(); },
1615
- "Shift-Return": function(editor) { editor.completer.insertMatch(null, {deleteSuffix: true}); },
1616
- "Tab": function(editor) {
1617
- var result = editor.completer.insertMatch();
1618
- if (!result && !editor.tabstopManager)
1619
- editor.completer.goTo("down");
1620
- else
1621
- return result;
1622
- },
1623
-
1624
- "PageUp": function(editor) { editor.completer.popup.gotoPageUp(); },
1625
- "PageDown": function(editor) { editor.completer.popup.gotoPageDown(); }
1626
- };
1627
-
1628
- this.gatherCompletions = function(editor, callback) {
1629
- var session = editor.getSession();
1630
- var pos = editor.getCursorPosition();
1631
-
1632
- var prefix = util.getCompletionPrefix(editor);
1633
-
1634
- this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
1635
- this.base.$insertRight = true;
1636
-
1637
- var matches = [];
1638
- var total = editor.completers.length;
1639
- editor.completers.forEach(function(completer, i) {
1640
- completer.getCompletions(editor, session, pos, prefix, function(err, results) {
1641
- if (!err && results)
1642
- matches = matches.concat(results);
1643
- callback(null, {
1644
- prefix: util.getCompletionPrefix(editor),
1645
- matches: matches,
1646
- finished: (--total === 0)
1647
- });
1648
- });
1649
- });
1650
- return true;
1750
+ return result;
1651
1751
  };
1652
-
1653
- this.showPopup = function(editor, options) {
1752
+ Autocomplete.prototype.showPopup = function (editor, options) {
1654
1753
  if (this.editor)
1655
1754
  this.detach();
1656
-
1657
1755
  this.activated = true;
1658
-
1659
1756
  this.editor = editor;
1660
1757
  if (editor.completer != this) {
1661
1758
  if (editor.completer)
1662
1759
  editor.completer.detach();
1663
1760
  editor.completer = this;
1664
1761
  }
1665
-
1666
1762
  editor.on("changeSelection", this.changeListener);
1667
1763
  editor.on("blur", this.blurListener);
1668
1764
  editor.on("mousedown", this.mousedownListener);
1669
1765
  editor.on("mousewheel", this.mousewheelListener);
1670
-
1671
1766
  this.updateCompletions(false, options);
1672
1767
  };
1673
-
1674
- this.updateCompletions = function(keepPopupPosition, options) {
1768
+ Autocomplete.prototype.getCompletionProvider = function (initialPosition) {
1769
+ if (!this.completionProvider)
1770
+ this.completionProvider = new CompletionProvider(initialPosition);
1771
+ return this.completionProvider;
1772
+ };
1773
+ Autocomplete.prototype.gatherCompletions = function (editor, callback) {
1774
+ return this.getCompletionProvider().gatherCompletions(editor, callback);
1775
+ };
1776
+ Autocomplete.prototype.updateCompletions = function (keepPopupPosition, options) {
1675
1777
  if (keepPopupPosition && this.base && this.completions) {
1676
1778
  var pos = this.editor.getCursorPosition();
1677
- var prefix = this.editor.session.getTextRange({start: this.base, end: pos});
1779
+ var prefix = this.editor.session.getTextRange({ start: this.base, end: pos });
1678
1780
  if (prefix == this.completions.filterText)
1679
1781
  return;
1680
1782
  this.completions.setFilter(prefix);
1681
1783
  if (!this.completions.filtered.length)
1682
1784
  return this.detach();
1683
1785
  if (this.completions.filtered.length == 1
1684
- && this.completions.filtered[0].value == prefix
1685
- && !this.completions.filtered[0].snippet)
1786
+ && this.completions.filtered[0].value == prefix
1787
+ && !this.completions.filtered[0].snippet)
1686
1788
  return this.detach();
1687
1789
  this.openPopup(this.editor, prefix, keepPopupPosition);
1688
1790
  return;
1689
1791
  }
1690
-
1691
1792
  if (options && options.matches) {
1692
1793
  var pos = this.editor.getSelectionRange().start;
1693
1794
  this.base = this.editor.session.doc.createAnchor(pos.row, pos.column);
@@ -1695,137 +1796,134 @@ var Autocomplete = function() {
1695
1796
  this.completions = new FilteredList(options.matches);
1696
1797
  return this.openPopup(this.editor, "", keepPopupPosition);
1697
1798
  }
1698
- var _id = this.gatherCompletionsId;
1699
- var detachIfFinished = function(results) {
1700
- if (!results.finished) return;
1701
- return this.detach();
1702
- }.bind(this);
1703
-
1704
- var processResults = function(results) {
1705
- var prefix = results.prefix;
1706
- var matches = results.matches;
1707
-
1708
- this.completions = new FilteredList(matches);
1709
-
1710
- if (this.exactMatch)
1711
- this.completions.exactMatch = true;
1712
-
1713
- this.completions.setFilter(prefix);
1714
- var filtered = this.completions.filtered;
1715
- if (!filtered.length)
1716
- return detachIfFinished(results);
1717
- if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet)
1718
- return detachIfFinished(results);
1719
- if (this.autoInsert && filtered.length == 1 && results.finished)
1720
- return this.insertMatch(filtered[0]);
1721
-
1722
- this.openPopup(this.editor, prefix, keepPopupPosition);
1723
- }.bind(this);
1724
-
1725
- var isImmediate = true;
1726
- var immediateResults = null;
1727
- this.gatherCompletions(this.editor, function(err, results) {
1728
- var prefix = results.prefix;
1729
- var matches = results && results.matches;
1730
-
1731
- if (!matches || !matches.length)
1732
- return detachIfFinished(results);
1733
- if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId)
1734
- return;
1735
- if (isImmediate) {
1736
- immediateResults = results;
1737
- return;
1799
+ var session = this.editor.getSession();
1800
+ var pos = this.editor.getCursorPosition();
1801
+ var prefix = util.getCompletionPrefix(this.editor);
1802
+ this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
1803
+ this.base.$insertRight = true;
1804
+ var completionOptions = {
1805
+ exactMatch: this.exactMatch,
1806
+ ignoreCaption: this.ignoreCaption
1807
+ };
1808
+ this.getCompletionProvider({
1809
+ prefix: prefix,
1810
+ pos: pos
1811
+ }).provideCompletions(this.editor, completionOptions, function (err, completions, finished) {
1812
+ var filtered = completions.filtered;
1813
+ var prefix = util.getCompletionPrefix(this.editor);
1814
+ this.$firstOpenTimer.cancel();
1815
+ if (finished) {
1816
+ if (!filtered.length) {
1817
+ var emptyMessage = !this.autoShown && this.emptyMessage;
1818
+ if (typeof emptyMessage == "function")
1819
+ emptyMessage = this.emptyMessage(prefix);
1820
+ if (emptyMessage) {
1821
+ var completionsForEmpty = [{
1822
+ caption: emptyMessage,
1823
+ value: ""
1824
+ }];
1825
+ this.completions = new FilteredList(completionsForEmpty);
1826
+ this.openPopup(this.editor, prefix, keepPopupPosition);
1827
+ return;
1828
+ }
1829
+ return this.detach();
1830
+ }
1831
+ if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet)
1832
+ return this.detach();
1833
+ if (this.autoInsert && !this.autoShown && filtered.length == 1)
1834
+ return this.insertMatch(filtered[0]);
1738
1835
  }
1739
-
1740
- processResults(results);
1836
+ this.completions = completions;
1837
+ this.openPopup(this.editor, prefix, keepPopupPosition);
1838
+ this.popup.renderer.setStyle("ace_loading", !finished);
1741
1839
  }.bind(this));
1742
-
1743
- isImmediate = false;
1744
- if (immediateResults) {
1745
- var results = immediateResults;
1746
- immediateResults = null;
1747
- processResults(results);
1840
+ if (!this.autoShown && !(this.popup && this.popup.isOpen)) {
1841
+ this.$firstOpenTimer.delay(this.stickySelectionDelay / 2);
1748
1842
  }
1749
1843
  };
1750
-
1751
- this.cancelContextMenu = function() {
1844
+ Autocomplete.prototype.cancelContextMenu = function () {
1752
1845
  this.editor.$mouseHandler.cancelContextMenu();
1753
1846
  };
1754
-
1755
- this.updateDocTooltip = function() {
1847
+ Autocomplete.prototype.updateDocTooltip = function () {
1756
1848
  var popup = this.popup;
1757
- var all = popup.data;
1849
+ var all = this.completions.filtered;
1758
1850
  var selected = all && (all[popup.getHoveredRow()] || all[popup.getRow()]);
1759
1851
  var doc = null;
1760
1852
  if (!selected || !this.editor || !this.popup.isOpen)
1761
1853
  return this.hideDocTooltip();
1762
- this.editor.completers.some(function(completer) {
1763
- if (completer.getDocTooltip)
1854
+ var completersLength = this.editor.completers.length;
1855
+ for (var i = 0; i < completersLength; i++) {
1856
+ var completer = this.editor.completers[i];
1857
+ if (completer.getDocTooltip && selected.completerId === completer.id) {
1764
1858
  doc = completer.getDocTooltip(selected);
1765
- return doc;
1766
- });
1859
+ break;
1860
+ }
1861
+ }
1767
1862
  if (!doc && typeof selected != "string")
1768
1863
  doc = selected;
1769
-
1770
1864
  if (typeof doc == "string")
1771
- doc = {docText: doc};
1865
+ doc = { docText: doc };
1772
1866
  if (!doc || !(doc.docHTML || doc.docText))
1773
1867
  return this.hideDocTooltip();
1774
1868
  this.showDocTooltip(doc);
1775
1869
  };
1776
-
1777
- this.showDocTooltip = function(item) {
1870
+ Autocomplete.prototype.showDocTooltip = function (item) {
1778
1871
  if (!this.tooltipNode) {
1779
1872
  this.tooltipNode = dom.createElement("div");
1780
- this.tooltipNode.className = "ace_tooltip ace_doc-tooltip";
1781
1873
  this.tooltipNode.style.margin = 0;
1782
1874
  this.tooltipNode.style.pointerEvents = "auto";
1783
1875
  this.tooltipNode.tabIndex = -1;
1784
1876
  this.tooltipNode.onblur = this.blurListener.bind(this);
1785
1877
  this.tooltipNode.onclick = this.onTooltipClick.bind(this);
1878
+ this.tooltipNode.id = "doc-tooltip";
1879
+ this.tooltipNode.setAttribute("role", "tooltip");
1786
1880
  }
1787
-
1881
+ var theme = this.editor.renderer.theme;
1882
+ this.tooltipNode.className = "ace_tooltip ace_doc-tooltip " +
1883
+ (theme.isDark ? "ace_dark " : "") + (theme.cssClass || "");
1788
1884
  var tooltipNode = this.tooltipNode;
1789
1885
  if (item.docHTML) {
1790
1886
  tooltipNode.innerHTML = item.docHTML;
1791
- } else if (item.docText) {
1887
+ }
1888
+ else if (item.docText) {
1792
1889
  tooltipNode.textContent = item.docText;
1793
1890
  }
1794
-
1795
1891
  if (!tooltipNode.parentNode)
1796
- document.body.appendChild(tooltipNode);
1892
+ this.popup.container.appendChild(this.tooltipNode);
1797
1893
  var popup = this.popup;
1798
1894
  var rect = popup.container.getBoundingClientRect();
1799
1895
  tooltipNode.style.top = popup.container.style.top;
1800
1896
  tooltipNode.style.bottom = popup.container.style.bottom;
1801
-
1802
1897
  tooltipNode.style.display = "block";
1803
1898
  if (window.innerWidth - rect.right < 320) {
1804
1899
  if (rect.left < 320) {
1805
- if(popup.isTopdown) {
1900
+ if (popup.isTopdown) {
1806
1901
  tooltipNode.style.top = rect.bottom + "px";
1807
1902
  tooltipNode.style.left = rect.left + "px";
1808
1903
  tooltipNode.style.right = "";
1809
1904
  tooltipNode.style.bottom = "";
1810
- } else {
1905
+ }
1906
+ else {
1811
1907
  tooltipNode.style.top = popup.container.offsetTop - tooltipNode.offsetHeight + "px";
1812
1908
  tooltipNode.style.left = rect.left + "px";
1813
1909
  tooltipNode.style.right = "";
1814
1910
  tooltipNode.style.bottom = "";
1815
1911
  }
1816
- } else {
1912
+ }
1913
+ else {
1817
1914
  tooltipNode.style.right = window.innerWidth - rect.left + "px";
1818
1915
  tooltipNode.style.left = "";
1819
1916
  }
1820
- } else {
1917
+ }
1918
+ else {
1821
1919
  tooltipNode.style.left = (rect.right + 1) + "px";
1822
1920
  tooltipNode.style.right = "";
1823
1921
  }
1824
1922
  };
1825
-
1826
- this.hideDocTooltip = function() {
1923
+ Autocomplete.prototype.hideDocTooltip = function () {
1827
1924
  this.tooltipTimer.cancel();
1828
- if (!this.tooltipNode) return;
1925
+ if (!this.tooltipNode)
1926
+ return;
1829
1927
  var el = this.tooltipNode;
1830
1928
  if (!this.editor.isFocused() && document.activeElement == el)
1831
1929
  this.editor.focus();
@@ -1833,8 +1931,7 @@ var Autocomplete = function() {
1833
1931
  if (el.parentNode)
1834
1932
  el.parentNode.removeChild(el);
1835
1933
  };
1836
-
1837
- this.onTooltipClick = function(e) {
1934
+ Autocomplete.prototype.onTooltipClick = function (e) {
1838
1935
  var a = e.target;
1839
1936
  while (a && a != this.tooltipNode) {
1840
1937
  if (a.nodeName == "A" && a.href) {
@@ -1845,8 +1942,7 @@ var Autocomplete = function() {
1845
1942
  a = a.parentNode;
1846
1943
  }
1847
1944
  };
1848
-
1849
- this.destroy = function() {
1945
+ Autocomplete.prototype.destroy = function () {
1850
1946
  this.detach();
1851
1947
  if (this.popup) {
1852
1948
  this.popup.destroy();
@@ -1854,92 +1950,246 @@ var Autocomplete = function() {
1854
1950
  if (el && el.parentNode)
1855
1951
  el.parentNode.removeChild(el);
1856
1952
  }
1857
- if (this.editor && this.editor.completer == this)
1858
- this.editor.completer == null;
1859
- this.popup = null;
1860
- };
1861
-
1862
- }).call(Autocomplete.prototype);
1863
-
1864
-
1865
- Autocomplete.for = function(editor) {
1866
- if (editor.completer) {
1953
+ if (this.editor && this.editor.completer == this) {
1954
+ this.editor.off("destroy", destroyCompleter);
1955
+ this.editor.completer = null;
1956
+ }
1957
+ this.inlineRenderer = this.popup = this.editor = null;
1958
+ };
1959
+ return Autocomplete;
1960
+ }());
1961
+ Autocomplete.prototype.commands = {
1962
+ "Up": function (editor) { editor.completer.goTo("up"); },
1963
+ "Down": function (editor) { editor.completer.goTo("down"); },
1964
+ "Ctrl-Up|Ctrl-Home": function (editor) { editor.completer.goTo("start"); },
1965
+ "Ctrl-Down|Ctrl-End": function (editor) { editor.completer.goTo("end"); },
1966
+ "Esc": function (editor) { editor.completer.detach(); },
1967
+ "Return": function (editor) { return editor.completer.insertMatch(); },
1968
+ "Shift-Return": function (editor) { editor.completer.insertMatch(null, { deleteSuffix: true }); },
1969
+ "Tab": function (editor) {
1970
+ var result = editor.completer.insertMatch();
1971
+ if (!result && !editor.tabstopManager)
1972
+ editor.completer.goTo("down");
1973
+ else
1974
+ return result;
1975
+ },
1976
+ "PageUp": function (editor) { editor.completer.popup.gotoPageUp(); },
1977
+ "PageDown": function (editor) { editor.completer.popup.gotoPageDown(); }
1978
+ };
1979
+ Autocomplete.for = function (editor) {
1980
+ if (editor.completer instanceof Autocomplete) {
1867
1981
  return editor.completer;
1868
1982
  }
1983
+ if (editor.completer) {
1984
+ editor.completer.destroy();
1985
+ editor.completer = null;
1986
+ }
1869
1987
  if (config.get("sharedPopups")) {
1870
- if (!Autocomplete.$shared)
1988
+ if (!Autocomplete.$sharedInstance)
1871
1989
  Autocomplete.$sharedInstance = new Autocomplete();
1872
1990
  editor.completer = Autocomplete.$sharedInstance;
1873
- } else {
1991
+ }
1992
+ else {
1874
1993
  editor.completer = new Autocomplete();
1875
- editor.once("destroy", function(e, editor) {
1876
- editor.completer.destroy();
1877
- });
1994
+ editor.once("destroy", destroyCompleter);
1878
1995
  }
1879
1996
  return editor.completer;
1880
1997
  };
1881
-
1882
1998
  Autocomplete.startCommand = {
1883
1999
  name: "startAutocomplete",
1884
- exec: function(editor, options) {
2000
+ exec: function (editor, options) {
1885
2001
  var completer = Autocomplete.for(editor);
1886
2002
  completer.autoInsert = false;
1887
2003
  completer.autoSelect = true;
2004
+ completer.autoShown = false;
1888
2005
  completer.showPopup(editor, options);
1889
2006
  completer.cancelContextMenu();
1890
2007
  },
1891
2008
  bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
1892
2009
  };
1893
-
1894
- var FilteredList = function(array, filterText) {
1895
- this.all = array;
1896
- this.filtered = array;
1897
- this.filterText = filterText || "";
1898
- this.exactMatch = false;
1899
- };
1900
- (function(){
1901
- this.setFilter = function(str) {
2010
+ var CompletionProvider = /** @class */ (function () {
2011
+ function CompletionProvider(initialPosition) {
2012
+ this.initialPosition = initialPosition;
2013
+ this.active = true;
2014
+ }
2015
+ CompletionProvider.prototype.insertByIndex = function (editor, index, options) {
2016
+ if (!this.completions || !this.completions.filtered) {
2017
+ return false;
2018
+ }
2019
+ return this.insertMatch(editor, this.completions.filtered[index], options);
2020
+ };
2021
+ CompletionProvider.prototype.insertMatch = function (editor, data, options) {
2022
+ if (!data)
2023
+ return false;
2024
+ editor.startOperation({ command: { name: "insertMatch" } });
2025
+ if (data.completer && data.completer.insertMatch) {
2026
+ data.completer.insertMatch(editor, data);
2027
+ }
2028
+ else {
2029
+ if (!this.completions)
2030
+ return false;
2031
+ var replaceBefore = this.completions.filterText.length;
2032
+ var replaceAfter = 0;
2033
+ if (data.range && data.range.start.row === data.range.end.row) {
2034
+ replaceBefore -= this.initialPosition.prefix.length;
2035
+ replaceBefore += this.initialPosition.pos.column - data.range.start.column;
2036
+ replaceAfter += data.range.end.column - this.initialPosition.pos.column;
2037
+ }
2038
+ if (replaceBefore || replaceAfter) {
2039
+ var ranges;
2040
+ if (editor.selection.getAllRanges) {
2041
+ ranges = editor.selection.getAllRanges();
2042
+ }
2043
+ else {
2044
+ ranges = [editor.getSelectionRange()];
2045
+ }
2046
+ for (var i = 0, range; range = ranges[i]; i++) {
2047
+ range.start.column -= replaceBefore;
2048
+ range.end.column += replaceAfter;
2049
+ editor.session.remove(range);
2050
+ }
2051
+ }
2052
+ if (data.snippet) {
2053
+ snippetManager.insertSnippet(editor, data.snippet);
2054
+ }
2055
+ else {
2056
+ this.$insertString(editor, data);
2057
+ }
2058
+ if (data.command && data.command === "startAutocomplete") {
2059
+ editor.execCommand(data.command);
2060
+ }
2061
+ }
2062
+ editor.endOperation();
2063
+ return true;
2064
+ };
2065
+ CompletionProvider.prototype.$insertString = function (editor, data) {
2066
+ var text = data.value || data;
2067
+ editor.execCommand("insertstring", text);
2068
+ };
2069
+ CompletionProvider.prototype.gatherCompletions = function (editor, callback) {
2070
+ var session = editor.getSession();
2071
+ var pos = editor.getCursorPosition();
2072
+ var prefix = util.getCompletionPrefix(editor);
2073
+ var matches = [];
2074
+ this.completers = editor.completers;
2075
+ var total = editor.completers.length;
2076
+ editor.completers.forEach(function (completer, i) {
2077
+ completer.getCompletions(editor, session, pos, prefix, function (err, results) {
2078
+ if (completer.hideInlinePreview)
2079
+ results = results.map(function (result) {
2080
+ return Object.assign(result, { hideInlinePreview: completer.hideInlinePreview });
2081
+ });
2082
+ if (!err && results)
2083
+ matches = matches.concat(results);
2084
+ callback(null, {
2085
+ prefix: util.getCompletionPrefix(editor),
2086
+ matches: matches,
2087
+ finished: (--total === 0)
2088
+ });
2089
+ });
2090
+ });
2091
+ return true;
2092
+ };
2093
+ CompletionProvider.prototype.provideCompletions = function (editor, options, callback) {
2094
+ var processResults = function (results) {
2095
+ var prefix = results.prefix;
2096
+ var matches = results.matches;
2097
+ this.completions = new FilteredList(matches);
2098
+ if (options.exactMatch)
2099
+ this.completions.exactMatch = true;
2100
+ if (options.ignoreCaption)
2101
+ this.completions.ignoreCaption = true;
2102
+ this.completions.setFilter(prefix);
2103
+ if (results.finished || this.completions.filtered.length)
2104
+ callback(null, this.completions, results.finished);
2105
+ }.bind(this);
2106
+ var isImmediate = true;
2107
+ var immediateResults = null;
2108
+ this.gatherCompletions(editor, function (err, results) {
2109
+ if (!this.active) {
2110
+ return;
2111
+ }
2112
+ if (err) {
2113
+ callback(err, [], true);
2114
+ this.detach();
2115
+ }
2116
+ var prefix = results.prefix;
2117
+ if (prefix.indexOf(results.prefix) !== 0)
2118
+ return;
2119
+ if (isImmediate) {
2120
+ immediateResults = results;
2121
+ return;
2122
+ }
2123
+ processResults(results);
2124
+ }.bind(this));
2125
+ isImmediate = false;
2126
+ if (immediateResults) {
2127
+ var results = immediateResults;
2128
+ immediateResults = null;
2129
+ processResults(results);
2130
+ }
2131
+ };
2132
+ CompletionProvider.prototype.detach = function () {
2133
+ this.active = false;
2134
+ this.completers && this.completers.forEach(function (completer) {
2135
+ if (typeof completer.cancel === "function") {
2136
+ completer.cancel();
2137
+ }
2138
+ });
2139
+ };
2140
+ return CompletionProvider;
2141
+ }());
2142
+ var FilteredList = /** @class */ (function () {
2143
+ function FilteredList(array, filterText) {
2144
+ this.all = array;
2145
+ this.filtered = array;
2146
+ this.filterText = filterText || "";
2147
+ this.exactMatch = false;
2148
+ this.ignoreCaption = false;
2149
+ }
2150
+ FilteredList.prototype.setFilter = function (str) {
1902
2151
  if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0)
1903
2152
  var matches = this.filtered;
1904
2153
  else
1905
2154
  var matches = this.all;
1906
-
1907
2155
  this.filterText = str;
1908
2156
  matches = this.filterCompletions(matches, this.filterText);
1909
- matches = matches.sort(function(a, b) {
1910
- return b.exactMatch - a.exactMatch || b.$score - a.$score
2157
+ matches = matches.sort(function (a, b) {
2158
+ return b.exactMatch - a.exactMatch || b.$score - a.$score
1911
2159
  || (a.caption || a.value).localeCompare(b.caption || b.value);
1912
2160
  });
1913
2161
  var prev = null;
1914
- matches = matches.filter(function(item){
2162
+ matches = matches.filter(function (item) {
1915
2163
  var caption = item.snippet || item.caption || item.value;
1916
- if (caption === prev) return false;
2164
+ if (caption === prev)
2165
+ return false;
1917
2166
  prev = caption;
1918
2167
  return true;
1919
2168
  });
1920
-
1921
2169
  this.filtered = matches;
1922
2170
  };
1923
- this.filterCompletions = function(items, needle) {
2171
+ FilteredList.prototype.filterCompletions = function (items, needle) {
1924
2172
  var results = [];
1925
2173
  var upper = needle.toUpperCase();
1926
2174
  var lower = needle.toLowerCase();
1927
2175
  loop: for (var i = 0, item; item = items[i]; i++) {
1928
- var caption = item.caption || item.value || item.snippet;
1929
- if (!caption) continue;
2176
+ var caption = (!this.ignoreCaption && item.caption) || item.value || item.snippet;
2177
+ if (!caption)
2178
+ continue;
1930
2179
  var lastIndex = -1;
1931
2180
  var matchMask = 0;
1932
2181
  var penalty = 0;
1933
2182
  var index, distance;
1934
-
1935
2183
  if (this.exactMatch) {
1936
2184
  if (needle !== caption.substr(0, needle.length))
1937
2185
  continue loop;
1938
- } else {
2186
+ }
2187
+ else {
1939
2188
  var fullMatchIndex = caption.toLowerCase().indexOf(lower);
1940
2189
  if (fullMatchIndex > -1) {
1941
2190
  penalty = fullMatchIndex;
1942
- } else {
2191
+ }
2192
+ else {
1943
2193
  for (var j = 0; j < needle.length; j++) {
1944
2194
  var i1 = caption.indexOf(lower[j], lastIndex + 1);
1945
2195
  var i2 = caption.indexOf(upper[j], lastIndex + 1);
@@ -1964,90 +2214,34 @@ var FilteredList = function(array, filterText) {
1964
2214
  }
1965
2215
  return results;
1966
2216
  };
1967
- }).call(FilteredList.prototype);
1968
-
2217
+ return FilteredList;
2218
+ }());
1969
2219
  exports.Autocomplete = Autocomplete;
2220
+ exports.CompletionProvider = CompletionProvider;
1970
2221
  exports.FilteredList = FilteredList;
1971
2222
 
1972
2223
  });
1973
2224
 
1974
- ace.define("ace/ext/menu_tools/overlay_page",[], function(require, exports, module) {
2225
+ ace.define("ace/ext/menu_tools/settings_menu.css",["require","exports","module"], function(require, exports, module){module.exports = "#ace_settingsmenu, #kbshortcutmenu {\n background-color: #F7F7F7;\n color: black;\n box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\n padding: 1em 0.5em 2em 1em;\n overflow: auto;\n position: absolute;\n margin: 0;\n bottom: 0;\n right: 0;\n top: 0;\n z-index: 9991;\n cursor: default;\n}\n\n.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\n box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\n background-color: rgba(255, 255, 255, 0.6);\n color: black;\n}\n\n.ace_optionsMenuEntry:hover {\n background-color: rgba(100, 100, 100, 0.1);\n transition: all 0.3s\n}\n\n.ace_closeButton {\n background: rgba(245, 146, 146, 0.5);\n border: 1px solid #F48A8A;\n border-radius: 50%;\n padding: 7px;\n position: absolute;\n right: -8px;\n top: -8px;\n z-index: 100000;\n}\n.ace_closeButton{\n background: rgba(245, 146, 146, 0.9);\n}\n.ace_optionsMenuKey {\n color: darkslateblue;\n font-weight: bold;\n}\n.ace_optionsMenuCommand {\n color: darkcyan;\n font-weight: normal;\n}\n.ace_optionsMenuEntry input, .ace_optionsMenuEntry button {\n vertical-align: middle;\n}\n\n.ace_optionsMenuEntry button[ace_selected_button=true] {\n background: #e7e7e7;\n box-shadow: 1px 0px 2px 0px #adadad inset;\n border-color: #adadad;\n}\n.ace_optionsMenuEntry button {\n background: white;\n border: 1px solid lightgray;\n margin: 0px;\n}\n.ace_optionsMenuEntry button:hover{\n background: #f0f0f0;\n}";
2226
+
2227
+ });
2228
+
2229
+ ace.define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/lib/dom","ace/ext/menu_tools/settings_menu.css"], function(require, exports, module){/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
1975
2230
  'use strict';
1976
2231
  var dom = require("../../lib/dom");
1977
- var cssText = "#ace_settingsmenu, #kbshortcutmenu {\
1978
- background-color: #F7F7F7;\
1979
- color: black;\
1980
- box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\
1981
- padding: 1em 0.5em 2em 1em;\
1982
- overflow: auto;\
1983
- position: absolute;\
1984
- margin: 0;\
1985
- bottom: 0;\
1986
- right: 0;\
1987
- top: 0;\
1988
- z-index: 9991;\
1989
- cursor: default;\
1990
- }\
1991
- .ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\
1992
- box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\
1993
- background-color: rgba(255, 255, 255, 0.6);\
1994
- color: black;\
1995
- }\
1996
- .ace_optionsMenuEntry:hover {\
1997
- background-color: rgba(100, 100, 100, 0.1);\
1998
- transition: all 0.3s\
1999
- }\
2000
- .ace_closeButton {\
2001
- background: rgba(245, 146, 146, 0.5);\
2002
- border: 1px solid #F48A8A;\
2003
- border-radius: 50%;\
2004
- padding: 7px;\
2005
- position: absolute;\
2006
- right: -8px;\
2007
- top: -8px;\
2008
- z-index: 100000;\
2009
- }\
2010
- .ace_closeButton{\
2011
- background: rgba(245, 146, 146, 0.9);\
2012
- }\
2013
- .ace_optionsMenuKey {\
2014
- color: darkslateblue;\
2015
- font-weight: bold;\
2016
- }\
2017
- .ace_optionsMenuCommand {\
2018
- color: darkcyan;\
2019
- font-weight: normal;\
2020
- }\
2021
- .ace_optionsMenuEntry input, .ace_optionsMenuEntry button {\
2022
- vertical-align: middle;\
2023
- }\
2024
- .ace_optionsMenuEntry button[ace_selected_button=true] {\
2025
- background: #e7e7e7;\
2026
- box-shadow: 1px 0px 2px 0px #adadad inset;\
2027
- border-color: #adadad;\
2028
- }\
2029
- .ace_optionsMenuEntry button {\
2030
- background: white;\
2031
- border: 1px solid lightgray;\
2032
- margin: 0px;\
2033
- }\
2034
- .ace_optionsMenuEntry button:hover{\
2035
- background: #f0f0f0;\
2036
- }";
2232
+ var cssText = require("./settings_menu.css");
2037
2233
  dom.importCssString(cssText, "settings_menu.css", false);
2038
-
2039
2234
  module.exports.overlayPage = function overlayPage(editor, contentElement, callback) {
2040
2235
  var closer = document.createElement('div');
2041
2236
  var ignoreFocusOut = false;
2042
-
2043
2237
  function documentEscListener(e) {
2044
2238
  if (e.keyCode === 27) {
2045
2239
  close();
2046
2240
  }
2047
2241
  }
2048
-
2049
2242
  function close() {
2050
- if (!closer) return;
2243
+ if (!closer)
2244
+ return;
2051
2245
  document.removeEventListener('keydown', documentEscListener);
2052
2246
  closer.parentNode.removeChild(closer);
2053
2247
  if (editor) {
@@ -2063,22 +2257,19 @@ module.exports.overlayPage = function overlayPage(editor, contentElement, callba
2063
2257
  contentElement.style.pointerEvents = "auto";
2064
2258
  }
2065
2259
  }
2066
-
2067
2260
  closer.style.cssText = 'margin: 0; padding: 0; ' +
2068
2261
  'position: fixed; top:0; bottom:0; left:0; right:0;' +
2069
2262
  'z-index: 9990; ' +
2070
2263
  (editor ? 'background-color: rgba(0, 0, 0, 0.3);' : '');
2071
- closer.addEventListener('click', function(e) {
2264
+ closer.addEventListener('click', function (e) {
2072
2265
  if (!ignoreFocusOut) {
2073
2266
  close();
2074
2267
  }
2075
2268
  });
2076
2269
  document.addEventListener('keydown', documentEscListener);
2077
-
2078
2270
  contentElement.addEventListener('click', function (e) {
2079
2271
  e.stopPropagation();
2080
2272
  });
2081
-
2082
2273
  closer.appendChild(contentElement);
2083
2274
  document.body.appendChild(closer);
2084
2275
  if (editor) {
@@ -2092,9 +2283,7 @@ module.exports.overlayPage = function overlayPage(editor, contentElement, callba
2092
2283
 
2093
2284
  });
2094
2285
 
2095
- ace.define("ace/ext/modelist",[], function(require, exports, module) {
2096
- "use strict";
2097
-
2286
+ ace.define("ace/ext/modelist",["require","exports","module"], function(require, exports, module){"use strict";
2098
2287
  var modes = [];
2099
2288
  function getModeForPath(path) {
2100
2289
  var mode = modesByName.text;
@@ -2107,198 +2296,215 @@ function getModeForPath(path) {
2107
2296
  }
2108
2297
  return mode;
2109
2298
  }
2110
-
2111
- var Mode = function(name, caption, extensions) {
2112
- this.name = name;
2113
- this.caption = caption;
2114
- this.mode = "ace/mode/" + name;
2115
- this.extensions = extensions;
2116
- var re;
2117
- if (/\^/.test(extensions)) {
2118
- re = extensions.replace(/\|(\^)?/g, function(a, b){
2119
- return "$|" + (b ? "^" : "^.*\\.");
2120
- }) + "$";
2121
- } else {
2122
- re = "^.*\\.(" + extensions + ")$";
2299
+ var Mode = /** @class */ (function () {
2300
+ function Mode(name, caption, extensions) {
2301
+ this.name = name;
2302
+ this.caption = caption;
2303
+ this.mode = "ace/mode/" + name;
2304
+ this.extensions = extensions;
2305
+ var re;
2306
+ if (/\^/.test(extensions)) {
2307
+ re = extensions.replace(/\|(\^)?/g, function (a, b) {
2308
+ return "$|" + (b ? "^" : "^.*\\.");
2309
+ }) + "$";
2310
+ }
2311
+ else {
2312
+ re = "^.*\\.(" + extensions + ")$";
2313
+ }
2314
+ this.extRe = new RegExp(re, "gi");
2123
2315
  }
2124
-
2125
- this.extRe = new RegExp(re, "gi");
2126
- };
2127
-
2128
- Mode.prototype.supportsFile = function(filename) {
2129
- return filename.match(this.extRe);
2130
- };
2316
+ Mode.prototype.supportsFile = function (filename) {
2317
+ return filename.match(this.extRe);
2318
+ };
2319
+ return Mode;
2320
+ }());
2131
2321
  var supportedModes = {
2132
- ABAP: ["abap"],
2133
- ABC: ["abc"],
2134
- ActionScript:["as"],
2135
- ADA: ["ada|adb"],
2136
- Alda: ["alda"],
2322
+ ABAP: ["abap"],
2323
+ ABC: ["abc"],
2324
+ ActionScript: ["as"],
2325
+ ADA: ["ada|adb"],
2326
+ Alda: ["alda"],
2137
2327
  Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
2138
- Apex: ["apex|cls|trigger|tgr"],
2139
- AQL: ["aql"],
2140
- AsciiDoc: ["asciidoc|adoc"],
2141
- ASL: ["dsl|asl|asl.json"],
2142
- Assembly_x86:["asm|a"],
2143
- AutoHotKey: ["ahk"],
2144
- BatchFile: ["bat|cmd"],
2145
- C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
2146
- C9Search: ["c9search_results"],
2147
- Cirru: ["cirru|cr"],
2148
- Clojure: ["clj|cljs"],
2149
- Cobol: ["CBL|COB"],
2150
- coffee: ["coffee|cf|cson|^Cakefile"],
2151
- ColdFusion: ["cfm"],
2152
- Crystal: ["cr"],
2153
- CSharp: ["cs"],
2328
+ Apex: ["apex|cls|trigger|tgr"],
2329
+ AQL: ["aql"],
2330
+ AsciiDoc: ["asciidoc|adoc"],
2331
+ ASL: ["dsl|asl|asl.json"],
2332
+ Assembly_x86: ["asm|a"],
2333
+ Astro: ["astro"],
2334
+ AutoHotKey: ["ahk"],
2335
+ BatchFile: ["bat|cmd"],
2336
+ BibTeX: ["bib"],
2337
+ C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
2338
+ C9Search: ["c9search_results"],
2339
+ Cirru: ["cirru|cr"],
2340
+ Clojure: ["clj|cljs"],
2341
+ Cobol: ["CBL|COB"],
2342
+ coffee: ["coffee|cf|cson|^Cakefile"],
2343
+ ColdFusion: ["cfm|cfc"],
2344
+ Crystal: ["cr"],
2345
+ CSharp: ["cs"],
2154
2346
  Csound_Document: ["csd"],
2155
2347
  Csound_Orchestra: ["orc"],
2156
2348
  Csound_Score: ["sco"],
2157
- CSS: ["css"],
2158
- Curly: ["curly"],
2159
- D: ["d|di"],
2160
- Dart: ["dart"],
2161
- Diff: ["diff|patch"],
2162
- Dockerfile: ["^Dockerfile"],
2163
- Dot: ["dot"],
2164
- Drools: ["drl"],
2165
- Edifact: ["edi"],
2166
- Eiffel: ["e|ge"],
2167
- EJS: ["ejs"],
2168
- Elixir: ["ex|exs"],
2169
- Elm: ["elm"],
2170
- Erlang: ["erl|hrl"],
2171
- Forth: ["frt|fs|ldr|fth|4th"],
2172
- Fortran: ["f|f90"],
2173
- FSharp: ["fsi|fs|ml|mli|fsx|fsscript"],
2174
- FSL: ["fsl"],
2175
- FTL: ["ftl"],
2176
- Gcode: ["gcode"],
2177
- Gherkin: ["feature"],
2178
- Gitignore: ["^.gitignore"],
2179
- Glsl: ["glsl|frag|vert"],
2180
- Gobstones: ["gbs"],
2181
- golang: ["go"],
2349
+ CSS: ["css"],
2350
+ Curly: ["curly"],
2351
+ Cuttlefish: ["conf"],
2352
+ D: ["d|di"],
2353
+ Dart: ["dart"],
2354
+ Diff: ["diff|patch"],
2355
+ Django: ["djt|html.djt|dj.html|djhtml"],
2356
+ Dockerfile: ["^Dockerfile"],
2357
+ Dot: ["dot"],
2358
+ Drools: ["drl"],
2359
+ Edifact: ["edi"],
2360
+ Eiffel: ["e|ge"],
2361
+ EJS: ["ejs"],
2362
+ Elixir: ["ex|exs"],
2363
+ Elm: ["elm"],
2364
+ Erlang: ["erl|hrl"],
2365
+ Flix: ["flix"],
2366
+ Forth: ["frt|fs|ldr|fth|4th"],
2367
+ Fortran: ["f|f90"],
2368
+ FSharp: ["fsi|fs|ml|mli|fsx|fsscript"],
2369
+ FSL: ["fsl"],
2370
+ FTL: ["ftl"],
2371
+ Gcode: ["gcode"],
2372
+ Gherkin: ["feature"],
2373
+ Gitignore: ["^.gitignore"],
2374
+ Glsl: ["glsl|frag|vert"],
2375
+ Gobstones: ["gbs"],
2376
+ golang: ["go"],
2182
2377
  GraphQLSchema: ["gql"],
2183
- Groovy: ["groovy"],
2184
- HAML: ["haml"],
2185
- Handlebars: ["hbs|handlebars|tpl|mustache"],
2186
- Haskell: ["hs"],
2378
+ Groovy: ["groovy"],
2379
+ HAML: ["haml"],
2380
+ Handlebars: ["hbs|handlebars|tpl|mustache"],
2381
+ Haskell: ["hs"],
2187
2382
  Haskell_Cabal: ["cabal"],
2188
- haXe: ["hx"],
2189
- Hjson: ["hjson"],
2190
- HTML: ["html|htm|xhtml|vue|we|wpy"],
2383
+ haXe: ["hx"],
2384
+ Hjson: ["hjson"],
2385
+ HTML: ["html|htm|xhtml|vue|we|wpy"],
2191
2386
  HTML_Elixir: ["eex|html.eex"],
2192
- HTML_Ruby: ["erb|rhtml|html.erb"],
2193
- INI: ["ini|conf|cfg|prefs"],
2194
- Io: ["io"],
2195
- Jack: ["jack"],
2196
- Jade: ["jade|pug"],
2197
- Java: ["java"],
2198
- JavaScript: ["js|jsm|jsx"],
2199
- JSON: ["json"],
2200
- JSON5: ["json5"],
2201
- JSONiq: ["jq"],
2202
- JSP: ["jsp"],
2203
- JSSM: ["jssm|jssm_state"],
2204
- JSX: ["jsx"],
2205
- Julia: ["jl"],
2206
- Kotlin: ["kt|kts"],
2207
- LaTeX: ["tex|latex|ltx|bib"],
2208
- Latte: ["latte"],
2209
- LESS: ["less"],
2210
- Liquid: ["liquid"],
2211
- Lisp: ["lisp"],
2212
- LiveScript: ["ls"],
2213
- LogiQL: ["logic|lql"],
2214
- LSL: ["lsl"],
2215
- Lua: ["lua"],
2216
- LuaPage: ["lp"],
2217
- Lucene: ["lucene"],
2218
- Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
2219
- Markdown: ["md|markdown"],
2220
- Mask: ["mask"],
2221
- MATLAB: ["matlab"],
2222
- Maze: ["mz"],
2223
- MediaWiki: ["wiki|mediawiki"],
2224
- MEL: ["mel"],
2225
- MIPS: ["s|asm"],
2226
- MIXAL: ["mixal"],
2227
- MUSHCode: ["mc|mush"],
2228
- MySQL: ["mysql"],
2229
- Nginx: ["nginx|conf"],
2230
- Nim: ["nim"],
2231
- Nix: ["nix"],
2232
- NSIS: ["nsi|nsh"],
2233
- Nunjucks: ["nunjucks|nunjs|nj|njk"],
2234
- ObjectiveC: ["m|mm"],
2235
- OCaml: ["ml|mli"],
2236
- Pascal: ["pas|p"],
2237
- Perl: ["pl|pm"],
2238
- pgSQL: ["pgsql"],
2239
- PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
2387
+ HTML_Ruby: ["erb|rhtml|html.erb"],
2388
+ INI: ["ini|conf|cfg|prefs"],
2389
+ Io: ["io"],
2390
+ Ion: ["ion"],
2391
+ Jack: ["jack"],
2392
+ Jade: ["jade|pug"],
2393
+ Java: ["java"],
2394
+ JavaScript: ["js|jsm|jsx|cjs|mjs"],
2395
+ JEXL: ["jexl"],
2396
+ JSON: ["json"],
2397
+ JSON5: ["json5"],
2398
+ JSONiq: ["jq"],
2399
+ JSP: ["jsp"],
2400
+ JSSM: ["jssm|jssm_state"],
2401
+ JSX: ["jsx"],
2402
+ Julia: ["jl"],
2403
+ Kotlin: ["kt|kts"],
2404
+ LaTeX: ["tex|latex|ltx|bib"],
2405
+ Latte: ["latte"],
2406
+ LESS: ["less"],
2407
+ Liquid: ["liquid"],
2408
+ Lisp: ["lisp"],
2409
+ LiveScript: ["ls"],
2410
+ Log: ["log"],
2411
+ LogiQL: ["logic|lql"],
2412
+ Logtalk: ["lgt"],
2413
+ LSL: ["lsl"],
2414
+ Lua: ["lua"],
2415
+ LuaPage: ["lp"],
2416
+ Lucene: ["lucene"],
2417
+ Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
2418
+ Markdown: ["md|markdown"],
2419
+ Mask: ["mask"],
2420
+ MATLAB: ["matlab"],
2421
+ Maze: ["mz"],
2422
+ MediaWiki: ["wiki|mediawiki"],
2423
+ MEL: ["mel"],
2424
+ MIPS: ["s|asm"],
2425
+ MIXAL: ["mixal"],
2426
+ MUSHCode: ["mc|mush"],
2427
+ MySQL: ["mysql"],
2428
+ Nasal: ["nas"],
2429
+ Nginx: ["nginx|conf"],
2430
+ Nim: ["nim"],
2431
+ Nix: ["nix"],
2432
+ NSIS: ["nsi|nsh"],
2433
+ Nunjucks: ["nunjucks|nunjs|nj|njk"],
2434
+ ObjectiveC: ["m|mm"],
2435
+ OCaml: ["ml|mli"],
2436
+ Odin: ["odin"],
2437
+ PartiQL: ["partiql|pql"],
2438
+ Pascal: ["pas|p"],
2439
+ Perl: ["pl|pm"],
2440
+ pgSQL: ["pgsql"],
2441
+ PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
2240
2442
  PHP_Laravel_blade: ["blade.php"],
2241
- Pig: ["pig"],
2242
- Powershell: ["ps1"],
2243
- Praat: ["praat|praatscript|psc|proc"],
2244
- Prisma: ["prisma"],
2245
- Prolog: ["plg|prolog"],
2246
- Properties: ["properties"],
2247
- Protobuf: ["proto"],
2248
- Puppet: ["epp|pp"],
2249
- Python: ["py"],
2250
- QML: ["qml"],
2251
- R: ["r"],
2252
- Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"],
2253
- Razor: ["cshtml|asp"],
2254
- RDoc: ["Rd"],
2255
- Red: ["red|reds"],
2256
- RHTML: ["Rhtml"],
2257
- RST: ["rst"],
2258
- Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
2259
- Rust: ["rs"],
2260
- SASS: ["sass"],
2261
- SCAD: ["scad"],
2262
- Scala: ["scala|sbt"],
2263
- Scheme: ["scm|sm|rkt|oak|scheme"],
2264
- Scrypt: ["scrypt"],
2265
- SCSS: ["scss"],
2266
- SH: ["sh|bash|^.bashrc"],
2267
- SJS: ["sjs"],
2268
- Slim: ["slim|skim"],
2269
- Smarty: ["smarty|tpl"],
2270
- Smithy: ["smithy"],
2271
- snippets: ["snippets"],
2272
- Soy_Template:["soy"],
2273
- Space: ["space"],
2274
- SQL: ["sql"],
2275
- SQLServer: ["sqlserver"],
2276
- Stylus: ["styl|stylus"],
2277
- SVG: ["svg"],
2278
- Swift: ["swift"],
2279
- Tcl: ["tcl"],
2280
- Terraform: ["tf", "tfvars", "terragrunt"],
2281
- Tex: ["tex"],
2282
- Text: ["txt"],
2283
- Textile: ["textile"],
2284
- Toml: ["toml"],
2285
- TSX: ["tsx"],
2286
- Twig: ["twig|swig"],
2287
- Typescript: ["ts|typescript|str"],
2288
- Vala: ["vala"],
2289
- VBScript: ["vbs|vb"],
2290
- Velocity: ["vm"],
2291
- Verilog: ["v|vh|sv|svh"],
2292
- VHDL: ["vhd|vhdl"],
2443
+ Pig: ["pig"],
2444
+ PLSQL: ["plsql"],
2445
+ Powershell: ["ps1"],
2446
+ Praat: ["praat|praatscript|psc|proc"],
2447
+ Prisma: ["prisma"],
2448
+ Prolog: ["plg|prolog"],
2449
+ Properties: ["properties"],
2450
+ Protobuf: ["proto"],
2451
+ PRQL: ["prql"],
2452
+ Puppet: ["epp|pp"],
2453
+ Python: ["py"],
2454
+ QML: ["qml"],
2455
+ R: ["r"],
2456
+ Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"],
2457
+ Razor: ["cshtml|asp"],
2458
+ RDoc: ["Rd"],
2459
+ Red: ["red|reds"],
2460
+ RHTML: ["Rhtml"],
2461
+ Robot: ["robot|resource"],
2462
+ RST: ["rst"],
2463
+ Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
2464
+ Rust: ["rs"],
2465
+ SaC: ["sac"],
2466
+ SASS: ["sass"],
2467
+ SCAD: ["scad"],
2468
+ Scala: ["scala|sbt"],
2469
+ Scheme: ["scm|sm|rkt|oak|scheme"],
2470
+ Scrypt: ["scrypt"],
2471
+ SCSS: ["scss"],
2472
+ SH: ["sh|bash|^.bashrc"],
2473
+ SJS: ["sjs"],
2474
+ Slim: ["slim|skim"],
2475
+ Smarty: ["smarty|tpl"],
2476
+ Smithy: ["smithy"],
2477
+ snippets: ["snippets"],
2478
+ Soy_Template: ["soy"],
2479
+ Space: ["space"],
2480
+ SPARQL: ["rq"],
2481
+ SQL: ["sql"],
2482
+ SQLServer: ["sqlserver"],
2483
+ Stylus: ["styl|stylus"],
2484
+ SVG: ["svg"],
2485
+ Swift: ["swift"],
2486
+ Tcl: ["tcl"],
2487
+ Terraform: ["tf", "tfvars", "terragrunt"],
2488
+ Tex: ["tex"],
2489
+ Text: ["txt"],
2490
+ Textile: ["textile"],
2491
+ Toml: ["toml"],
2492
+ TSX: ["tsx"],
2493
+ Turtle: ["ttl"],
2494
+ Twig: ["twig|swig"],
2495
+ Typescript: ["ts|mts|cts|typescript|str"],
2496
+ Vala: ["vala"],
2497
+ VBScript: ["vbs|vb"],
2498
+ Velocity: ["vm"],
2499
+ Verilog: ["v|vh|sv|svh"],
2500
+ VHDL: ["vhd|vhdl"],
2293
2501
  Visualforce: ["vfp|component|page"],
2294
- Wollok: ["wlk|wpgm|wtest"],
2295
- XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
2296
- XQuery: ["xq"],
2297
- YAML: ["yaml|yml"],
2298
- Zeek: ["zeek|bro"],
2299
- Django: ["html"]
2502
+ Wollok: ["wlk|wpgm|wtest"],
2503
+ XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
2504
+ XQuery: ["xq"],
2505
+ YAML: ["yaml|yml"],
2506
+ Zeek: ["zeek|bro"]
2300
2507
  };
2301
-
2302
2508
  var nameOverrides = {
2303
2509
  ObjectiveC: "Objective-C",
2304
2510
  CSharp: "C#",
@@ -2315,7 +2521,6 @@ var nameOverrides = {
2315
2521
  Perl6: "Perl 6",
2316
2522
  AutoHotKey: "AutoHotkey / AutoIt"
2317
2523
  };
2318
-
2319
2524
  var modesByName = {};
2320
2525
  for (var name in supportedModes) {
2321
2526
  var data = supportedModes[name];
@@ -2325,7 +2530,6 @@ for (var name in supportedModes) {
2325
2530
  modesByName[filename] = mode;
2326
2531
  modes.push(mode);
2327
2532
  }
2328
-
2329
2533
  module.exports = {
2330
2534
  getModeForPath: getModeForPath,
2331
2535
  modes: modes,
@@ -2334,13 +2538,32 @@ module.exports = {
2334
2538
 
2335
2539
  });
2336
2540
 
2337
- ace.define("ace/ext/prompt",[], function(require, exports, module) {
2541
+ ace.define("ace/ext/prompt",["require","exports","module","ace/config","ace/range","ace/lib/dom","ace/autocomplete","ace/autocomplete/popup","ace/autocomplete/popup","ace/undomanager","ace/tokenizer","ace/ext/menu_tools/overlay_page","ace/ext/modelist"], function(require, exports, module){/**
2542
+ * Prompt plugin is used for getting input from user.
2543
+ *
2544
+ * @param {Object} editor Ouside editor related to this prompt. Will be blurred when prompt is open.
2545
+ * @param {String} message Predefined value of prompt input box.
2546
+ * @param {Object} options Cusomizable options for this prompt.
2547
+ * @param {String} options.name Prompt name.
2548
+ * @param {String} options.$type Use prompt of specific type (gotoLine|commands|modes or default if empty).
2549
+ * @param {[start, end]} options.selection Defines which part of the predefined value should be highlited.
2550
+ * @param {Boolean} options.hasDescription Set to true if prompt has description below input box.
2551
+ * @param {String} options.prompt Description below input box.
2552
+ * @param {String} options.placeholder Placeholder for value.
2553
+ * @param {Object} options.$rules Specific rules for input like password or regexp.
2554
+ * @param {Boolean} options.ignoreFocusOut Set to true to keep the prompt open when focus moves to another part of the editor.
2555
+ * @param {Function} options.getCompletions Function for defining list of options for value.
2556
+ * @param {Function} options.getPrefix Function for defining current value prefix.
2557
+ * @param {Function} options.onAccept Function called when Enter is pressed.
2558
+ * @param {Function} options.onInput Function called when input is added to prompt input box.
2559
+ * @param {Function} options.onCancel Function called when Esc|Shift-Esc is pressed.
2560
+ * @param {Function} callback Function called after done.
2561
+ * */
2338
2562
  "use strict";
2339
-
2563
+ var nls = require("../config").nls;
2340
2564
  var Range = require("../range").Range;
2341
2565
  var dom = require("../lib/dom");
2342
- var shortcuts = require("../ext/menu_tools/get_editor_keyboard_shortcuts");
2343
- var FilteredList= require("../autocomplete").FilteredList;
2566
+ var FilteredList = require("../autocomplete").FilteredList;
2344
2567
  var AcePopup = require('../autocomplete/popup').AcePopup;
2345
2568
  var $singleLineEditor = require('../autocomplete/popup').$singleLineEditor;
2346
2569
  var UndoManager = require("../undomanager").UndoManager;
@@ -2348,7 +2571,6 @@ var Tokenizer = require("../tokenizer").Tokenizer;
2348
2571
  var overlayPage = require("./menu_tools/overlay_page").overlayPage;
2349
2572
  var modelist = require("./modelist");
2350
2573
  var openPrompt;
2351
-
2352
2574
  function prompt(editor, message, options, callback) {
2353
2575
  if (typeof message == "object") {
2354
2576
  return prompt(editor, "", message, options);
@@ -2361,15 +2583,12 @@ function prompt(editor, message, options, callback) {
2361
2583
  return;
2362
2584
  }
2363
2585
  if (options.$type)
2364
- return prompt[options.$type](editor, callback);
2365
-
2586
+ return prompt[options.$type](editor, callback);
2366
2587
  var cmdLine = $singleLineEditor();
2367
2588
  cmdLine.session.setUndoManager(new UndoManager());
2368
-
2369
- var el = dom.buildDom(["div", {class: "ace_prompt_container" + (options.hasDescription ? " input-box-with-description" : "")}]);
2589
+ var el = dom.buildDom(["div", { class: "ace_prompt_container" + (options.hasDescription ? " input-box-with-description" : "") }]);
2370
2590
  var overlay = overlayPage(editor, el, done);
2371
2591
  el.appendChild(cmdLine.container);
2372
-
2373
2592
  if (editor) {
2374
2593
  editor.cmdLine = cmdLine;
2375
2594
  cmdLine.setOption("fontSize", editor.getOption("fontSize"));
@@ -2383,7 +2602,6 @@ function prompt(editor, message, options, callback) {
2383
2602
  end: cmdLine.session.doc.indexToPosition(options.selection[1])
2384
2603
  });
2385
2604
  }
2386
-
2387
2605
  if (options.getCompletions) {
2388
2606
  var popup = new AcePopup();
2389
2607
  popup.renderer.setStyle("ace_autocomplete_inline");
@@ -2395,7 +2613,7 @@ function prompt(editor, message, options, callback) {
2395
2613
  popup.autoSelect = false;
2396
2614
  popup.renderer.$maxLines = 15;
2397
2615
  popup.setRow(-1);
2398
- popup.on("click", function(e) {
2616
+ popup.on("click", function (e) {
2399
2617
  var data = popup.getData(popup.getRow());
2400
2618
  if (!data.error) {
2401
2619
  cmdLine.setValue(data.value || data.name || data);
@@ -2406,29 +2624,25 @@ function prompt(editor, message, options, callback) {
2406
2624
  el.appendChild(popup.container);
2407
2625
  updateCompletions();
2408
2626
  }
2409
-
2410
2627
  if (options.$rules) {
2411
2628
  var tokenizer = new Tokenizer(options.$rules);
2412
2629
  cmdLine.session.bgTokenizer.setTokenizer(tokenizer);
2413
2630
  }
2414
-
2415
2631
  if (options.placeholder) {
2416
2632
  cmdLine.setOption("placeholder", options.placeholder);
2417
2633
  }
2418
-
2419
2634
  if (options.hasDescription) {
2420
- var promptTextContainer = dom.buildDom(["div", {class: "ace_prompt_text_container"}]);
2635
+ var promptTextContainer = dom.buildDom(["div", { class: "ace_prompt_text_container" }]);
2421
2636
  dom.buildDom(options.prompt || "Press 'Enter' to confirm or 'Escape' to cancel", promptTextContainer);
2422
2637
  el.appendChild(promptTextContainer);
2423
2638
  }
2424
-
2425
2639
  overlay.setIgnoreFocusOut(options.ignoreFocusOut);
2426
-
2427
2640
  function accept() {
2428
2641
  var val;
2429
2642
  if (popup && popup.getCursorPosition().row > 0) {
2430
2643
  val = valueFromRecentList();
2431
- } else {
2644
+ }
2645
+ else {
2432
2646
  val = cmdLine.getValue();
2433
2647
  }
2434
2648
  var curData = popup ? popup.getData(popup.getRow()) : val;
@@ -2440,98 +2654,87 @@ function prompt(editor, message, options, callback) {
2440
2654
  }, cmdLine);
2441
2655
  }
2442
2656
  }
2443
-
2444
2657
  var keys = {
2445
2658
  "Enter": accept,
2446
- "Esc|Shift-Esc": function() {
2659
+ "Esc|Shift-Esc": function () {
2447
2660
  options.onCancel && options.onCancel(cmdLine.getValue(), cmdLine);
2448
2661
  done();
2449
2662
  }
2450
2663
  };
2451
-
2452
2664
  if (popup) {
2453
2665
  Object.assign(keys, {
2454
- "Up": function(editor) { popup.goTo("up"); valueFromRecentList();},
2455
- "Down": function(editor) { popup.goTo("down"); valueFromRecentList();},
2456
- "Ctrl-Up|Ctrl-Home": function(editor) { popup.goTo("start"); valueFromRecentList();},
2457
- "Ctrl-Down|Ctrl-End": function(editor) { popup.goTo("end"); valueFromRecentList();},
2458
- "Tab": function(editor) {
2459
- popup.goTo("down"); valueFromRecentList();
2666
+ "Up": function (editor) { popup.goTo("up"); valueFromRecentList(); },
2667
+ "Down": function (editor) { popup.goTo("down"); valueFromRecentList(); },
2668
+ "Ctrl-Up|Ctrl-Home": function (editor) { popup.goTo("start"); valueFromRecentList(); },
2669
+ "Ctrl-Down|Ctrl-End": function (editor) { popup.goTo("end"); valueFromRecentList(); },
2670
+ "Tab": function (editor) {
2671
+ popup.goTo("down");
2672
+ valueFromRecentList();
2460
2673
  },
2461
- "PageUp": function(editor) { popup.gotoPageUp(); valueFromRecentList();},
2462
- "PageDown": function(editor) { popup.gotoPageDown(); valueFromRecentList();}
2674
+ "PageUp": function (editor) { popup.gotoPageUp(); valueFromRecentList(); },
2675
+ "PageDown": function (editor) { popup.gotoPageDown(); valueFromRecentList(); }
2463
2676
  });
2464
2677
  }
2465
-
2466
2678
  cmdLine.commands.bindKeys(keys);
2467
-
2468
2679
  function done() {
2469
2680
  overlay.close();
2470
2681
  callback && callback();
2471
2682
  openPrompt = null;
2472
2683
  }
2473
-
2474
- cmdLine.on("input", function() {
2684
+ cmdLine.on("input", function () {
2475
2685
  options.onInput && options.onInput();
2476
2686
  updateCompletions();
2477
2687
  });
2478
-
2479
2688
  function updateCompletions() {
2480
2689
  if (options.getCompletions) {
2481
2690
  var prefix;
2482
2691
  if (options.getPrefix) {
2483
2692
  prefix = options.getPrefix(cmdLine);
2484
2693
  }
2485
-
2486
2694
  var completions = options.getCompletions(cmdLine);
2487
2695
  popup.setData(completions, prefix);
2488
2696
  popup.resize(true);
2489
2697
  }
2490
2698
  }
2491
-
2492
2699
  function valueFromRecentList() {
2493
2700
  var current = popup.getData(popup.getRow());
2494
2701
  if (current && !current.error)
2495
2702
  return current.value || current.caption || current;
2496
2703
  }
2497
-
2498
2704
  cmdLine.resize(true);
2499
2705
  if (popup) {
2500
2706
  popup.resize(true);
2501
2707
  }
2502
2708
  cmdLine.focus();
2503
-
2504
2709
  openPrompt = {
2505
2710
  close: done,
2506
2711
  name: options.name,
2507
2712
  editor: editor
2508
2713
  };
2509
2714
  }
2510
-
2511
- prompt.gotoLine = function(editor, callback) {
2715
+ prompt.gotoLine = function (editor, callback) {
2512
2716
  function stringifySelection(selection) {
2513
2717
  if (!Array.isArray(selection))
2514
2718
  selection = [selection];
2515
- return selection.map(function(r) {
2516
- var cursor = r.isBackwards ? r.start: r.end;
2517
- var anchor = r.isBackwards ? r.end: r.start;
2719
+ return selection.map(function (r) {
2720
+ var cursor = r.isBackwards ? r.start : r.end;
2721
+ var anchor = r.isBackwards ? r.end : r.start;
2518
2722
  var row = anchor.row;
2519
2723
  var s = (row + 1) + ":" + anchor.column;
2520
-
2521
2724
  if (anchor.row == cursor.row) {
2522
2725
  if (anchor.column != cursor.column)
2523
2726
  s += ">" + ":" + cursor.column;
2524
- } else {
2727
+ }
2728
+ else {
2525
2729
  s += ">" + (cursor.row + 1) + ":" + cursor.column;
2526
2730
  }
2527
2731
  return s;
2528
2732
  }).reverse().join(", ");
2529
2733
  }
2530
-
2531
2734
  prompt(editor, ":" + stringifySelection(editor.selection.toJSON()), {
2532
2735
  name: "gotoLine",
2533
2736
  selection: [1, Number.MAX_VALUE],
2534
- onAccept: function(data) {
2737
+ onAccept: function (data) {
2535
2738
  var value = data.value;
2536
2739
  var _history = prompt.gotoLine._history;
2537
2740
  if (!_history)
@@ -2539,17 +2742,17 @@ prompt.gotoLine = function(editor, callback) {
2539
2742
  if (_history.indexOf(value) != -1)
2540
2743
  _history.splice(_history.indexOf(value), 1);
2541
2744
  _history.unshift(value);
2542
- if (_history.length > 20) _history.length = 20;
2543
-
2544
-
2745
+ if (_history.length > 20)
2746
+ _history.length = 20;
2545
2747
  var pos = editor.getCursorPosition();
2546
2748
  var ranges = [];
2547
- value.replace(/^:/, "").split(/,/).map(function(str) {
2749
+ value.replace(/^:/, "").split(/,/).map(function (str) {
2548
2750
  var parts = str.split(/([<>:+-]|c?\d+)|[^c\d<>:+-]+/).filter(Boolean);
2549
2751
  var i = 0;
2550
2752
  function readPosition() {
2551
2753
  var c = parts[i++];
2552
- if (!c) return;
2754
+ if (!c)
2755
+ return;
2553
2756
  if (c[0] == "c") {
2554
2757
  var index = parseInt(c.slice(1)) || 0;
2555
2758
  return editor.session.doc.indexToPosition(index);
@@ -2566,7 +2769,7 @@ prompt.gotoLine = function(editor, callback) {
2566
2769
  column = parseInt(c) || 0;
2567
2770
  }
2568
2771
  }
2569
- return {row: row, column: column};
2772
+ return { row: row, column: column };
2570
2773
  }
2571
2774
  pos = readPosition();
2572
2775
  var range = Range.fromPoints(pos, pos);
@@ -2582,21 +2785,15 @@ prompt.gotoLine = function(editor, callback) {
2582
2785
  });
2583
2786
  editor.selection.fromJSON(ranges);
2584
2787
  var scrollTop = editor.renderer.scrollTop;
2585
- editor.renderer.scrollSelectionIntoView(
2586
- editor.selection.anchor,
2587
- editor.selection.cursor,
2588
- 0.5
2589
- );
2788
+ editor.renderer.scrollSelectionIntoView(editor.selection.anchor, editor.selection.cursor, 0.5);
2590
2789
  editor.renderer.animateScrolling(scrollTop);
2591
2790
  },
2592
- history: function() {
2593
- var undoManager = editor.session.getUndoManager();
2791
+ history: function () {
2594
2792
  if (!prompt.gotoLine._history)
2595
2793
  return [];
2596
2794
  return prompt.gotoLine._history;
2597
-
2598
2795
  },
2599
- getCompletions: function(cmdLine) {
2796
+ getCompletions: function (cmdLine) {
2600
2797
  var value = cmdLine.getValue();
2601
2798
  var m = value.replace(/^:/, "").split(":");
2602
2799
  var row = Math.min(parseInt(m[0]) || 1, editor.session.getLength()) - 1;
@@ -2606,28 +2803,27 @@ prompt.gotoLine = function(editor, callback) {
2606
2803
  },
2607
2804
  $rules: {
2608
2805
  start: [{
2609
- regex: /\d+/,
2610
- token: "string"
2611
- }, {
2612
- regex: /[:,><+\-c]/,
2613
- token: "keyword"
2614
- }]
2806
+ regex: /\d+/,
2807
+ token: "string"
2808
+ }, {
2809
+ regex: /[:,><+\-c]/,
2810
+ token: "keyword"
2811
+ }]
2615
2812
  }
2616
2813
  });
2617
2814
  };
2618
-
2619
- prompt.commands = function(editor, callback) {
2815
+ prompt.commands = function (editor, callback) {
2620
2816
  function normalizeName(name) {
2621
- return (name || "").replace(/^./, function(x) {
2817
+ return (name || "").replace(/^./, function (x) {
2622
2818
  return x.toUpperCase(x);
2623
- }).replace(/[a-z][A-Z]/g, function(x) {
2819
+ }).replace(/[a-z][A-Z]/g, function (x) {
2624
2820
  return x[0] + " " + x[1].toLowerCase(x);
2625
2821
  });
2626
2822
  }
2627
2823
  function getEditorCommandsByName(excludeCommands) {
2628
2824
  var commandsByName = [];
2629
2825
  var commandMap = {};
2630
- editor.keyBinding.$handlers.forEach(function(handler) {
2826
+ editor.keyBinding.$handlers.forEach(function (handler) {
2631
2827
  var platform = handler.platform;
2632
2828
  var cbn = handler.byName;
2633
2829
  for (var i in cbn) {
@@ -2639,17 +2835,18 @@ prompt.commands = function(editor, callback) {
2639
2835
  var description = commands.description || normalizeName(commands.name);
2640
2836
  if (!Array.isArray(commands))
2641
2837
  commands = [commands];
2642
- commands.forEach(function(command) {
2838
+ commands.forEach(function (command) {
2643
2839
  if (typeof command != "string")
2644
2840
  command = command.name;
2645
- var needle = excludeCommands.find(function(el) {
2841
+ var needle = excludeCommands.find(function (el) {
2646
2842
  return el === command;
2647
2843
  });
2648
2844
  if (!needle) {
2649
2845
  if (commandMap[command]) {
2650
2846
  commandMap[command].key += "|" + key;
2651
- } else {
2652
- commandMap[command] = {key: key, command: command, description: description};
2847
+ }
2848
+ else {
2849
+ commandMap[command] = { key: key, command: command, description: description };
2653
2850
  commandsByName.push(commandMap[command]);
2654
2851
  }
2655
2852
  }
@@ -2660,27 +2857,26 @@ prompt.commands = function(editor, callback) {
2660
2857
  }
2661
2858
  var excludeCommandsList = ["insertstring", "inserttext", "setIndentation", "paste"];
2662
2859
  var shortcutsArray = getEditorCommandsByName(excludeCommandsList);
2663
- shortcutsArray = shortcutsArray.map(function(item) {
2664
- return {value: item.description, meta: item.key, command: item.command};
2860
+ shortcutsArray = shortcutsArray.map(function (item) {
2861
+ return { value: item.description, meta: item.key, command: item.command };
2665
2862
  });
2666
- prompt(editor, "", {
2863
+ prompt(editor, "", {
2667
2864
  name: "commands",
2668
2865
  selection: [0, Number.MAX_VALUE],
2669
2866
  maxHistoryCount: 5,
2670
- onAccept: function(data) {
2867
+ onAccept: function (data) {
2671
2868
  if (data.item) {
2672
2869
  var commandName = data.item.command;
2673
2870
  this.addToHistory(data.item);
2674
-
2675
2871
  editor.execCommand(commandName);
2676
2872
  }
2677
2873
  },
2678
- addToHistory: function(item) {
2874
+ addToHistory: function (item) {
2679
2875
  var history = this.history();
2680
2876
  history.unshift(item);
2681
2877
  delete item.message;
2682
2878
  for (var i = 1; i < history.length; i++) {
2683
- if (history[i]["command"] == item.command ) {
2879
+ if (history[i]["command"] == item.command) {
2684
2880
  history.splice(i, 1);
2685
2881
  break;
2686
2882
  }
@@ -2690,110 +2886,88 @@ prompt.commands = function(editor, callback) {
2690
2886
  }
2691
2887
  prompt.commands.history = history;
2692
2888
  },
2693
- history: function() {
2889
+ history: function () {
2694
2890
  return prompt.commands.history || [];
2695
2891
  },
2696
- getPrefix: function(cmdLine) {
2892
+ getPrefix: function (cmdLine) {
2697
2893
  var currentPos = cmdLine.getCursorPosition();
2698
2894
  var filterValue = cmdLine.getValue();
2699
2895
  return filterValue.substring(0, currentPos.column);
2700
2896
  },
2701
- getCompletions: function(cmdLine) {
2897
+ getCompletions: function (cmdLine) {
2702
2898
  function getFilteredCompletions(commands, prefix) {
2703
2899
  var resultCommands = JSON.parse(JSON.stringify(commands));
2704
-
2705
2900
  var filtered = new FilteredList(resultCommands);
2706
2901
  return filtered.filterCompletions(resultCommands, prefix);
2707
2902
  }
2708
-
2709
2903
  function getUniqueCommandList(commands, usedCommands) {
2710
2904
  if (!usedCommands || !usedCommands.length) {
2711
2905
  return commands;
2712
2906
  }
2713
2907
  var excludeCommands = [];
2714
- usedCommands.forEach(function(item) {
2908
+ usedCommands.forEach(function (item) {
2715
2909
  excludeCommands.push(item.command);
2716
2910
  });
2717
-
2718
2911
  var resultCommands = [];
2719
-
2720
- commands.forEach(function(item) {
2912
+ commands.forEach(function (item) {
2721
2913
  if (excludeCommands.indexOf(item.command) === -1) {
2722
2914
  resultCommands.push(item);
2723
2915
  }
2724
2916
  });
2725
-
2726
2917
  return resultCommands;
2727
2918
  }
2728
-
2729
2919
  var prefix = this.getPrefix(cmdLine);
2730
2920
  var recentlyUsedCommands = getFilteredCompletions(this.history(), prefix);
2731
2921
  var otherCommands = getUniqueCommandList(shortcutsArray, recentlyUsedCommands);
2732
2922
  otherCommands = getFilteredCompletions(otherCommands, prefix);
2733
-
2734
2923
  if (recentlyUsedCommands.length && otherCommands.length) {
2735
- recentlyUsedCommands[0]["message"] = " Recently used";
2736
- otherCommands[0]["message"] = " Other commands";
2924
+ recentlyUsedCommands[0].message = nls("Recently used");
2925
+ otherCommands[0].message = nls("Other commands");
2737
2926
  }
2738
-
2739
2927
  var completions = recentlyUsedCommands.concat(otherCommands);
2740
2928
  return completions.length > 0 ? completions : [{
2741
- value: "No matching commands",
2742
- error: 1
2743
- }];
2929
+ value: nls("No matching commands"),
2930
+ error: 1
2931
+ }];
2744
2932
  }
2745
2933
  });
2746
2934
  };
2747
-
2748
- prompt.modes = function(editor, callback) {
2935
+ prompt.modes = function (editor, callback) {
2749
2936
  var modesArray = modelist.modes;
2750
- modesArray = modesArray.map(function(item) {
2751
- return {value: item.caption, mode: item.name};
2937
+ modesArray = modesArray.map(function (item) {
2938
+ return { value: item.caption, mode: item.name };
2752
2939
  });
2753
- prompt(editor, "", {
2940
+ prompt(editor, "", {
2754
2941
  name: "modes",
2755
2942
  selection: [0, Number.MAX_VALUE],
2756
- onAccept: function(data) {
2943
+ onAccept: function (data) {
2757
2944
  if (data.item) {
2758
2945
  var modeName = "ace/mode/" + data.item.mode;
2759
2946
  editor.session.setMode(modeName);
2760
2947
  }
2761
2948
  },
2762
- getPrefix: function(cmdLine) {
2949
+ getPrefix: function (cmdLine) {
2763
2950
  var currentPos = cmdLine.getCursorPosition();
2764
2951
  var filterValue = cmdLine.getValue();
2765
2952
  return filterValue.substring(0, currentPos.column);
2766
2953
  },
2767
- getCompletions: function(cmdLine) {
2954
+ getCompletions: function (cmdLine) {
2768
2955
  function getFilteredCompletions(modes, prefix) {
2769
2956
  var resultCommands = JSON.parse(JSON.stringify(modes));
2770
-
2771
2957
  var filtered = new FilteredList(resultCommands);
2772
2958
  return filtered.filterCompletions(resultCommands, prefix);
2773
2959
  }
2774
-
2775
2960
  var prefix = this.getPrefix(cmdLine);
2776
2961
  var completions = getFilteredCompletions(modesArray, prefix);
2777
2962
  return completions.length > 0 ? completions : [{
2778
- "caption": "No mode matching",
2779
- "value": "No mode matching",
2780
- "error": 1
2781
- }];
2963
+ "caption": "No mode matching",
2964
+ "value": "No mode matching",
2965
+ "error": 1
2966
+ }];
2782
2967
  }
2783
2968
  });
2784
2969
  };
2785
-
2786
- dom.importCssString(".ace_prompt_container {\
2787
- max-width: 600px;\
2788
- width: 100%;\
2789
- margin: 20px auto;\
2790
- padding: 3px;\
2791
- background: white;\
2792
- border-radius: 2px;\
2793
- box-shadow: 0px 2px 3px 0px #555;\
2794
- }", "promtp.css", false);
2795
-
2796
-
2970
+ dom.importCssString(".ace_prompt_container {\n max-width: 603px;\n width: 100%;\n margin: 20px auto;\n padding: 3px;\n background: white;\n border-radius: 2px;\n box-shadow: 0px 2px 3px 0px #555;\n}", "promtp.css", false);
2797
2971
  exports.prompt = prompt;
2798
2972
 
2799
2973
  }); (function() {