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
@@ -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
  }
@@ -106,9 +106,70 @@ var RubyHighlightRules = function() {
106
106
  regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
107
107
  },
108
108
 
109
- qString,
110
- qqString,
111
- tString,
109
+ [{
110
+ regex: "[{}]", onMatch: function(val, state, stack) {
111
+ this.next = val == "{" ? this.nextState : "";
112
+ if (val == "{" && stack.length) {
113
+ stack.unshift("start", state);
114
+ return "paren.lparen";
115
+ }
116
+ if (val == "}" && stack.length) {
117
+ stack.shift();
118
+ this.next = stack.shift();
119
+ if (this.next.indexOf("string") != -1)
120
+ return "paren.end";
121
+ }
122
+ return val == "{" ? "paren.lparen" : "paren.rparen";
123
+ },
124
+ nextState: "start"
125
+ }, {
126
+ token : "string.start",
127
+ regex : /"/,
128
+ push : [{
129
+ token : "constant.language.escape",
130
+ regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
131
+ }, {
132
+ token : "paren.start",
133
+ regex : /\#{/,
134
+ push : "start"
135
+ }, {
136
+ token : "string.end",
137
+ regex : /"/,
138
+ next : "pop"
139
+ }, {
140
+ defaultToken: "string"
141
+ }]
142
+ }, {
143
+ token : "string.start",
144
+ regex : /`/,
145
+ push : [{
146
+ token : "constant.language.escape",
147
+ regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
148
+ }, {
149
+ token : "paren.start",
150
+ regex : /\#{/,
151
+ push : "start"
152
+ }, {
153
+ token : "string.end",
154
+ regex : /`/,
155
+ next : "pop"
156
+ }, {
157
+ defaultToken: "string"
158
+ }]
159
+ }, {
160
+ token : "string.start",
161
+ regex : /'/,
162
+ push : [{
163
+ token : "constant.language.escape",
164
+ regex : /\\['\\]/
165
+ }, {
166
+ token : "string.end",
167
+ regex : /'/,
168
+ next : "pop"
169
+ }, {
170
+ defaultToken: "string"
171
+ }]
172
+ }],
112
173
 
113
174
  {
114
175
  token : "text", // namespaces aren't symbols
@@ -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);
@@ -2362,7 +2400,7 @@ var HandlebarsHighlightRules = function() {
2362
2400
  var hbs = {
2363
2401
  regex : "(?={{)",
2364
2402
  push : "handlebars"
2365
- }
2403
+ };
2366
2404
  for (var key in this.$rules) {
2367
2405
  this.$rules[key].unshift(hbs);
2368
2406
  }
@@ -2387,22 +2425,22 @@ var HandlebarsHighlightRules = function() {
2387
2425
  defaultToken : "comment"
2388
2426
  }]
2389
2427
  }, {
2390
- token : "storage.type.start", // begin section
2391
- regex : "{{[#\\^/&]?",
2428
+ token : "support.function", // unescaped variable
2429
+ regex : "{{{",
2392
2430
  push : [{
2393
- token : "storage.type.end",
2394
- regex : "}}",
2431
+ token : "support.function",
2432
+ regex : "}}}",
2395
2433
  next : pop2
2396
2434
  }, {
2397
2435
  token : "variable.parameter",
2398
2436
  regex : "[a-zA-Z_$][a-zA-Z0-9_$]*"
2399
2437
  }]
2400
2438
  }, {
2401
- token : "support.function", // unescaped variable
2402
- regex : "{{{",
2439
+ token : "storage.type.start", // begin section
2440
+ regex : "{{[#\\^/&]?",
2403
2441
  push : [{
2404
- token : "support.function",
2405
- regex : "}}}",
2442
+ token : "storage.type.end",
2443
+ regex : "}}",
2406
2444
  next : pop2
2407
2445
  }, {
2408
2446
  token : "variable.parameter",
@@ -2456,7 +2494,7 @@ var Mode = function() {
2456
2494
  oop.inherits(Mode, HtmlMode);
2457
2495
 
2458
2496
  (function() {
2459
-
2497
+ this.blockComment = {start: "{!--", end: "--}"};
2460
2498
  this.$id = "ace/mode/handlebars";
2461
2499
  }).call(Mode.prototype);
2462
2500
 
@@ -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
@@ -190,11 +196,11 @@ var SAFE_INSERT_BEFORE_TOKENS =
190
196
  ["text", "paren.rparen", "punctuation.operator", "comment"];
191
197
 
192
198
  var context;
193
- var contextCache = {}
199
+ var contextCache = {};
194
200
  var initContext = function(editor) {
195
201
  var id = -1;
196
202
  if (editor.multiSelect) {
197
- id = editor.selection.id;
203
+ id = editor.selection.index;
198
204
  if (contextCache.rangeCount != editor.multiSelect.rangeCount)
199
205
  contextCache = {rangeCount: editor.multiSelect.rangeCount};
200
206
  }
@@ -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);