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
@@ -403,7 +403,10 @@ var Mode = function() {
403
403
  };
404
404
  oop.inherits(Mode, TextMode);
405
405
 
406
- (function() {
406
+ (function() {
407
+ this.lineCommentStart = "//";
408
+ this.blockComment = {start: "/*", end: "*/"};
409
+
407
410
  this.$id = "ace/mode/stylus";
408
411
  }).call(Mode.prototype);
409
412
 
@@ -208,12 +208,13 @@ oop.inherits(XmlHighlightRules, TextHighlightRules);
208
208
  exports.XmlHighlightRules = XmlHighlightRules;
209
209
  });
210
210
 
211
- define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator"], function(require, exports, module) {
211
+ define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
212
212
  "use strict";
213
213
 
214
214
  var oop = require("../../lib/oop");
215
215
  var Behaviour = require("../behaviour").Behaviour;
216
216
  var TokenIterator = require("../../token_iterator").TokenIterator;
217
+ var lang = require("../../lib/lang");
217
218
 
218
219
  function is(token, type) {
219
220
  return token.type.lastIndexOf(type + ".xml") > -1;
@@ -311,29 +312,56 @@ var XmlBehaviour = function () {
311
312
  return;
312
313
 
313
314
  return {
314
- text: '>' + '</' + element + '>',
315
+ text: ">" + "</" + element + ">",
315
316
  selection: [1, 1]
316
317
  };
317
318
  }
318
319
  });
319
320
 
320
- this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
321
+ this.add("autoindent", "insertion", function (state, action, editor, session, text) {
321
322
  if (text == "\n") {
322
323
  var cursor = editor.getCursorPosition();
323
324
  var line = session.getLine(cursor.row);
324
- var rightChars = line.substring(cursor.column, cursor.column + 2);
325
- if (rightChars == '</') {
326
- var next_indent = this.$getIndent(line);
327
- var indent = next_indent + session.getTabString();
325
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
326
+ var token = iterator.getCurrentToken();
328
327
 
329
- return {
330
- text: '\n' + indent + '\n' + next_indent,
331
- selection: [1, indent.length, 1, indent.length]
332
- };
328
+ if (token && token.type.indexOf("tag-close") !== -1) {
329
+ while (token && token.type.indexOf("tag-name") === -1) {
330
+ token = iterator.stepBackward();
331
+ }
332
+
333
+ if (!token) {
334
+ return;
335
+ }
336
+
337
+ var tag = token.value;
338
+ var row = iterator.getCurrentTokenRow();
339
+ token = iterator.stepBackward();
340
+ if (!token || token.type.indexOf("end-tag") !== -1) {
341
+ return;
342
+ }
343
+
344
+ if (this.voidElements && !this.voidElements[tag]) {
345
+ var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
346
+ var line = session.getLine(row);
347
+ var nextIndent = this.$getIndent(line);
348
+ var indent = nextIndent + session.getTabString();
349
+
350
+ if (nextToken && nextToken.value === "</") {
351
+ return {
352
+ text: "\n" + indent + "\n" + nextIndent,
353
+ selection: [1, indent.length, 1, indent.length]
354
+ };
355
+ } else {
356
+ return {
357
+ text: "\n" + indent
358
+ };
359
+ }
360
+ }
333
361
  }
334
362
  }
335
363
  });
336
-
364
+
337
365
  };
338
366
 
339
367
  oop.inherits(XmlBehaviour, Behaviour);
@@ -618,22 +646,28 @@ var oop = require("../lib/oop");
618
646
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
619
647
 
620
648
  var DocCommentHighlightRules = function() {
621
-
622
649
  this.$rules = {
623
650
  "start" : [ {
624
651
  token : "comment.doc.tag",
625
652
  regex : "@[\\w\\d_]+" // TODO: fix email addresses
626
- }, {
627
- token : "comment.doc.tag",
628
- regex : "\\bTODO\\b"
629
- }, {
630
- defaultToken : "comment.doc"
653
+ },
654
+ DocCommentHighlightRules.getTagRule(),
655
+ {
656
+ defaultToken : "comment.doc",
657
+ caseInsensitive: true
631
658
  }]
632
659
  };
633
660
  };
634
661
 
635
662
  oop.inherits(DocCommentHighlightRules, TextHighlightRules);
636
663
 
664
+ DocCommentHighlightRules.getTagRule = function(start) {
665
+ return {
666
+ token : "comment.doc.tag.storage.type",
667
+ regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
668
+ };
669
+ }
670
+
637
671
  DocCommentHighlightRules.getStartRule = function(start) {
638
672
  return {
639
673
  token : "comment.doc", // doc comment
@@ -905,20 +939,24 @@ var JavaScriptHighlightRules = function(options) {
905
939
  }
906
940
  ],
907
941
  "comment_regex_allowed" : [
942
+ DocCommentHighlightRules.getTagRule(),
908
943
  {token : "comment", regex : "\\*\\/", next : "start"},
909
- {defaultToken : "comment"}
944
+ {defaultToken : "comment", caseInsensitive: true}
910
945
  ],
911
946
  "comment" : [
947
+ DocCommentHighlightRules.getTagRule(),
912
948
  {token : "comment", regex : "\\*\\/", next : "no_regex"},
913
- {defaultToken : "comment"}
949
+ {defaultToken : "comment", caseInsensitive: true}
914
950
  ],
915
951
  "line_comment_regex_allowed" : [
952
+ DocCommentHighlightRules.getTagRule(),
916
953
  {token : "comment", regex : "$|^", next : "start"},
917
- {defaultToken : "comment"}
954
+ {defaultToken : "comment", caseInsensitive: true}
918
955
  ],
919
956
  "line_comment" : [
957
+ DocCommentHighlightRules.getTagRule(),
920
958
  {token : "comment", regex : "$|^", next : "no_regex"},
921
- {defaultToken : "comment"}
959
+ {defaultToken : "comment", caseInsensitive: true}
922
960
  ],
923
961
  "qqstring" : [
924
962
  {
@@ -1057,11 +1095,11 @@ var SAFE_INSERT_BEFORE_TOKENS =
1057
1095
  ["text", "paren.rparen", "punctuation.operator", "comment"];
1058
1096
 
1059
1097
  var context;
1060
- var contextCache = {}
1098
+ var contextCache = {};
1061
1099
  var initContext = function(editor) {
1062
1100
  var id = -1;
1063
1101
  if (editor.multiSelect) {
1064
- id = editor.selection.id;
1102
+ id = editor.selection.index;
1065
1103
  if (contextCache.rangeCount != editor.multiSelect.rangeCount)
1066
1104
  contextCache = {rangeCount: editor.multiSelect.rangeCount};
1067
1105
  }
@@ -117,6 +117,7 @@ var Mode = function() {
117
117
  oop.inherits(Mode, TextMode);
118
118
 
119
119
  (function() {
120
+ this.type = "text";
120
121
  this.getNextLineIndent = function(state, line, tab) {
121
122
  if (state == "intag")
122
123
  return tab;
@@ -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);
@@ -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
  }
@@ -527,11 +527,11 @@ var SAFE_INSERT_BEFORE_TOKENS =
527
527
  ["text", "paren.rparen", "punctuation.operator", "comment"];
528
528
 
529
529
  var context;
530
- var contextCache = {}
530
+ var contextCache = {};
531
531
  var initContext = function(editor) {
532
532
  var id = -1;
533
533
  if (editor.multiSelect) {
534
- id = editor.selection.id;
534
+ id = editor.selection.index;
535
535
  if (contextCache.rangeCount != editor.multiSelect.rangeCount)
536
536
  contextCache = {rangeCount: editor.multiSelect.rangeCount};
537
537
  }
@@ -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);