ace-rails-ap 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ace/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/ace/ace.js +210 -161
  4. data/vendor/assets/javascripts/ace/ext-beautify.js +0 -1
  5. data/vendor/assets/javascripts/ace/ext-chromevox.js +0 -1
  6. data/vendor/assets/javascripts/ace/ext-elastic_tabstops_lite.js +0 -1
  7. data/vendor/assets/javascripts/ace/ext-emmet.js +66 -48
  8. data/vendor/assets/javascripts/ace/ext-keybinding_menu.js +9 -19
  9. data/vendor/assets/javascripts/ace/ext-language_tools.js +108 -10
  10. data/vendor/assets/javascripts/ace/ext-linking.js +0 -1
  11. data/vendor/assets/javascripts/ace/ext-modelist.js +4 -1
  12. data/vendor/assets/javascripts/ace/ext-old_ie.js +23 -2
  13. data/vendor/assets/javascripts/ace/ext-searchbox.js +23 -2
  14. data/vendor/assets/javascripts/ace/ext-settings_menu.js +10 -1
  15. data/vendor/assets/javascripts/ace/ext-spellcheck.js +0 -1
  16. data/vendor/assets/javascripts/ace/ext-split.js +0 -1
  17. data/vendor/assets/javascripts/ace/ext-static_highlight.js +0 -1
  18. data/vendor/assets/javascripts/ace/ext-statusbar.js +2 -4
  19. data/vendor/assets/javascripts/ace/ext-textarea.js +0 -1
  20. data/vendor/assets/javascripts/ace/ext-themelist.js +0 -1
  21. data/vendor/assets/javascripts/ace/ext-whitespace.js +0 -1
  22. data/vendor/assets/javascripts/ace/keybinding-emacs.js +159 -50
  23. data/vendor/assets/javascripts/ace/mode-autohotkey.js +1 -1
  24. data/vendor/assets/javascripts/ace/mode-c_cpp.js +32 -14
  25. data/vendor/assets/javascripts/ace/mode-coffee.js +1 -1
  26. data/vendor/assets/javascripts/ace/mode-coldfusion.js +62 -24
  27. data/vendor/assets/javascripts/ace/mode-csharp.js +14 -8
  28. data/vendor/assets/javascripts/ace/mode-css.js +2 -2
  29. data/vendor/assets/javascripts/ace/mode-curly.js +62 -24
  30. data/vendor/assets/javascripts/ace/mode-d.js +13 -7
  31. data/vendor/assets/javascripts/ace/mode-dart.js +32 -14
  32. data/vendor/assets/javascripts/ace/mode-django.js +62 -24
  33. data/vendor/assets/javascripts/ace/mode-dockerfile.js +3 -3
  34. data/vendor/assets/javascripts/ace/mode-dot.js +12 -6
  35. data/vendor/assets/javascripts/ace/mode-ejs.js +126 -27
  36. data/vendor/assets/javascripts/ace/mode-elixir.js +493 -0
  37. data/vendor/assets/javascripts/ace/mode-elm.js +248 -0
  38. data/vendor/assets/javascripts/ace/mode-forth.js +1 -1
  39. data/vendor/assets/javascripts/ace/mode-ftl.js +20 -10
  40. data/vendor/assets/javascripts/ace/mode-gitignore.js +1 -0
  41. data/vendor/assets/javascripts/ace/mode-glsl.js +32 -14
  42. data/vendor/assets/javascripts/ace/mode-golang.js +14 -8
  43. data/vendor/assets/javascripts/ace/mode-groovy.js +22 -12
  44. data/vendor/assets/javascripts/ace/mode-haml.js +64 -3
  45. data/vendor/assets/javascripts/ace/mode-handlebars.js +72 -34
  46. data/vendor/assets/javascripts/ace/mode-haxe.js +14 -8
  47. data/vendor/assets/javascripts/ace/mode-html.js +62 -24
  48. data/vendor/assets/javascripts/ace/mode-html_ruby.js +126 -27
  49. data/vendor/assets/javascripts/ace/mode-jack.js +2 -2
  50. data/vendor/assets/javascripts/ace/mode-jade.js +21 -11
  51. data/vendor/assets/javascripts/ace/mode-java.js +22 -12
  52. data/vendor/assets/javascripts/ace/mode-javascript.js +22 -12
  53. data/vendor/assets/javascripts/ace/mode-json.js +2 -2
  54. data/vendor/assets/javascripts/ace/mode-jsoniq.js +47 -1835
  55. data/vendor/assets/javascripts/ace/mode-jsp.js +22 -12
  56. data/vendor/assets/javascripts/ace/mode-jsx.js +14 -8
  57. data/vendor/assets/javascripts/ace/mode-less.js +2 -2
  58. data/vendor/assets/javascripts/ace/mode-liquid.js +20 -10
  59. data/vendor/assets/javascripts/ace/mode-logiql.js +2 -2
  60. data/vendor/assets/javascripts/ace/mode-lsl.js +2 -2
  61. data/vendor/assets/javascripts/ace/mode-luapage.js +62 -24
  62. data/vendor/assets/javascripts/ace/mode-markdown.js +62 -24
  63. data/vendor/assets/javascripts/ace/mode-mel.js +2 -2
  64. data/vendor/assets/javascripts/ace/mode-mysql.js +12 -6
  65. data/vendor/assets/javascripts/ace/mode-nix.js +32 -14
  66. data/vendor/assets/javascripts/ace/mode-objectivec.js +30 -12
  67. data/vendor/assets/javascripts/ace/mode-pgsql.js +20 -10
  68. data/vendor/assets/javascripts/ace/mode-php.js +1126 -40
  69. data/vendor/assets/javascripts/ace/mode-powershell.js +2 -2
  70. data/vendor/assets/javascripts/ace/mode-protobuf.js +32 -14
  71. data/vendor/assets/javascripts/ace/mode-rhtml.js +62 -24
  72. data/vendor/assets/javascripts/ace/mode-ruby.js +66 -5
  73. data/vendor/assets/javascripts/ace/mode-rust.js +36 -3
  74. data/vendor/assets/javascripts/ace/mode-scad.js +14 -8
  75. data/vendor/assets/javascripts/ace/mode-scala.js +22 -12
  76. data/vendor/assets/javascripts/ace/mode-scss.js +2 -2
  77. data/vendor/assets/javascripts/ace/mode-sh.js +2 -2
  78. data/vendor/assets/javascripts/ace/mode-sjs.js +22 -12
  79. data/vendor/assets/javascripts/ace/mode-smarty.js +62 -24
  80. data/vendor/assets/javascripts/ace/mode-soy_template.js +63 -25
  81. data/vendor/assets/javascripts/ace/mode-stylus.js +4 -1
  82. data/vendor/assets/javascripts/ace/mode-svg.js +62 -24
  83. data/vendor/assets/javascripts/ace/mode-textile.js +1 -0
  84. data/vendor/assets/javascripts/ace/mode-twig.js +62 -24
  85. data/vendor/assets/javascripts/ace/mode-typescript.js +22 -12
  86. data/vendor/assets/javascripts/ace/mode-vala.js +2 -2
  87. data/vendor/assets/javascripts/ace/mode-velocity.js +62 -24
  88. data/vendor/assets/javascripts/ace/mode-xml.js +40 -12
  89. data/vendor/assets/javascripts/ace/mode-xquery.js +47 -1835
  90. data/vendor/assets/javascripts/ace/theme-cobalt.js +1 -1
  91. data/vendor/assets/javascripts/ace/theme-idle_fingers.js +1 -1
  92. data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +2 -2
  93. data/vendor/assets/javascripts/ace/worker-coffee.js +15 -5
  94. data/vendor/assets/javascripts/ace/worker-css.js +15 -5
  95. data/vendor/assets/javascripts/ace/worker-html.js +15 -5
  96. data/vendor/assets/javascripts/ace/worker-javascript.js +15 -5
  97. data/vendor/assets/javascripts/ace/worker-json.js +17 -6
  98. data/vendor/assets/javascripts/ace/worker-lua.js +15 -5
  99. data/vendor/assets/javascripts/ace/worker-php.js +15 -5
  100. data/vendor/assets/javascripts/ace/worker-xquery.js +15 -5
  101. metadata +4 -2
@@ -5,22 +5,28 @@ var oop = require("../lib/oop");
5
5
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
6
6
 
7
7
  var DocCommentHighlightRules = function() {
8
-
9
8
  this.$rules = {
10
9
  "start" : [ {
11
10
  token : "comment.doc.tag",
12
11
  regex : "@[\\w\\d_]+" // TODO: fix email addresses
13
- }, {
14
- token : "comment.doc.tag",
15
- regex : "\\bTODO\\b"
16
- }, {
17
- defaultToken : "comment.doc"
12
+ },
13
+ DocCommentHighlightRules.getTagRule(),
14
+ {
15
+ defaultToken : "comment.doc",
16
+ caseInsensitive: true
18
17
  }]
19
18
  };
20
19
  };
21
20
 
22
21
  oop.inherits(DocCommentHighlightRules, TextHighlightRules);
23
22
 
23
+ DocCommentHighlightRules.getTagRule = function(start) {
24
+ return {
25
+ token : "comment.doc.tag.storage.type",
26
+ regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+ };
28
+ }
29
+
24
30
  DocCommentHighlightRules.getStartRule = function(start) {
25
31
  return {
26
32
  token : "comment.doc", // doc comment
@@ -452,7 +458,7 @@ var Mode = function() {
452
458
  oop.inherits(Mode, TextMode);
453
459
 
454
460
  (function() {
455
- this.lineCommentStart = "/\\+";
461
+ this.lineCommentStart = "//";
456
462
  this.blockComment = {start: "/*", end: "*/"};
457
463
  this.$id = "ace/mode/d";
458
464
  }).call(Mode.prototype);
@@ -5,22 +5,28 @@ var oop = require("../lib/oop");
5
5
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
6
6
 
7
7
  var DocCommentHighlightRules = function() {
8
-
9
8
  this.$rules = {
10
9
  "start" : [ {
11
10
  token : "comment.doc.tag",
12
11
  regex : "@[\\w\\d_]+" // TODO: fix email addresses
13
- }, {
14
- token : "comment.doc.tag",
15
- regex : "\\bTODO\\b"
16
- }, {
17
- defaultToken : "comment.doc"
12
+ },
13
+ DocCommentHighlightRules.getTagRule(),
14
+ {
15
+ defaultToken : "comment.doc",
16
+ caseInsensitive: true
18
17
  }]
19
18
  };
20
19
  };
21
20
 
22
21
  oop.inherits(DocCommentHighlightRules, TextHighlightRules);
23
22
 
23
+ DocCommentHighlightRules.getTagRule = function(start) {
24
+ return {
25
+ token : "comment.doc.tag.storage.type",
26
+ regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+ };
28
+ }
29
+
24
30
  DocCommentHighlightRules.getStartRule = function(start) {
25
31
  return {
26
32
  token : "comment.doc", // doc comment
@@ -89,11 +95,12 @@ var c_cppHighlightRules = function() {
89
95
 
90
96
  var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
91
97
 
92
- this.$rules = {
98
+ this.$rules = {
93
99
  "start" : [
94
100
  {
95
101
  token : "comment",
96
- regex : "\\/\\/.*$"
102
+ regex : "//",
103
+ next : "singleLineComment"
97
104
  },
98
105
  DocCommentHighlightRules.getStartRule("doc-start"),
99
106
  {
@@ -160,14 +167,26 @@ var c_cppHighlightRules = function() {
160
167
  regex : ".+"
161
168
  }
162
169
  ],
170
+ "singleLineComment" : [
171
+ {
172
+ token : "comment",
173
+ regex : /\\$/,
174
+ next : "singleLineComment"
175
+ }, {
176
+ token : "comment",
177
+ regex : /$/,
178
+ next : "start"
179
+ }, {
180
+ defaultToken: "comment"
181
+ }
182
+ ],
163
183
  "qqstring" : [
164
184
  {
165
185
  token : "string",
166
186
  regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
167
187
  next : "start"
168
188
  }, {
169
- token : "string",
170
- regex : '.+'
189
+ defaultToken : "string"
171
190
  }
172
191
  ],
173
192
  "qstring" : [
@@ -176,8 +195,7 @@ var c_cppHighlightRules = function() {
176
195
  regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
177
196
  next : "start"
178
197
  }, {
179
- token : "string",
180
- regex : '.+'
198
+ defaultToken : "string"
181
199
  }
182
200
  ],
183
201
  "directive" : [
@@ -275,11 +293,11 @@ var SAFE_INSERT_BEFORE_TOKENS =
275
293
  ["text", "paren.rparen", "punctuation.operator", "comment"];
276
294
 
277
295
  var context;
278
- var contextCache = {}
296
+ var contextCache = {};
279
297
  var initContext = function(editor) {
280
298
  var id = -1;
281
299
  if (editor.multiSelect) {
282
- id = editor.selection.id;
300
+ id = editor.selection.index;
283
301
  if (contextCache.rangeCount != editor.multiSelect.rangeCount)
284
302
  contextCache = {rangeCount: editor.multiSelect.rangeCount};
285
303
  }
@@ -5,22 +5,28 @@ var oop = require("../lib/oop");
5
5
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
6
6
 
7
7
  var DocCommentHighlightRules = function() {
8
-
9
8
  this.$rules = {
10
9
  "start" : [ {
11
10
  token : "comment.doc.tag",
12
11
  regex : "@[\\w\\d_]+" // TODO: fix email addresses
13
- }, {
14
- token : "comment.doc.tag",
15
- regex : "\\bTODO\\b"
16
- }, {
17
- defaultToken : "comment.doc"
12
+ },
13
+ DocCommentHighlightRules.getTagRule(),
14
+ {
15
+ defaultToken : "comment.doc",
16
+ caseInsensitive: true
18
17
  }]
19
18
  };
20
19
  };
21
20
 
22
21
  oop.inherits(DocCommentHighlightRules, TextHighlightRules);
23
22
 
23
+ DocCommentHighlightRules.getTagRule = function(start) {
24
+ return {
25
+ token : "comment.doc.tag.storage.type",
26
+ regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+ };
28
+ }
29
+
24
30
  DocCommentHighlightRules.getStartRule = function(start) {
25
31
  return {
26
32
  token : "comment.doc", // doc comment
@@ -292,20 +298,24 @@ var JavaScriptHighlightRules = function(options) {
292
298
  }
293
299
  ],
294
300
  "comment_regex_allowed" : [
301
+ DocCommentHighlightRules.getTagRule(),
295
302
  {token : "comment", regex : "\\*\\/", next : "start"},
296
- {defaultToken : "comment"}
303
+ {defaultToken : "comment", caseInsensitive: true}
297
304
  ],
298
305
  "comment" : [
306
+ DocCommentHighlightRules.getTagRule(),
299
307
  {token : "comment", regex : "\\*\\/", next : "no_regex"},
300
- {defaultToken : "comment"}
308
+ {defaultToken : "comment", caseInsensitive: true}
301
309
  ],
302
310
  "line_comment_regex_allowed" : [
311
+ DocCommentHighlightRules.getTagRule(),
303
312
  {token : "comment", regex : "$|^", next : "start"},
304
- {defaultToken : "comment"}
313
+ {defaultToken : "comment", caseInsensitive: true}
305
314
  ],
306
315
  "line_comment" : [
316
+ DocCommentHighlightRules.getTagRule(),
307
317
  {token : "comment", regex : "$|^", next : "no_regex"},
308
- {defaultToken : "comment"}
318
+ {defaultToken : "comment", caseInsensitive: true}
309
319
  ],
310
320
  "qqstring" : [
311
321
  {
@@ -444,11 +454,11 @@ var SAFE_INSERT_BEFORE_TOKENS =
444
454
  ["text", "paren.rparen", "punctuation.operator", "comment"];
445
455
 
446
456
  var context;
447
- var contextCache = {}
457
+ var contextCache = {};
448
458
  var initContext = function(editor) {
449
459
  var id = -1;
450
460
  if (editor.multiSelect) {
451
- id = editor.selection.id;
461
+ id = editor.selection.index;
452
462
  if (contextCache.rangeCount != editor.multiSelect.rangeCount)
453
463
  contextCache = {rangeCount: editor.multiSelect.rangeCount};
454
464
  }
@@ -1554,12 +1564,13 @@ oop.inherits(HtmlHighlightRules, XmlHighlightRules);
1554
1564
  exports.HtmlHighlightRules = HtmlHighlightRules;
1555
1565
  });
1556
1566
 
1557
- define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator"], function(require, exports, module) {
1567
+ define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
1558
1568
  "use strict";
1559
1569
 
1560
1570
  var oop = require("../../lib/oop");
1561
1571
  var Behaviour = require("../behaviour").Behaviour;
1562
1572
  var TokenIterator = require("../../token_iterator").TokenIterator;
1573
+ var lang = require("../../lib/lang");
1563
1574
 
1564
1575
  function is(token, type) {
1565
1576
  return token.type.lastIndexOf(type + ".xml") > -1;
@@ -1657,29 +1668,56 @@ var XmlBehaviour = function () {
1657
1668
  return;
1658
1669
 
1659
1670
  return {
1660
- text: '>' + '</' + element + '>',
1671
+ text: ">" + "</" + element + ">",
1661
1672
  selection: [1, 1]
1662
1673
  };
1663
1674
  }
1664
1675
  });
1665
1676
 
1666
- this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
1677
+ this.add("autoindent", "insertion", function (state, action, editor, session, text) {
1667
1678
  if (text == "\n") {
1668
1679
  var cursor = editor.getCursorPosition();
1669
1680
  var line = session.getLine(cursor.row);
1670
- var rightChars = line.substring(cursor.column, cursor.column + 2);
1671
- if (rightChars == '</') {
1672
- var next_indent = this.$getIndent(line);
1673
- var indent = next_indent + session.getTabString();
1681
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1682
+ var token = iterator.getCurrentToken();
1674
1683
 
1675
- return {
1676
- text: '\n' + indent + '\n' + next_indent,
1677
- selection: [1, indent.length, 1, indent.length]
1678
- };
1684
+ if (token && token.type.indexOf("tag-close") !== -1) {
1685
+ while (token && token.type.indexOf("tag-name") === -1) {
1686
+ token = iterator.stepBackward();
1687
+ }
1688
+
1689
+ if (!token) {
1690
+ return;
1691
+ }
1692
+
1693
+ var tag = token.value;
1694
+ var row = iterator.getCurrentTokenRow();
1695
+ token = iterator.stepBackward();
1696
+ if (!token || token.type.indexOf("end-tag") !== -1) {
1697
+ return;
1698
+ }
1699
+
1700
+ if (this.voidElements && !this.voidElements[tag]) {
1701
+ var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
1702
+ var line = session.getLine(row);
1703
+ var nextIndent = this.$getIndent(line);
1704
+ var indent = nextIndent + session.getTabString();
1705
+
1706
+ if (nextToken && nextToken.value === "</") {
1707
+ return {
1708
+ text: "\n" + indent + "\n" + nextIndent,
1709
+ selection: [1, indent.length, 1, indent.length]
1710
+ };
1711
+ } else {
1712
+ return {
1713
+ text: "\n" + indent
1714
+ };
1715
+ }
1716
+ }
1679
1717
  }
1680
1718
  }
1681
1719
  });
1682
-
1720
+
1683
1721
  };
1684
1722
 
1685
1723
  oop.inherits(XmlBehaviour, Behaviour);
@@ -280,11 +280,11 @@ var SAFE_INSERT_BEFORE_TOKENS =
280
280
  ["text", "paren.rparen", "punctuation.operator", "comment"];
281
281
 
282
282
  var context;
283
- var contextCache = {}
283
+ var contextCache = {};
284
284
  var initContext = function(editor) {
285
285
  var id = -1;
286
286
  if (editor.multiSelect) {
287
- id = editor.selection.id;
287
+ id = editor.selection.index;
288
288
  if (contextCache.rangeCount != editor.multiSelect.rangeCount)
289
289
  contextCache = {rangeCount: editor.multiSelect.rangeCount};
290
290
  }
@@ -721,7 +721,7 @@ var DockerfileHighlightRules = function() {
721
721
  if (startRules[i].token == "variable.language") {
722
722
  startRules.splice(i, 0, {
723
723
  token: "constant.language",
724
- regex: "(?:^(?:FROM|MAINTAINER|RUN|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD)\\b)",
724
+ regex: "(?:^(?:FROM|MAINTAINER|RUN|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD|COPY)\\b)",
725
725
  caseInsensitive: true
726
726
  });
727
727
  break;
@@ -45,22 +45,28 @@ var oop = require("../lib/oop");
45
45
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
46
46
 
47
47
  var DocCommentHighlightRules = function() {
48
-
49
48
  this.$rules = {
50
49
  "start" : [ {
51
50
  token : "comment.doc.tag",
52
51
  regex : "@[\\w\\d_]+" // TODO: fix email addresses
53
- }, {
54
- token : "comment.doc.tag",
55
- regex : "\\bTODO\\b"
56
- }, {
57
- defaultToken : "comment.doc"
52
+ },
53
+ DocCommentHighlightRules.getTagRule(),
54
+ {
55
+ defaultToken : "comment.doc",
56
+ caseInsensitive: true
58
57
  }]
59
58
  };
60
59
  };
61
60
 
62
61
  oop.inherits(DocCommentHighlightRules, TextHighlightRules);
63
62
 
63
+ DocCommentHighlightRules.getTagRule = function(start) {
64
+ return {
65
+ token : "comment.doc.tag.storage.type",
66
+ regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
67
+ };
68
+ }
69
+
64
70
  DocCommentHighlightRules.getStartRule = function(start) {
65
71
  return {
66
72
  token : "comment.doc", // doc comment
@@ -149,22 +149,28 @@ var oop = require("../lib/oop");
149
149
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
150
150
 
151
151
  var DocCommentHighlightRules = function() {
152
-
153
152
  this.$rules = {
154
153
  "start" : [ {
155
154
  token : "comment.doc.tag",
156
155
  regex : "@[\\w\\d_]+" // TODO: fix email addresses
157
- }, {
158
- token : "comment.doc.tag",
159
- regex : "\\bTODO\\b"
160
- }, {
161
- defaultToken : "comment.doc"
156
+ },
157
+ DocCommentHighlightRules.getTagRule(),
158
+ {
159
+ defaultToken : "comment.doc",
160
+ caseInsensitive: true
162
161
  }]
163
162
  };
164
163
  };
165
164
 
166
165
  oop.inherits(DocCommentHighlightRules, TextHighlightRules);
167
166
 
167
+ DocCommentHighlightRules.getTagRule = function(start) {
168
+ return {
169
+ token : "comment.doc.tag.storage.type",
170
+ regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
171
+ };
172
+ }
173
+
168
174
  DocCommentHighlightRules.getStartRule = function(start) {
169
175
  return {
170
176
  token : "comment.doc", // doc comment
@@ -436,20 +442,24 @@ var JavaScriptHighlightRules = function(options) {
436
442
  }
437
443
  ],
438
444
  "comment_regex_allowed" : [
445
+ DocCommentHighlightRules.getTagRule(),
439
446
  {token : "comment", regex : "\\*\\/", next : "start"},
440
- {defaultToken : "comment"}
447
+ {defaultToken : "comment", caseInsensitive: true}
441
448
  ],
442
449
  "comment" : [
450
+ DocCommentHighlightRules.getTagRule(),
443
451
  {token : "comment", regex : "\\*\\/", next : "no_regex"},
444
- {defaultToken : "comment"}
452
+ {defaultToken : "comment", caseInsensitive: true}
445
453
  ],
446
454
  "line_comment_regex_allowed" : [
455
+ DocCommentHighlightRules.getTagRule(),
447
456
  {token : "comment", regex : "$|^", next : "start"},
448
- {defaultToken : "comment"}
457
+ {defaultToken : "comment", caseInsensitive: true}
449
458
  ],
450
459
  "line_comment" : [
460
+ DocCommentHighlightRules.getTagRule(),
451
461
  {token : "comment", regex : "$|^", next : "no_regex"},
452
- {defaultToken : "comment"}
462
+ {defaultToken : "comment", caseInsensitive: true}
453
463
  ],
454
464
  "qqstring" : [
455
465
  {
@@ -880,11 +890,11 @@ var SAFE_INSERT_BEFORE_TOKENS =
880
890
  ["text", "paren.rparen", "punctuation.operator", "comment"];
881
891
 
882
892
  var context;
883
- var contextCache = {}
893
+ var contextCache = {};
884
894
  var initContext = function(editor) {
885
895
  var id = -1;
886
896
  if (editor.multiSelect) {
887
- id = editor.selection.id;
897
+ id = editor.selection.index;
888
898
  if (contextCache.rangeCount != editor.multiSelect.rangeCount)
889
899
  contextCache = {rangeCount: editor.multiSelect.rangeCount};
890
900
  }
@@ -1554,12 +1564,13 @@ exports.Mode = Mode;
1554
1564
 
1555
1565
  });
1556
1566
 
1557
- define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator"], function(require, exports, module) {
1567
+ define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
1558
1568
  "use strict";
1559
1569
 
1560
1570
  var oop = require("../../lib/oop");
1561
1571
  var Behaviour = require("../behaviour").Behaviour;
1562
1572
  var TokenIterator = require("../../token_iterator").TokenIterator;
1573
+ var lang = require("../../lib/lang");
1563
1574
 
1564
1575
  function is(token, type) {
1565
1576
  return token.type.lastIndexOf(type + ".xml") > -1;
@@ -1657,29 +1668,56 @@ var XmlBehaviour = function () {
1657
1668
  return;
1658
1669
 
1659
1670
  return {
1660
- text: '>' + '</' + element + '>',
1671
+ text: ">" + "</" + element + ">",
1661
1672
  selection: [1, 1]
1662
1673
  };
1663
1674
  }
1664
1675
  });
1665
1676
 
1666
- this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
1677
+ this.add("autoindent", "insertion", function (state, action, editor, session, text) {
1667
1678
  if (text == "\n") {
1668
1679
  var cursor = editor.getCursorPosition();
1669
1680
  var line = session.getLine(cursor.row);
1670
- var rightChars = line.substring(cursor.column, cursor.column + 2);
1671
- if (rightChars == '</') {
1672
- var next_indent = this.$getIndent(line);
1673
- var indent = next_indent + session.getTabString();
1681
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1682
+ var token = iterator.getCurrentToken();
1674
1683
 
1675
- return {
1676
- text: '\n' + indent + '\n' + next_indent,
1677
- selection: [1, indent.length, 1, indent.length]
1678
- };
1684
+ if (token && token.type.indexOf("tag-close") !== -1) {
1685
+ while (token && token.type.indexOf("tag-name") === -1) {
1686
+ token = iterator.stepBackward();
1687
+ }
1688
+
1689
+ if (!token) {
1690
+ return;
1691
+ }
1692
+
1693
+ var tag = token.value;
1694
+ var row = iterator.getCurrentTokenRow();
1695
+ token = iterator.stepBackward();
1696
+ if (!token || token.type.indexOf("end-tag") !== -1) {
1697
+ return;
1698
+ }
1699
+
1700
+ if (this.voidElements && !this.voidElements[tag]) {
1701
+ var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
1702
+ var line = session.getLine(row);
1703
+ var nextIndent = this.$getIndent(line);
1704
+ var indent = nextIndent + session.getTabString();
1705
+
1706
+ if (nextToken && nextToken.value === "</") {
1707
+ return {
1708
+ text: "\n" + indent + "\n" + nextIndent,
1709
+ selection: [1, indent.length, 1, indent.length]
1710
+ };
1711
+ } else {
1712
+ return {
1713
+ text: "\n" + indent
1714
+ };
1715
+ }
1716
+ }
1679
1717
  }
1680
1718
  }
1681
1719
  });
1682
-
1720
+
1683
1721
  };
1684
1722
 
1685
1723
  oop.inherits(XmlBehaviour, Behaviour);
@@ -2455,9 +2493,70 @@ var RubyHighlightRules = function() {
2455
2493
  regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
2456
2494
  },
2457
2495
 
2458
- qString,
2459
- qqString,
2460
- tString,
2496
+ [{
2497
+ regex: "[{}]", onMatch: function(val, state, stack) {
2498
+ this.next = val == "{" ? this.nextState : "";
2499
+ if (val == "{" && stack.length) {
2500
+ stack.unshift("start", state);
2501
+ return "paren.lparen";
2502
+ }
2503
+ if (val == "}" && stack.length) {
2504
+ stack.shift();
2505
+ this.next = stack.shift();
2506
+ if (this.next.indexOf("string") != -1)
2507
+ return "paren.end";
2508
+ }
2509
+ return val == "{" ? "paren.lparen" : "paren.rparen";
2510
+ },
2511
+ nextState: "start"
2512
+ }, {
2513
+ token : "string.start",
2514
+ regex : /"/,
2515
+ push : [{
2516
+ token : "constant.language.escape",
2517
+ regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
2518
+ }, {
2519
+ token : "paren.start",
2520
+ regex : /\#{/,
2521
+ push : "start"
2522
+ }, {
2523
+ token : "string.end",
2524
+ regex : /"/,
2525
+ next : "pop"
2526
+ }, {
2527
+ defaultToken: "string"
2528
+ }]
2529
+ }, {
2530
+ token : "string.start",
2531
+ regex : /`/,
2532
+ push : [{
2533
+ token : "constant.language.escape",
2534
+ regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
2535
+ }, {
2536
+ token : "paren.start",
2537
+ regex : /\#{/,
2538
+ push : "start"
2539
+ }, {
2540
+ token : "string.end",
2541
+ regex : /`/,
2542
+ next : "pop"
2543
+ }, {
2544
+ defaultToken: "string"
2545
+ }]
2546
+ }, {
2547
+ token : "string.start",
2548
+ regex : /'/,
2549
+ push : [{
2550
+ token : "constant.language.escape",
2551
+ regex : /\\['\\]/
2552
+ }, {
2553
+ token : "string.end",
2554
+ regex : /'/,
2555
+ next : "pop"
2556
+ }, {
2557
+ defaultToken: "string"
2558
+ }]
2559
+ }],
2461
2560
 
2462
2561
  {
2463
2562
  token : "text", // namespaces aren't symbols