ace-rails-ap 4.3 → 4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (249) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/ace-rails-ap.gemspec +0 -2
  4. data/lib/ace/rails/version.rb +1 -1
  5. data/vendor/assets/javascripts/ace/ace.js +659 -1137
  6. data/vendor/assets/javascripts/ace/ext-beautify.js +5 -2
  7. data/vendor/assets/javascripts/ace/ext-code_lens.js +238 -0
  8. data/vendor/assets/javascripts/ace/ext-emmet.js +36 -28
  9. data/vendor/assets/javascripts/ace/ext-language_tools.js +63 -48
  10. data/vendor/assets/javascripts/ace/ext-modelist.js +12 -6
  11. data/vendor/assets/javascripts/ace/ext-options.js +46 -19
  12. data/vendor/assets/javascripts/ace/ext-prompt.js +57 -38
  13. data/vendor/assets/javascripts/ace/ext-settings_menu.js +46 -19
  14. data/vendor/assets/javascripts/ace/ext-spellcheck.js +0 -1
  15. data/vendor/assets/javascripts/ace/ext-themelist.js +2 -1
  16. data/vendor/assets/javascripts/ace/keybinding-emacs.js +21 -22
  17. data/vendor/assets/javascripts/ace/keybinding-sublime.js +2 -5
  18. data/vendor/assets/javascripts/ace/keybinding-vim.js +45 -9
  19. data/vendor/assets/javascripts/ace/keybinding-vscode.js +262 -0
  20. data/vendor/assets/javascripts/ace/mode-abc.js +3 -0
  21. data/vendor/assets/javascripts/ace/mode-actionscript.js +1 -0
  22. data/vendor/assets/javascripts/ace/mode-alda.js +311 -0
  23. data/vendor/assets/javascripts/ace/mode-asl.js +17 -16
  24. data/vendor/assets/javascripts/ace/mode-c_cpp.js +1 -0
  25. data/vendor/assets/javascripts/ace/mode-clojure.js +1 -0
  26. data/vendor/assets/javascripts/ace/mode-coffee.js +1 -0
  27. data/vendor/assets/javascripts/ace/mode-coldfusion.js +3 -0
  28. data/vendor/assets/javascripts/ace/mode-csound_document.js +40 -5
  29. data/vendor/assets/javascripts/ace/mode-csound_orchestra.js +37 -5
  30. data/vendor/assets/javascripts/ace/mode-csound_score.js +1 -0
  31. data/vendor/assets/javascripts/ace/mode-css.js +1 -0
  32. data/vendor/assets/javascripts/ace/mode-curly.js +3 -0
  33. data/vendor/assets/javascripts/ace/mode-d.js +1 -1
  34. data/vendor/assets/javascripts/ace/mode-dart.js +2 -0
  35. data/vendor/assets/javascripts/ace/mode-diff.js +1 -0
  36. data/vendor/assets/javascripts/ace/mode-django.js +4 -0
  37. data/vendor/assets/javascripts/ace/mode-dockerfile.js +1 -0
  38. data/vendor/assets/javascripts/ace/mode-drools.js +1 -0
  39. data/vendor/assets/javascripts/ace/mode-edifact.js +1 -0
  40. data/vendor/assets/javascripts/ace/mode-ejs.js +673 -165
  41. data/vendor/assets/javascripts/ace/mode-erlang.js +1 -0
  42. data/vendor/assets/javascripts/ace/mode-fsl.js +1 -0
  43. data/vendor/assets/javascripts/ace/mode-glsl.js +1 -0
  44. data/vendor/assets/javascripts/ace/mode-gobstones.js +2 -0
  45. data/vendor/assets/javascripts/ace/mode-graphqlschema.js +1 -0
  46. data/vendor/assets/javascripts/ace/mode-groovy.js +1 -0
  47. data/vendor/assets/javascripts/ace/mode-haml.js +419 -104
  48. data/vendor/assets/javascripts/ace/mode-handlebars.js +3 -0
  49. data/vendor/assets/javascripts/ace/mode-haskell.js +1 -0
  50. data/vendor/assets/javascripts/ace/mode-html.js +3 -0
  51. data/vendor/assets/javascripts/ace/mode-html_elixir.js +3 -0
  52. data/vendor/assets/javascripts/ace/mode-html_ruby.js +673 -165
  53. data/vendor/assets/javascripts/ace/mode-io.js +1 -0
  54. data/vendor/assets/javascripts/ace/mode-java.js +2 -0
  55. data/vendor/assets/javascripts/ace/mode-javascript.js +1 -0
  56. data/vendor/assets/javascripts/ace/mode-json.js +3 -0
  57. data/vendor/assets/javascripts/ace/mode-json5.js +360 -0
  58. data/vendor/assets/javascripts/ace/mode-jsoniq.js +1 -0
  59. data/vendor/assets/javascripts/ace/mode-jsp.js +1 -0
  60. data/vendor/assets/javascripts/ace/mode-kotlin.js +2 -0
  61. data/vendor/assets/javascripts/ace/mode-liquid.js +4 -0
  62. data/vendor/assets/javascripts/ace/mode-lsl.js +1 -0
  63. data/vendor/assets/javascripts/ace/mode-lua.js +1 -0
  64. data/vendor/assets/javascripts/ace/mode-luapage.js +4 -0
  65. data/vendor/assets/javascripts/ace/mode-makefile.js +1 -0
  66. data/vendor/assets/javascripts/ace/mode-markdown.js +5 -0
  67. data/vendor/assets/javascripts/ace/mode-maze.js +1 -0
  68. data/vendor/assets/javascripts/ace/mode-mediawiki.js +592 -0
  69. data/vendor/assets/javascripts/ace/mode-nix.js +1 -0
  70. data/vendor/assets/javascripts/ace/mode-nsis.js +1 -1
  71. data/vendor/assets/javascripts/ace/mode-nunjucks.js +2698 -0
  72. data/vendor/assets/javascripts/ace/mode-perl.js +1 -0
  73. data/vendor/assets/javascripts/ace/mode-pgsql.js +2 -2
  74. data/vendor/assets/javascripts/ace/mode-php.js +4 -0
  75. data/vendor/assets/javascripts/ace/mode-php_laravel_blade.js +4 -0
  76. data/vendor/assets/javascripts/ace/mode-prisma.js +489 -0
  77. data/vendor/assets/javascripts/ace/mode-protobuf.js +1 -0
  78. data/vendor/assets/javascripts/ace/mode-puppet.js +5 -6
  79. data/vendor/assets/javascripts/ace/mode-python.js +3 -2
  80. data/vendor/assets/javascripts/ace/mode-qml.js +381 -0
  81. data/vendor/assets/javascripts/ace/mode-r.js +1 -0
  82. data/vendor/assets/javascripts/ace/mode-razor.js +4 -0
  83. data/vendor/assets/javascripts/ace/mode-rhtml.js +3 -0
  84. data/vendor/assets/javascripts/ace/mode-rst.js +1 -0
  85. data/vendor/assets/javascripts/ace/mode-ruby.js +670 -165
  86. data/vendor/assets/javascripts/ace/mode-rust.js +1 -1
  87. data/vendor/assets/javascripts/ace/mode-scala.js +1 -0
  88. data/vendor/assets/javascripts/ace/mode-sh.js +1 -0
  89. data/vendor/assets/javascripts/ace/mode-sjs.js +1 -0
  90. data/vendor/assets/javascripts/ace/mode-slim.js +708 -110
  91. data/vendor/assets/javascripts/ace/mode-smarty.js +3 -0
  92. data/vendor/assets/javascripts/ace/mode-snippets.js +1 -0
  93. data/vendor/assets/javascripts/ace/mode-soy_template.js +3 -0
  94. data/vendor/assets/javascripts/ace/mode-sql.js +1 -0
  95. data/vendor/assets/javascripts/ace/mode-sqlserver.js +2 -1
  96. data/vendor/assets/javascripts/ace/mode-svg.js +1 -0
  97. data/vendor/assets/javascripts/ace/mode-swift.js +6 -0
  98. data/vendor/assets/javascripts/ace/mode-tcl.js +1 -0
  99. data/vendor/assets/javascripts/ace/mode-terraform.js +10 -7
  100. data/vendor/assets/javascripts/ace/mode-tex.js +1 -0
  101. data/vendor/assets/javascripts/ace/mode-textile.js +1 -0
  102. data/vendor/assets/javascripts/ace/mode-tsx.js +1 -0
  103. data/vendor/assets/javascripts/ace/mode-twig.js +3 -0
  104. data/vendor/assets/javascripts/ace/mode-typescript.js +1 -0
  105. data/vendor/assets/javascripts/ace/mode-vala.js +1 -0
  106. data/vendor/assets/javascripts/ace/mode-vbscript.js +444 -15
  107. data/vendor/assets/javascripts/ace/mode-velocity.js +4 -0
  108. data/vendor/assets/javascripts/ace/mode-vhdl.js +5 -6
  109. data/vendor/assets/javascripts/ace/mode-visualforce.js +3 -0
  110. data/vendor/assets/javascripts/ace/mode-wollok.js +2 -0
  111. data/vendor/assets/javascripts/ace/mode-xquery.js +1 -0
  112. data/vendor/assets/javascripts/ace/snippets/abap.js +1 -6
  113. data/vendor/assets/javascripts/ace/snippets/ada.js +1 -6
  114. data/vendor/assets/javascripts/ace/snippets/alda.js +9 -0
  115. data/vendor/assets/javascripts/ace/snippets/apache_conf.js +1 -6
  116. data/vendor/assets/javascripts/ace/snippets/apex.js +1 -6
  117. data/vendor/assets/javascripts/ace/snippets/applescript.js +1 -6
  118. data/vendor/assets/javascripts/ace/snippets/aql.js +1 -6
  119. data/vendor/assets/javascripts/ace/snippets/asciidoc.js +1 -6
  120. data/vendor/assets/javascripts/ace/snippets/asl.js +1 -5
  121. data/vendor/assets/javascripts/ace/snippets/assembly_x86.js +1 -6
  122. data/vendor/assets/javascripts/ace/snippets/autohotkey.js +1 -6
  123. data/vendor/assets/javascripts/ace/snippets/batchfile.js +1 -6
  124. data/vendor/assets/javascripts/ace/snippets/c9search.js +1 -6
  125. data/vendor/assets/javascripts/ace/snippets/cirru.js +1 -6
  126. data/vendor/assets/javascripts/ace/snippets/cobol.js +1 -6
  127. data/vendor/assets/javascripts/ace/snippets/coldfusion.js +1 -6
  128. data/vendor/assets/javascripts/ace/snippets/crystal.js +1 -6
  129. data/vendor/assets/javascripts/ace/snippets/csharp.js +1 -6
  130. data/vendor/assets/javascripts/ace/snippets/csound_score.js +1 -6
  131. data/vendor/assets/javascripts/ace/snippets/csp.js +1 -6
  132. data/vendor/assets/javascripts/ace/snippets/curly.js +1 -6
  133. data/vendor/assets/javascripts/ace/snippets/d.js +1 -6
  134. data/vendor/assets/javascripts/ace/snippets/dockerfile.js +1 -6
  135. data/vendor/assets/javascripts/ace/snippets/dot.js +1 -6
  136. data/vendor/assets/javascripts/ace/snippets/eiffel.js +1 -6
  137. data/vendor/assets/javascripts/ace/snippets/ejs.js +1 -6
  138. data/vendor/assets/javascripts/ace/snippets/elixir.js +1 -6
  139. data/vendor/assets/javascripts/ace/snippets/elm.js +1 -6
  140. data/vendor/assets/javascripts/ace/snippets/forth.js +1 -6
  141. data/vendor/assets/javascripts/ace/snippets/fortran.js +1 -6
  142. data/vendor/assets/javascripts/ace/snippets/fsharp.js +1 -6
  143. data/vendor/assets/javascripts/ace/snippets/ftl.js +1 -6
  144. data/vendor/assets/javascripts/ace/snippets/gcode.js +1 -6
  145. data/vendor/assets/javascripts/ace/snippets/gherkin.js +1 -6
  146. data/vendor/assets/javascripts/ace/snippets/gitignore.js +1 -6
  147. data/vendor/assets/javascripts/ace/snippets/glsl.js +1 -6
  148. data/vendor/assets/javascripts/ace/snippets/golang.js +1 -6
  149. data/vendor/assets/javascripts/ace/snippets/groovy.js +1 -6
  150. data/vendor/assets/javascripts/ace/snippets/handlebars.js +1 -6
  151. data/vendor/assets/javascripts/ace/snippets/haskell_cabal.js +1 -6
  152. data/vendor/assets/javascripts/ace/snippets/haxe.js +1 -6
  153. data/vendor/assets/javascripts/ace/snippets/hjson.js +1 -6
  154. data/vendor/assets/javascripts/ace/snippets/html_elixir.js +1 -6
  155. data/vendor/assets/javascripts/ace/snippets/html_ruby.js +1 -6
  156. data/vendor/assets/javascripts/ace/snippets/ini.js +1 -6
  157. data/vendor/assets/javascripts/ace/snippets/jack.js +1 -6
  158. data/vendor/assets/javascripts/ace/snippets/jade.js +1 -6
  159. data/vendor/assets/javascripts/ace/snippets/json.js +1 -6
  160. data/vendor/assets/javascripts/ace/snippets/json5.js +9 -0
  161. data/vendor/assets/javascripts/ace/snippets/jssm.js +1 -6
  162. data/vendor/assets/javascripts/ace/snippets/jsx.js +1 -6
  163. data/vendor/assets/javascripts/ace/snippets/julia.js +1 -6
  164. data/vendor/assets/javascripts/ace/snippets/kotlin.js +1 -6
  165. data/vendor/assets/javascripts/ace/snippets/latex.js +1 -6
  166. data/vendor/assets/javascripts/ace/snippets/less.js +1 -6
  167. data/vendor/assets/javascripts/ace/snippets/lisp.js +1 -6
  168. data/vendor/assets/javascripts/ace/snippets/livescript.js +1 -6
  169. data/vendor/assets/javascripts/ace/snippets/logiql.js +1 -6
  170. data/vendor/assets/javascripts/ace/snippets/logtalk.js +1 -6
  171. data/vendor/assets/javascripts/ace/snippets/luapage.js +1 -6
  172. data/vendor/assets/javascripts/ace/snippets/lucene.js +1 -6
  173. data/vendor/assets/javascripts/ace/snippets/mask.js +1 -6
  174. data/vendor/assets/javascripts/ace/snippets/matlab.js +1 -6
  175. data/vendor/assets/javascripts/ace/snippets/mediawiki.js +9 -0
  176. data/vendor/assets/javascripts/ace/snippets/mel.js +1 -6
  177. data/vendor/assets/javascripts/ace/snippets/mixal.js +1 -6
  178. data/vendor/assets/javascripts/ace/snippets/mushcode.js +1 -6
  179. data/vendor/assets/javascripts/ace/snippets/mysql.js +1 -6
  180. data/vendor/assets/javascripts/ace/snippets/nginx.js +1 -6
  181. data/vendor/assets/javascripts/ace/snippets/nim.js +1 -6
  182. data/vendor/assets/javascripts/ace/snippets/nix.js +1 -6
  183. data/vendor/assets/javascripts/ace/snippets/nsis.js +1 -6
  184. data/vendor/assets/javascripts/ace/snippets/nunjucks.js +9 -0
  185. data/vendor/assets/javascripts/ace/snippets/objectivec.js +1 -6
  186. data/vendor/assets/javascripts/ace/snippets/ocaml.js +1 -6
  187. data/vendor/assets/javascripts/ace/snippets/pascal.js +1 -6
  188. data/vendor/assets/javascripts/ace/snippets/perl6.js +1 -6
  189. data/vendor/assets/javascripts/ace/snippets/pgsql.js +1 -6
  190. data/vendor/assets/javascripts/ace/snippets/php_laravel_blade.js +1 -6
  191. data/vendor/assets/javascripts/ace/snippets/pig.js +1 -6
  192. data/vendor/assets/javascripts/ace/snippets/plain_text.js +1 -6
  193. data/vendor/assets/javascripts/ace/snippets/powershell.js +1 -6
  194. data/vendor/assets/javascripts/ace/snippets/praat.js +1 -6
  195. data/vendor/assets/javascripts/ace/snippets/prisma.js +9 -0
  196. data/vendor/assets/javascripts/ace/snippets/prolog.js +1 -6
  197. data/vendor/assets/javascripts/ace/snippets/properties.js +1 -6
  198. data/vendor/assets/javascripts/ace/snippets/protobuf.js +1 -6
  199. data/vendor/assets/javascripts/ace/snippets/puppet.js +1 -6
  200. data/vendor/assets/javascripts/ace/snippets/qml.js +9 -0
  201. data/vendor/assets/javascripts/ace/snippets/rdoc.js +1 -6
  202. data/vendor/assets/javascripts/ace/snippets/red.js +1 -6
  203. data/vendor/assets/javascripts/ace/snippets/redshift.js +1 -6
  204. data/vendor/assets/javascripts/ace/snippets/rhtml.js +1 -6
  205. data/vendor/assets/javascripts/ace/snippets/rust.js +1 -6
  206. data/vendor/assets/javascripts/ace/snippets/sass.js +1 -6
  207. data/vendor/assets/javascripts/ace/snippets/scad.js +1 -6
  208. data/vendor/assets/javascripts/ace/snippets/scala.js +1 -6
  209. data/vendor/assets/javascripts/ace/snippets/scheme.js +1 -6
  210. data/vendor/assets/javascripts/ace/snippets/scss.js +1 -6
  211. data/vendor/assets/javascripts/ace/snippets/sjs.js +1 -6
  212. data/vendor/assets/javascripts/ace/snippets/slim.js +1 -6
  213. data/vendor/assets/javascripts/ace/snippets/smarty.js +1 -6
  214. data/vendor/assets/javascripts/ace/snippets/soy_template.js +1 -6
  215. data/vendor/assets/javascripts/ace/snippets/space.js +1 -6
  216. data/vendor/assets/javascripts/ace/snippets/sparql.js +1 -6
  217. data/vendor/assets/javascripts/ace/snippets/stylus.js +1 -6
  218. data/vendor/assets/javascripts/ace/snippets/svg.js +1 -6
  219. data/vendor/assets/javascripts/ace/snippets/swift.js +1 -6
  220. data/vendor/assets/javascripts/ace/snippets/terraform.js +1 -6
  221. data/vendor/assets/javascripts/ace/snippets/text.js +1 -6
  222. data/vendor/assets/javascripts/ace/snippets/toml.js +1 -6
  223. data/vendor/assets/javascripts/ace/snippets/tsx.js +1 -6
  224. data/vendor/assets/javascripts/ace/snippets/turtle.js +1 -6
  225. data/vendor/assets/javascripts/ace/snippets/twig.js +1 -6
  226. data/vendor/assets/javascripts/ace/snippets/typescript.js +1 -6
  227. data/vendor/assets/javascripts/ace/snippets/vbscript.js +1 -6
  228. data/vendor/assets/javascripts/ace/snippets/verilog.js +1 -6
  229. data/vendor/assets/javascripts/ace/snippets/vhdl.js +1 -6
  230. data/vendor/assets/javascripts/ace/snippets/visualforce.js +1 -6
  231. data/vendor/assets/javascripts/ace/snippets/xml.js +1 -6
  232. data/vendor/assets/javascripts/ace/snippets/yaml.js +1 -6
  233. data/vendor/assets/javascripts/ace/snippets/zeek.js +1 -6
  234. data/vendor/assets/javascripts/ace/theme-ambiance.js +3 -2
  235. data/vendor/assets/javascripts/ace/theme-chaos.js +1 -1
  236. data/vendor/assets/javascripts/ace/theme-nord_dark.js +102 -0
  237. data/vendor/assets/javascripts/ace/worker-base.js +1421 -0
  238. data/vendor/assets/javascripts/ace/worker-coffee.js +17 -703
  239. data/vendor/assets/javascripts/ace/worker-css.js +17 -703
  240. data/vendor/assets/javascripts/ace/worker-html.js +17 -703
  241. data/vendor/assets/javascripts/ace/worker-javascript.js +7833 -5352
  242. data/vendor/assets/javascripts/ace/worker-json.js +17 -703
  243. data/vendor/assets/javascripts/ace/worker-lua.js +17 -703
  244. data/vendor/assets/javascripts/ace/worker-php.js +857 -1475
  245. data/vendor/assets/javascripts/ace/worker-xml.js +26 -707
  246. data/vendor/assets/javascripts/ace/worker-xquery.js +17 -703
  247. metadata +18 -4
  248. data/vendor/assets/javascripts/ace/mode-bro.js +0 -334
  249. data/vendor/assets/javascripts/ace/snippets/bro.js +0 -14
@@ -43,9 +43,9 @@ exports.beautify = function(session) {
43
43
 
44
44
  var trimNext = function() {
45
45
  if (nextToken && nextToken.value && nextToken.type !== 'string.regexp')
46
- nextToken.value = nextToken.value.trim();
46
+ nextToken.value = nextToken.value.replace(/^\s*/, "");
47
47
  };
48
-
48
+
49
49
  var trimLine = function() {
50
50
  code = code.replace(/ +$/, "");
51
51
  };
@@ -264,6 +264,9 @@ exports.beautify = function(session) {
264
264
  }
265
265
  }
266
266
  }
267
+
268
+ if (token.type == "text")
269
+ value = value.replace(/\s+$/, " ");
267
270
  if (spaceBefore && !breakBefore) {
268
271
  trimLine();
269
272
  if (code.substr(-1) !== "\n")
@@ -0,0 +1,238 @@
1
+ define("ace/ext/code_lens",["require","exports","module","ace/line_widgets","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/editor","ace/config"], function(require, exports, module) {
2
+ "use strict";
3
+ var LineWidgets = require("../line_widgets").LineWidgets;
4
+ var event = require("../lib/event");
5
+ var lang = require("../lib/lang");
6
+ var dom = require("../lib/dom");
7
+
8
+ function clearLensElements(renderer) {
9
+ var textLayer = renderer.$textLayer;
10
+ var lensElements = textLayer.$lenses;
11
+ if (lensElements)
12
+ lensElements.forEach(function(el) {el.remove(); });
13
+ textLayer.$lenses = null;
14
+ }
15
+
16
+ function renderWidgets(changes, renderer) {
17
+ var changed = changes & renderer.CHANGE_LINES
18
+ || changes & renderer.CHANGE_FULL
19
+ || changes & renderer.CHANGE_SCROLL
20
+ || changes & renderer.CHANGE_TEXT;
21
+ if (!changed)
22
+ return;
23
+
24
+ var session = renderer.session;
25
+ var lineWidgets = renderer.session.lineWidgets;
26
+ var textLayer = renderer.$textLayer;
27
+ var lensElements = textLayer.$lenses;
28
+ if (!lineWidgets) {
29
+ if (lensElements)
30
+ clearLensElements(renderer);
31
+ return;
32
+ }
33
+
34
+ var textCells = renderer.$textLayer.$lines.cells;
35
+ var config = renderer.layerConfig;
36
+ var padding = renderer.$padding;
37
+
38
+ if (!lensElements)
39
+ lensElements = textLayer.$lenses = [];
40
+
41
+
42
+ var index = 0;
43
+ for (var i = 0; i < textCells.length; i++) {
44
+ var row = textCells[i].row;
45
+ var widget = lineWidgets[row];
46
+ var lenses = widget && widget.lenses;
47
+
48
+ if (!lenses || !lenses.length) continue;
49
+
50
+ var lensContainer = lensElements[index];
51
+ if (!lensContainer) {
52
+ lensContainer = lensElements[index]
53
+ = dom.buildDom(["div", {class: "ace_codeLens"}], renderer.container);
54
+ }
55
+ lensContainer.style.height = config.lineHeight + "px";
56
+ index++;
57
+
58
+ for (var j = 0; j < lenses.length; j++) {
59
+ var el = lensContainer.childNodes[2 * j];
60
+ if (!el) {
61
+ if (j != 0) lensContainer.appendChild(dom.createTextNode("\xa0|\xa0"));
62
+ el = dom.buildDom(["a"], lensContainer);
63
+ }
64
+ el.textContent = lenses[j].title;
65
+ el.lensCommand = lenses[j];
66
+ }
67
+ while (lensContainer.childNodes.length > 2 * j - 1)
68
+ lensContainer.lastChild.remove();
69
+
70
+ var top = renderer.$cursorLayer.getPixelPosition({
71
+ row: row,
72
+ column: 0
73
+ }, true).top - config.lineHeight * widget.rowsAbove - config.offset;
74
+ lensContainer.style.top = top + "px";
75
+
76
+ var left = renderer.gutterWidth;
77
+ var indent = session.getLine(row).search(/\S|$/);
78
+ if (indent == -1)
79
+ indent = 0;
80
+ left += indent * config.characterWidth;
81
+ left -= renderer.scrollLeft;
82
+ lensContainer.style.paddingLeft = padding + left + "px";
83
+ }
84
+ while (index < lensElements.length)
85
+ lensElements.pop().remove();
86
+ }
87
+
88
+ function clearCodeLensWidgets(session) {
89
+ if (!session.lineWidgets) return;
90
+ var widgetManager = session.widgetManager;
91
+ session.lineWidgets.forEach(function(widget) {
92
+ if (widget && widget.lenses)
93
+ widgetManager.removeLineWidget(widget);
94
+ });
95
+ }
96
+
97
+ exports.setLenses = function(session, lenses) {
98
+ var firstRow = Number.MAX_VALUE;
99
+
100
+ clearCodeLensWidgets(session);
101
+ lenses && lenses.forEach(function(lens) {
102
+ var row = lens.start.row;
103
+ var column = lens.start.column;
104
+ var widget = session.lineWidgets && session.lineWidgets[row];
105
+ if (!widget || !widget.lenses) {
106
+ widget = session.widgetManager.$registerLineWidget({
107
+ rowCount: 1,
108
+ rowsAbove: 1,
109
+ row: row,
110
+ column: column,
111
+ lenses: []
112
+ });
113
+ }
114
+ widget.lenses.push(lens.command);
115
+ if (row < firstRow)
116
+ firstRow = row;
117
+ });
118
+ session._emit("changeFold", {data: {start: {row: firstRow}}});
119
+ };
120
+
121
+ function attachToEditor(editor) {
122
+ editor.codeLensProviders = [];
123
+ editor.renderer.on("afterRender", renderWidgets);
124
+ if (!editor.$codeLensClickHandler) {
125
+ editor.$codeLensClickHandler = function(e) {
126
+ var command = e.target.lensCommand;
127
+ if (command)
128
+ editor.execCommand(command.id, command.arguments);
129
+ };
130
+ event.addListener(editor.container, "click", editor.$codeLensClickHandler, editor);
131
+ }
132
+ editor.$updateLenses = function() {
133
+ var session = editor.session;
134
+ if (!session) return;
135
+
136
+ if (!session.widgetManager) {
137
+ session.widgetManager = new LineWidgets(session);
138
+ session.widgetManager.attach(editor);
139
+ }
140
+
141
+ var providersToWaitNum = editor.codeLensProviders.length;
142
+ var lenses = [];
143
+ editor.codeLensProviders.forEach(function(provider) {
144
+ provider.provideCodeLenses(session, function(err, payload) {
145
+ if (err) return;
146
+ payload.forEach(function(lens) {
147
+ lenses.push(lens);
148
+ });
149
+ providersToWaitNum--;
150
+ if (providersToWaitNum == 0) {
151
+ applyLenses();
152
+ }
153
+ });
154
+ });
155
+
156
+ function applyLenses() {
157
+ var cursor = session.selection.cursor;
158
+ var oldRow = session.documentToScreenRow(cursor);
159
+ exports.setLenses(session, lenses);
160
+
161
+ var lastDelta = session.$undoManager && session.$undoManager.$lastDelta;
162
+ if (lastDelta && lastDelta.action == "remove" && lastDelta.lines.length > 1)
163
+ return;
164
+ var row = session.documentToScreenRow(cursor);
165
+ var lineHeight = editor.renderer.layerConfig.lineHeight;
166
+ var top = session.getScrollTop() + (row - oldRow) * lineHeight;
167
+ session.setScrollTop(top);
168
+ }
169
+ };
170
+ var updateLenses = lang.delayedCall(editor.$updateLenses);
171
+ editor.$updateLensesOnInput = function() {
172
+ updateLenses.delay(250);
173
+ };
174
+ editor.on("input", editor.$updateLensesOnInput);
175
+ }
176
+
177
+ function detachFromEditor(editor) {
178
+ editor.off("input", editor.$updateLensesOnInput);
179
+ editor.renderer.off("afterRender", renderWidgets);
180
+ if (editor.$codeLensClickHandler)
181
+ editor.container.removeEventListener("click", editor.$codeLensClickHandler);
182
+ }
183
+
184
+ exports.registerCodeLensProvider = function(editor, codeLensProvider) {
185
+ editor.setOption("enableCodeLens", true);
186
+ editor.codeLensProviders.push(codeLensProvider);
187
+ editor.$updateLensesOnInput();
188
+ };
189
+
190
+ exports.clear = function(session) {
191
+ exports.setLenses(session, null);
192
+ };
193
+
194
+ var Editor = require("../editor").Editor;
195
+ require("../config").defineOptions(Editor.prototype, "editor", {
196
+ enableCodeLens: {
197
+ set: function(val) {
198
+ if (val) {
199
+ attachToEditor(this);
200
+ } else {
201
+ detachFromEditor(this);
202
+ }
203
+ }
204
+ }
205
+ });
206
+
207
+ dom.importCssString("\
208
+ .ace_codeLens {\
209
+ position: absolute;\
210
+ color: #aaa;\
211
+ font-size: 88%;\
212
+ background: inherit;\
213
+ width: 100%;\
214
+ display: flex;\
215
+ align-items: flex-end;\
216
+ pointer-events: none;\
217
+ }\
218
+ .ace_codeLens > a {\
219
+ cursor: pointer;\
220
+ pointer-events: auto;\
221
+ }\
222
+ .ace_codeLens > a:hover {\
223
+ color: #0000ff;\
224
+ text-decoration: underline;\
225
+ }\
226
+ .ace_dark > .ace_codeLens > a:hover {\
227
+ color: #4e94ce;\
228
+ }\
229
+ ", "");
230
+
231
+ }); (function() {
232
+ window.require(["ace/ext/code_lens"], function(m) {
233
+ if (typeof module == "object" && typeof exports == "object" && module) {
234
+ module.exports = m;
235
+ }
236
+ });
237
+ })();
238
+
@@ -144,7 +144,9 @@ var SnippetManager = function() {
144
144
  {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) {
145
145
  var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function(operator) {
146
146
  return operator.length == 2 ? operator[1] : "\x00";
147
- }).split("\x00");
147
+ }).split("\x00").map(function(value){
148
+ return {value: value};
149
+ });
148
150
  stack[0].choices = choices;
149
151
  return [choices[0]];
150
152
  }, next: "start"},
@@ -615,6 +617,12 @@ var SnippetManager = function() {
615
617
  }
616
618
  snippetMap[scope].push(s);
617
619
 
620
+ if (s.prefix)
621
+ s.tabTrigger = s.prefix;
622
+
623
+ if (!s.content && s.body)
624
+ s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body;
625
+
618
626
  if (s.tabTrigger && !s.trigger) {
619
627
  if (!s.guard && /^\w/.test(s.tabTrigger))
620
628
  s.guard = "\\b";
@@ -631,10 +639,13 @@ var SnippetManager = function() {
631
639
  s.endTriggerRe = new RegExp(s.endTrigger);
632
640
  }
633
641
 
634
- if (snippets && snippets.content)
635
- addSnippet(snippets);
636
- else if (Array.isArray(snippets))
642
+ if (Array.isArray(snippets)) {
637
643
  snippets.forEach(addSnippet);
644
+ } else {
645
+ Object.keys(snippets).forEach(function(key) {
646
+ addSnippet(snippets[key]);
647
+ });
648
+ }
638
649
 
639
650
  this._signal("registerSnippets", {scope: scope});
640
651
  };
@@ -684,7 +695,7 @@ var SnippetManager = function() {
684
695
  snippet.tabTrigger = val.match(/^\S*/)[0];
685
696
  if (!snippet.name)
686
697
  snippet.name = val;
687
- } else {
698
+ } else if (key) {
688
699
  snippet[key] = val;
689
700
  }
690
701
  }
@@ -747,15 +758,16 @@ var TabstopManager = function(editor) {
747
758
 
748
759
  this.onChange = function(delta) {
749
760
  var isRemove = delta.action[0] == "r";
750
- var parents = this.selectedTabstop && this.selectedTabstop.parents || {};
761
+ var selectedTabstop = this.selectedTabstop || {};
762
+ var parents = selectedTabstop.parents || {};
751
763
  var tabstops = (this.tabstops || []).slice();
752
764
  for (var i = 0; i < tabstops.length; i++) {
753
765
  var ts = tabstops[i];
754
- var active = ts == this.selectedTabstop || parents[ts.index];
766
+ var active = ts == selectedTabstop || parents[ts.index];
755
767
  ts.rangeList.$bias = active ? 0 : 1;
756
768
 
757
- if (delta.action == "remove" && ts !== this.selectedTabstop) {
758
- var parentActive = ts.parents && ts.parents[this.selectedTabstop.index];
769
+ if (delta.action == "remove" && ts !== selectedTabstop) {
770
+ var parentActive = ts.parents && ts.parents[selectedTabstop.index];
759
771
  var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
760
772
  startIndex = startIndex < 0 ? -startIndex - 1 : startIndex + 1;
761
773
  var endIndex = ts.rangeList.pointIndex(delta.end, parentActive);
@@ -832,18 +844,17 @@ var TabstopManager = function(editor) {
832
844
 
833
845
  this.selectedTabstop = ts;
834
846
  var range = ts.firstNonLinked || ts;
847
+ if (ts.choices) range.cursor = range.start;
835
848
  if (!this.editor.inVirtualSelectionMode) {
836
849
  var sel = this.editor.multiSelect;
837
- sel.toSingleRange(range.clone());
850
+ sel.toSingleRange(range);
838
851
  for (var i = 0; i < ts.length; i++) {
839
852
  if (ts.hasLinkedRanges && ts[i].linked)
840
853
  continue;
841
854
  sel.addRange(ts[i].clone(), true);
842
855
  }
843
- if (sel.ranges[0])
844
- sel.addRange(sel.ranges[0].clone());
845
856
  } else {
846
- this.editor.selection.setRange(range);
857
+ this.editor.selection.fromOrientedRange(range);
847
858
  }
848
859
 
849
860
  this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
@@ -868,8 +879,6 @@ var TabstopManager = function(editor) {
868
879
  var ranges = this.ranges;
869
880
  tabstops.forEach(function(ts, index) {
870
881
  var dest = this.$openTabstops[index] || ts;
871
- ts.rangeList = new RangeList();
872
- ts.rangeList.$bias = 0;
873
882
 
874
883
  for (var i = 0; i < ts.length; i++) {
875
884
  var p = ts[i];
@@ -879,7 +888,6 @@ var TabstopManager = function(editor) {
879
888
  range.original = p;
880
889
  range.tabstop = dest;
881
890
  ranges.push(range);
882
- ts.rangeList.ranges.push(range);
883
891
  if (dest != ts)
884
892
  dest.unshift(range);
885
893
  else
@@ -897,6 +905,9 @@ var TabstopManager = function(editor) {
897
905
  this.$openTabstops[index] = dest;
898
906
  }
899
907
  this.addTabstopMarkers(dest);
908
+ dest.rangeList = dest.rangeList || new RangeList();
909
+ dest.rangeList.$bias = 0;
910
+ dest.rangeList.addList(dest);
900
911
  }, this);
901
912
 
902
913
  if (arg.length > 2) {
@@ -939,21 +950,18 @@ var TabstopManager = function(editor) {
939
950
 
940
951
  this.keyboardHandler = new HashHandler();
941
952
  this.keyboardHandler.bindKeys({
942
- "Tab": function(ed) {
943
- if (exports.snippetManager && exports.snippetManager.expandWithTab(ed)) {
953
+ "Tab": function(editor) {
954
+ if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
944
955
  return;
945
- }
946
-
947
- ed.tabstopManager.tabNext(1);
956
+ editor.tabstopManager.tabNext(1);
957
+ editor.renderer.scrollCursorIntoView();
948
958
  },
949
- "Shift-Tab": function(ed) {
950
- ed.tabstopManager.tabNext(-1);
959
+ "Shift-Tab": function(editor) {
960
+ editor.tabstopManager.tabNext(-1);
961
+ editor.renderer.scrollCursorIntoView();
951
962
  },
952
- "Esc": function(ed) {
953
- ed.tabstopManager.detach();
954
- },
955
- "Return": function(ed) {
956
- return false;
963
+ "Esc": function(editor) {
964
+ editor.tabstopManager.detach();
957
965
  }
958
966
  });
959
967
  }).call(TabstopManager.prototype);
@@ -144,7 +144,9 @@ var SnippetManager = function() {
144
144
  {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) {
145
145
  var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function(operator) {
146
146
  return operator.length == 2 ? operator[1] : "\x00";
147
- }).split("\x00");
147
+ }).split("\x00").map(function(value){
148
+ return {value: value};
149
+ });
148
150
  stack[0].choices = choices;
149
151
  return [choices[0]];
150
152
  }, next: "start"},
@@ -615,6 +617,12 @@ var SnippetManager = function() {
615
617
  }
616
618
  snippetMap[scope].push(s);
617
619
 
620
+ if (s.prefix)
621
+ s.tabTrigger = s.prefix;
622
+
623
+ if (!s.content && s.body)
624
+ s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body;
625
+
618
626
  if (s.tabTrigger && !s.trigger) {
619
627
  if (!s.guard && /^\w/.test(s.tabTrigger))
620
628
  s.guard = "\\b";
@@ -631,10 +639,13 @@ var SnippetManager = function() {
631
639
  s.endTriggerRe = new RegExp(s.endTrigger);
632
640
  }
633
641
 
634
- if (snippets && snippets.content)
635
- addSnippet(snippets);
636
- else if (Array.isArray(snippets))
642
+ if (Array.isArray(snippets)) {
637
643
  snippets.forEach(addSnippet);
644
+ } else {
645
+ Object.keys(snippets).forEach(function(key) {
646
+ addSnippet(snippets[key]);
647
+ });
648
+ }
638
649
 
639
650
  this._signal("registerSnippets", {scope: scope});
640
651
  };
@@ -684,7 +695,7 @@ var SnippetManager = function() {
684
695
  snippet.tabTrigger = val.match(/^\S*/)[0];
685
696
  if (!snippet.name)
686
697
  snippet.name = val;
687
- } else {
698
+ } else if (key) {
688
699
  snippet[key] = val;
689
700
  }
690
701
  }
@@ -747,15 +758,16 @@ var TabstopManager = function(editor) {
747
758
 
748
759
  this.onChange = function(delta) {
749
760
  var isRemove = delta.action[0] == "r";
750
- var parents = this.selectedTabstop && this.selectedTabstop.parents || {};
761
+ var selectedTabstop = this.selectedTabstop || {};
762
+ var parents = selectedTabstop.parents || {};
751
763
  var tabstops = (this.tabstops || []).slice();
752
764
  for (var i = 0; i < tabstops.length; i++) {
753
765
  var ts = tabstops[i];
754
- var active = ts == this.selectedTabstop || parents[ts.index];
766
+ var active = ts == selectedTabstop || parents[ts.index];
755
767
  ts.rangeList.$bias = active ? 0 : 1;
756
768
 
757
- if (delta.action == "remove" && ts !== this.selectedTabstop) {
758
- var parentActive = ts.parents && ts.parents[this.selectedTabstop.index];
769
+ if (delta.action == "remove" && ts !== selectedTabstop) {
770
+ var parentActive = ts.parents && ts.parents[selectedTabstop.index];
759
771
  var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
760
772
  startIndex = startIndex < 0 ? -startIndex - 1 : startIndex + 1;
761
773
  var endIndex = ts.rangeList.pointIndex(delta.end, parentActive);
@@ -832,18 +844,17 @@ var TabstopManager = function(editor) {
832
844
 
833
845
  this.selectedTabstop = ts;
834
846
  var range = ts.firstNonLinked || ts;
847
+ if (ts.choices) range.cursor = range.start;
835
848
  if (!this.editor.inVirtualSelectionMode) {
836
849
  var sel = this.editor.multiSelect;
837
- sel.toSingleRange(range.clone());
850
+ sel.toSingleRange(range);
838
851
  for (var i = 0; i < ts.length; i++) {
839
852
  if (ts.hasLinkedRanges && ts[i].linked)
840
853
  continue;
841
854
  sel.addRange(ts[i].clone(), true);
842
855
  }
843
- if (sel.ranges[0])
844
- sel.addRange(sel.ranges[0].clone());
845
856
  } else {
846
- this.editor.selection.setRange(range);
857
+ this.editor.selection.fromOrientedRange(range);
847
858
  }
848
859
 
849
860
  this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
@@ -868,8 +879,6 @@ var TabstopManager = function(editor) {
868
879
  var ranges = this.ranges;
869
880
  tabstops.forEach(function(ts, index) {
870
881
  var dest = this.$openTabstops[index] || ts;
871
- ts.rangeList = new RangeList();
872
- ts.rangeList.$bias = 0;
873
882
 
874
883
  for (var i = 0; i < ts.length; i++) {
875
884
  var p = ts[i];
@@ -879,7 +888,6 @@ var TabstopManager = function(editor) {
879
888
  range.original = p;
880
889
  range.tabstop = dest;
881
890
  ranges.push(range);
882
- ts.rangeList.ranges.push(range);
883
891
  if (dest != ts)
884
892
  dest.unshift(range);
885
893
  else
@@ -897,6 +905,9 @@ var TabstopManager = function(editor) {
897
905
  this.$openTabstops[index] = dest;
898
906
  }
899
907
  this.addTabstopMarkers(dest);
908
+ dest.rangeList = dest.rangeList || new RangeList();
909
+ dest.rangeList.$bias = 0;
910
+ dest.rangeList.addList(dest);
900
911
  }, this);
901
912
 
902
913
  if (arg.length > 2) {
@@ -939,21 +950,18 @@ var TabstopManager = function(editor) {
939
950
 
940
951
  this.keyboardHandler = new HashHandler();
941
952
  this.keyboardHandler.bindKeys({
942
- "Tab": function(ed) {
943
- if (exports.snippetManager && exports.snippetManager.expandWithTab(ed)) {
953
+ "Tab": function(editor) {
954
+ if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
944
955
  return;
945
- }
946
-
947
- ed.tabstopManager.tabNext(1);
956
+ editor.tabstopManager.tabNext(1);
957
+ editor.renderer.scrollCursorIntoView();
948
958
  },
949
- "Shift-Tab": function(ed) {
950
- ed.tabstopManager.tabNext(-1);
959
+ "Shift-Tab": function(editor) {
960
+ editor.tabstopManager.tabNext(-1);
961
+ editor.renderer.scrollCursorIntoView();
951
962
  },
952
- "Esc": function(ed) {
953
- ed.tabstopManager.detach();
954
- },
955
- "Return": function(ed) {
956
- return false;
963
+ "Esc": function(editor) {
964
+ editor.tabstopManager.detach();
957
965
  }
958
966
  });
959
967
  }).call(TabstopManager.prototype);
@@ -1355,7 +1363,7 @@ exports.parForEach = function(array, fn, callback) {
1355
1363
  }
1356
1364
  };
1357
1365
 
1358
- var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\uFFFF]/;
1366
+ var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;
1359
1367
 
1360
1368
  exports.retrievePrecedingIdentifier = function(text, pos, regex) {
1361
1369
  regex = regex || ID_REGEX;
@@ -1478,6 +1486,7 @@ var Autocomplete = function() {
1478
1486
  } else if (keepPopupPosition && !prefix) {
1479
1487
  this.detach();
1480
1488
  }
1489
+ this.changeTimer.cancel();
1481
1490
  };
1482
1491
 
1483
1492
  this.detach = function() {
@@ -1540,13 +1549,15 @@ var Autocomplete = function() {
1540
1549
  if (!data)
1541
1550
  return false;
1542
1551
 
1552
+ var completions = this.completions;
1553
+ this.editor.startOperation({command: {name: "insertMatch"}});
1543
1554
  if (data.completer && data.completer.insertMatch) {
1544
1555
  data.completer.insertMatch(this.editor, data);
1545
1556
  } else {
1546
- if (this.completions.filterText) {
1557
+ if (completions.filterText) {
1547
1558
  var ranges = this.editor.selection.getAllRanges();
1548
1559
  for (var i = 0, range; range = ranges[i]; i++) {
1549
- range.start.column -= this.completions.filterText.length;
1560
+ range.start.column -= completions.filterText.length;
1550
1561
  this.editor.session.remove(range);
1551
1562
  }
1552
1563
  }
@@ -1555,7 +1566,9 @@ var Autocomplete = function() {
1555
1566
  else
1556
1567
  this.editor.execCommand("insertstring", data.value || data);
1557
1568
  }
1558
- this.detach();
1569
+ if (this.completions == completions)
1570
+ this.detach();
1571
+ this.editor.endOperation();
1559
1572
  };
1560
1573
 
1561
1574
 
@@ -2034,31 +2047,33 @@ var onChangeMode = function(e, editor) {
2034
2047
  };
2035
2048
 
2036
2049
  var loadSnippetsForMode = function(mode) {
2037
- var id = mode.$id;
2050
+ if (typeof mode == "string")
2051
+ mode = config.$modes[mode];
2052
+ if (!mode)
2053
+ return;
2038
2054
  if (!snippetManager.files)
2039
2055
  snippetManager.files = {};
2040
- loadSnippetFile(id);
2056
+
2057
+ loadSnippetFile(mode.$id, mode.snippetFileId);
2041
2058
  if (mode.modes)
2042
2059
  mode.modes.forEach(loadSnippetsForMode);
2043
2060
  };
2044
2061
 
2045
- var loadSnippetFile = function(id) {
2046
- if (!id || snippetManager.files[id])
2062
+ var loadSnippetFile = function(id, snippetFilePath) {
2063
+ if (!snippetFilePath || !id || snippetManager.files[id])
2047
2064
  return;
2048
- var snippetFilePath = id.replace("mode", "snippets");
2049
2065
  snippetManager.files[id] = {};
2050
2066
  config.loadModule(snippetFilePath, function(m) {
2051
- if (m) {
2052
- snippetManager.files[id] = m;
2053
- if (!m.snippets && m.snippetText)
2054
- m.snippets = snippetManager.parseSnippetFile(m.snippetText);
2055
- snippetManager.register(m.snippets || [], m.scope);
2056
- if (m.includeScopes) {
2057
- snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes;
2058
- m.includeScopes.forEach(function(x) {
2059
- loadSnippetFile("ace/mode/" + x);
2060
- });
2061
- }
2067
+ if (!m) return;
2068
+ snippetManager.files[id] = m;
2069
+ if (!m.snippets && m.snippetText)
2070
+ m.snippets = snippetManager.parseSnippetFile(m.snippetText);
2071
+ snippetManager.register(m.snippets || [], m.scope);
2072
+ if (m.includeScopes) {
2073
+ snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes;
2074
+ m.includeScopes.forEach(function(x) {
2075
+ loadSnippetsForMode("ace/mode/" + x);
2076
+ });
2062
2077
  }
2063
2078
  });
2064
2079
  };