ace-rails-ap 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ace/rails/version.rb +1 -1
- data/vendor/assets/javascripts/ace/ace.js +403 -326
- data/vendor/assets/javascripts/ace/ext-language_tools.js +56 -40
- data/vendor/assets/javascripts/ace/ext-modelist.js +7 -3
- data/vendor/assets/javascripts/ace/ext-settings_menu.js +8 -4
- data/vendor/assets/javascripts/ace/ext-static_highlight.js +12 -5
- data/vendor/assets/javascripts/ace/keybinding-vim.js +5234 -1558
- data/vendor/assets/javascripts/ace/mode-abap.js +1 -1
- data/vendor/assets/javascripts/ace/mode-abc.js +261 -0
- data/vendor/assets/javascripts/ace/mode-actionscript.js +47 -1
- data/vendor/assets/javascripts/ace/mode-apache_conf.js +47 -1
- data/vendor/assets/javascripts/ace/mode-applescript.js +47 -1
- data/vendor/assets/javascripts/ace/mode-autohotkey.js +47 -1
- data/vendor/assets/javascripts/ace/mode-batchfile.js +47 -1
- data/vendor/assets/javascripts/ace/mode-c_cpp.js +101 -56
- data/vendor/assets/javascripts/ace/mode-coffee.js +3 -3
- data/vendor/assets/javascripts/ace/mode-coldfusion.js +114 -63
- data/vendor/assets/javascripts/ace/mode-csharp.js +99 -55
- data/vendor/assets/javascripts/ace/mode-css.js +98 -53
- data/vendor/assets/javascripts/ace/mode-curly.js +114 -63
- data/vendor/assets/javascripts/ace/mode-d.js +47 -1
- data/vendor/assets/javascripts/ace/mode-dart.js +103 -58
- data/vendor/assets/javascripts/ace/mode-diff.js +85 -85
- data/vendor/assets/javascripts/ace/mode-django.js +114 -63
- data/vendor/assets/javascripts/ace/mode-dockerfile.js +97 -52
- data/vendor/assets/javascripts/ace/mode-dot.js +47 -1
- data/vendor/assets/javascripts/ace/mode-eiffel.js +30 -37
- data/vendor/assets/javascripts/ace/mode-ejs.js +117 -63
- data/vendor/assets/javascripts/ace/mode-elm.js +47 -1
- data/vendor/assets/javascripts/ace/mode-erlang.js +47 -1
- data/vendor/assets/javascripts/ace/mode-forth.js +47 -1
- data/vendor/assets/javascripts/ace/mode-ftl.js +10 -7
- data/vendor/assets/javascripts/ace/mode-glsl.js +101 -56
- data/vendor/assets/javascripts/ace/mode-golang.js +96 -51
- data/vendor/assets/javascripts/ace/mode-groovy.js +98 -53
- data/vendor/assets/javascripts/ace/mode-haml.js +3 -0
- data/vendor/assets/javascripts/ace/mode-handlebars.js +114 -63
- data/vendor/assets/javascripts/ace/mode-haskell.js +49 -3
- data/vendor/assets/javascripts/ace/mode-haxe.js +96 -51
- data/vendor/assets/javascripts/ace/mode-html.js +114 -63
- data/vendor/assets/javascripts/ace/mode-html_ruby.js +117 -63
- data/vendor/assets/javascripts/ace/mode-io.js +47 -1
- data/vendor/assets/javascripts/ace/mode-jack.js +96 -51
- data/vendor/assets/javascripts/ace/mode-jade.js +10 -7
- data/vendor/assets/javascripts/ace/mode-java.js +98 -53
- data/vendor/assets/javascripts/ace/mode-javascript.js +98 -53
- data/vendor/assets/javascripts/ace/mode-json.js +99 -54
- data/vendor/assets/javascripts/ace/mode-jsoniq.js +98 -51
- data/vendor/assets/javascripts/ace/mode-jsp.js +106 -58
- data/vendor/assets/javascripts/ace/mode-jsx.js +96 -51
- data/vendor/assets/javascripts/ace/mode-julia.js +47 -1
- data/vendor/assets/javascripts/ace/mode-latex.js +1 -1
- data/vendor/assets/javascripts/ace/mode-lean.js +281 -0
- data/vendor/assets/javascripts/ace/mode-less.js +96 -51
- data/vendor/assets/javascripts/ace/mode-liquid.js +10 -7
- data/vendor/assets/javascripts/ace/mode-live_script.js +481 -0
- data/vendor/assets/javascripts/ace/mode-livescript.js +5 -8
- data/vendor/assets/javascripts/ace/mode-logiql.js +49 -50
- data/vendor/assets/javascripts/ace/mode-lsl.js +96 -51
- data/vendor/assets/javascripts/ace/mode-lua.js +3 -3
- data/vendor/assets/javascripts/ace/mode-luapage.js +117 -66
- data/vendor/assets/javascripts/ace/mode-makefile.js +1 -1
- data/vendor/assets/javascripts/ace/mode-markdown.js +134 -67
- data/vendor/assets/javascripts/ace/mode-mask.js +1985 -0
- data/vendor/assets/javascripts/ace/mode-mel.js +96 -51
- data/vendor/assets/javascripts/ace/mode-mips_assembler.js +235 -0
- data/vendor/assets/javascripts/ace/mode-mipsassembler.js +196 -0
- data/vendor/assets/javascripts/ace/mode-nix.js +101 -56
- data/vendor/assets/javascripts/ace/mode-objectivec.js +52 -6
- data/vendor/assets/javascripts/ace/mode-perl.js +47 -1
- data/vendor/assets/javascripts/ace/mode-pgsql.js +1 -1
- data/vendor/assets/javascripts/ace/mode-php.js +139 -85
- data/vendor/assets/javascripts/ace/mode-powershell.js +96 -51
- data/vendor/assets/javascripts/ace/mode-praat.js +47 -1
- data/vendor/assets/javascripts/ace/mode-prolog.js +47 -1
- data/vendor/assets/javascripts/ace/mode-protobuf.js +101 -56
- data/vendor/assets/javascripts/ace/mode-rdoc.js +1 -1
- data/vendor/assets/javascripts/ace/mode-rhtml.js +114 -63
- data/vendor/assets/javascripts/ace/mode-ruby.js +52 -50
- data/vendor/assets/javascripts/ace/mode-rust.js +57 -18
- data/vendor/assets/javascripts/ace/mode-scad.js +96 -51
- data/vendor/assets/javascripts/ace/mode-scala.js +98 -53
- data/vendor/assets/javascripts/ace/mode-scss.js +96 -51
- data/vendor/assets/javascripts/ace/mode-sh.js +97 -52
- data/vendor/assets/javascripts/ace/mode-sjs.js +98 -53
- data/vendor/assets/javascripts/ace/mode-smarty.js +114 -63
- data/vendor/assets/javascripts/ace/mode-soy_template.js +114 -63
- data/vendor/assets/javascripts/ace/mode-stylus.js +1 -1
- data/vendor/assets/javascripts/ace/mode-svg.js +132 -65
- data/vendor/assets/javascripts/ace/mode-tcl.js +47 -1
- data/vendor/assets/javascripts/ace/mode-twig.js +114 -63
- data/vendor/assets/javascripts/ace/mode-typescript.js +98 -53
- data/vendor/assets/javascripts/ace/mode-vala.js +96 -51
- data/vendor/assets/javascripts/ace/mode-velocity.js +114 -63
- data/vendor/assets/javascripts/ace/mode-vhdl.js +21 -21
- data/vendor/assets/javascripts/ace/mode-xml.js +34 -12
- data/vendor/assets/javascripts/ace/mode-xquery.js +98 -51
- data/vendor/assets/javascripts/ace/snippets/abc.js +38 -0
- data/vendor/assets/javascripts/ace/snippets/elixir.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/elm.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/lean.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/live_script.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/mask.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/mips_assembler.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/mipsassembler.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/r.js +1 -1
- data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +1 -1
- data/vendor/assets/javascripts/ace/theme-github.js +7 -1
- data/vendor/assets/javascripts/ace/theme-katzenmilch.js +3 -0
- data/vendor/assets/javascripts/ace/theme-kuroir.js +3 -0
- data/vendor/assets/javascripts/ace/worker-coffee.js +6 -7
- data/vendor/assets/javascripts/ace/worker-css.js +5 -5
- data/vendor/assets/javascripts/ace/worker-html.js +4354 -4354
- data/vendor/assets/javascripts/ace/worker-javascript.js +2435 -1397
- data/vendor/assets/javascripts/ace/worker-json.js +6 -7
- data/vendor/assets/javascripts/ace/worker-lua.js +11 -11
- data/vendor/assets/javascripts/ace/worker-php.js +4 -8
- data/vendor/assets/javascripts/ace/worker-xml.js +3809 -0
- data/vendor/assets/javascripts/ace/worker-xquery.js +38 -47
- metadata +18 -9
- data/vendor/assets/javascripts/ace/ext-options.js +0 -252
- data/vendor/assets/javascripts/ace/mode-html_completions.js +0 -309
- data/vendor/assets/javascripts/ace/mode-luahtml.js +0 -2415
- data/vendor/assets/javascripts/ace/mode-mushcode_high_rules.js +0 -569
- data/vendor/assets/javascripts/ace/mode-tmsnippet.js +0 -200
- data/vendor/assets/javascripts/ace/theme-kr.js +0 -105
@@ -4,19 +4,14 @@ define("ace/mode/rust_highlight_rules",["require","exports","module","ace/lib/oo
|
|
4
4
|
var oop = require("../lib/oop");
|
5
5
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
6
6
|
|
7
|
+
var stringEscape = /\\(?:[nrt0'"]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\})/.source;
|
7
8
|
var RustHighlightRules = function() {
|
8
9
|
|
9
10
|
this.$rules = { start:
|
10
11
|
[ { token: 'variable.other.source.rust',
|
11
12
|
regex: '\'[a-zA-Z_][a-zA-Z0-9_]*[^\\\']' },
|
12
13
|
{ token: 'string.quoted.single.source.rust',
|
13
|
-
regex: '
|
14
|
-
push:
|
15
|
-
[ { token: 'string.quoted.single.source.rust',
|
16
|
-
regex: '\'',
|
17
|
-
next: 'pop' },
|
18
|
-
{ include: '#rust_escaped_character' },
|
19
|
-
{ defaultToken: 'string.quoted.single.source.rust' } ] },
|
14
|
+
regex: "'(?:[^'\\\\]|" + stringEscape + ")'" },
|
20
15
|
{
|
21
16
|
stateName: "bracketedComment",
|
22
17
|
onMatch : function(value, currentState, stack){
|
@@ -52,16 +47,17 @@ var RustHighlightRules = function() {
|
|
52
47
|
[ { token: 'string.quoted.double.source.rust',
|
53
48
|
regex: '"',
|
54
49
|
next: 'pop' },
|
55
|
-
{
|
50
|
+
{ token: 'constant.character.escape.source.rust',
|
51
|
+
regex: stringEscape },
|
56
52
|
{ defaultToken: 'string.quoted.double.source.rust' } ] },
|
57
53
|
{ token: [ 'keyword.source.rust', 'meta.function.source.rust',
|
58
54
|
'entity.name.function.source.rust', 'meta.function.source.rust' ],
|
59
55
|
regex: '\\b(fn)(\\s+)([a-zA-Z_][a-zA-Z0-9_][\\w\\:,+ \\\'<>]*)(\\s*\\()' },
|
60
56
|
{ token: 'support.constant', regex: '\\b[a-zA-Z_][\\w\\d]*::' },
|
61
57
|
{ token: 'keyword.source.rust',
|
62
|
-
regex: '\\b(?:as|assert|break|claim|const|
|
58
|
+
regex: '\\b(?:as|assert|break|claim|const|do|drop|else|extern|fail|for|if|impl|in|let|log|loop|match|mod|module|move|mut|Owned|priv|pub|pure|ref|return|unchecked|unsafe|use|while|mod|Send|static|trait|class|struct|enum|type)\\b' },
|
63
59
|
{ token: 'storage.type.source.rust',
|
64
|
-
regex: '\\b(?:Self|m32|m64|m128|f80|f16|f128|int|uint|float|char|bool|u8|u16|u32|u64|f32|f64|i8|i16|i32|i64|str|option|either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\b' },
|
60
|
+
regex: '\\b(?:Self|m32|m64|m128|f80|f16|f128|int|uint|isize|usize|float|char|bool|u8|u16|u32|u64|f32|f64|i8|i16|i32|i64|str|option|either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\b' },
|
65
61
|
{ token: 'variable.language.source.rust', regex: '\\bself\\b' },
|
66
62
|
{ token: 'keyword.operator',
|
67
63
|
regex: '!|\\$|\\*|\\-\\-|\\-|\\+\\+|\\+|-->|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|&=|\\^=|,|;' },
|
@@ -72,11 +68,11 @@ var RustHighlightRules = function() {
|
|
72
68
|
{ token: 'meta.preprocessor.source.rust',
|
73
69
|
regex: '\\b\\w\\(\\w\\)*!|#\\[[\\w=\\(\\)_]+\\]\\b' },
|
74
70
|
{ token: 'constant.numeric.integer.source.rust',
|
75
|
-
regex: '\\b(?:[0-9][0-9_]*|[0-9][0-9_]*(?:u|u8|u16|u32|u64)|[0-9][0-9_]*(?:i|i8|i16|i32|i64))\\b' },
|
71
|
+
regex: '\\b(?:[0-9][0-9_]*|[0-9][0-9_]*(?:u|us|u8|u16|u32|u64)|[0-9][0-9_]*(?:i|is|i8|i16|i32|i64))\\b' },
|
76
72
|
{ token: 'constant.numeric.hex.source.rust',
|
77
|
-
regex: '\\b(?:0x[a-fA-F0-9_]+|0x[a-fA-F0-9_]+(?:u|u8|u16|u32|u64)|0x[a-fA-F0-9_]+(?:i|i8|i16|i32|i64))\\b' },
|
73
|
+
regex: '\\b(?:0x[a-fA-F0-9_]+|0x[a-fA-F0-9_]+(?:u|us|u8|u16|u32|u64)|0x[a-fA-F0-9_]+(?:i|is|i8|i16|i32|i64))\\b' },
|
78
74
|
{ token: 'constant.numeric.binary.source.rust',
|
79
|
-
regex: '\\b(?:0b[01_]+|0b[01_]+(?:u|u8|u16|u32|u64)|0b[01_]+(?:i|i8|i16|i32|i64))\\b' },
|
75
|
+
regex: '\\b(?:0b[01_]+|0b[01_]+(?:u|us|u8|u16|u32|u64)|0b[01_]+(?:i|is|i8|i16|i32|i64))\\b' },
|
80
76
|
{ token: 'constant.numeric.float.source.rust',
|
81
77
|
regex: '[0-9][0-9_]*(?:f32|f64|f)|[0-9][0-9_]*[eE][+-]=[0-9_]+|[0-9][0-9_]*[eE][+-]=[0-9_]+(?:f32|f64|f)|[0-9][0-9_]*\\.[0-9_]+|[0-9][0-9_]*\\.[0-9_]+(?:f32|f64|f)|[0-9][0-9_]*\\.[0-9_]+%[eE][+-]=[0-9_]+|[0-9][0-9_]*\\.[0-9_]+%[eE][+-]=[0-9_]+(?:f32|f64|f)' },
|
82
78
|
{ token: 'comment.line.documentation.source.rust',
|
@@ -103,10 +99,7 @@ var RustHighlightRules = function() {
|
|
103
99
|
{ token: 'comment.end.block.source.rust',
|
104
100
|
regex: '\\*/',
|
105
101
|
next: 'pop' },
|
106
|
-
{ defaultToken: 'comment.block.source.rust' } ] } ]
|
107
|
-
'#rust_escaped_character':
|
108
|
-
[ { token: 'constant.character.escape.source.rust',
|
109
|
-
regex: '\\\\(?:x[\\da-fA-F]{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)' } ] }
|
102
|
+
{ defaultToken: 'comment.block.source.rust' } ] } ] }
|
110
103
|
|
111
104
|
this.normalizeRules();
|
112
105
|
};
|
@@ -143,12 +136,35 @@ var FoldMode = exports.FoldMode = function(commentRegex) {
|
|
143
136
|
oop.inherits(FoldMode, BaseFoldMode);
|
144
137
|
|
145
138
|
(function() {
|
146
|
-
|
139
|
+
|
147
140
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
148
141
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
142
|
+
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
|
143
|
+
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
144
|
+
this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
|
145
|
+
this._getFoldWidgetBase = this.getFoldWidget;
|
146
|
+
this.getFoldWidget = function(session, foldStyle, row) {
|
147
|
+
var line = session.getLine(row);
|
148
|
+
|
149
|
+
if (this.singleLineBlockCommentRe.test(line)) {
|
150
|
+
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
151
|
+
return "";
|
152
|
+
}
|
153
|
+
|
154
|
+
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
155
|
+
|
156
|
+
if (!fw && this.startRegionRe.test(line))
|
157
|
+
return "start"; // lineCommentRegionStart
|
158
|
+
|
159
|
+
return fw;
|
160
|
+
};
|
149
161
|
|
150
162
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
151
163
|
var line = session.getLine(row);
|
164
|
+
|
165
|
+
if (this.startRegionRe.test(line))
|
166
|
+
return this.getCommentRegionBlock(session, line, row);
|
167
|
+
|
152
168
|
var match = line.match(this.foldingStartMarker);
|
153
169
|
if (match) {
|
154
170
|
var i = match.index;
|
@@ -213,6 +229,29 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|
213
229
|
|
214
230
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
215
231
|
};
|
232
|
+
|
233
|
+
this.getCommentRegionBlock = function(session, line, row) {
|
234
|
+
var startColumn = line.search(/\s*$/);
|
235
|
+
var maxRow = session.getLength();
|
236
|
+
var startRow = row;
|
237
|
+
|
238
|
+
var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
|
239
|
+
var depth = 1;
|
240
|
+
while (++row < maxRow) {
|
241
|
+
line = session.getLine(row);
|
242
|
+
var m = re.exec(line);
|
243
|
+
if (!m) continue;
|
244
|
+
if (m[1]) depth--;
|
245
|
+
else depth++;
|
246
|
+
|
247
|
+
if (!depth) break;
|
248
|
+
}
|
249
|
+
|
250
|
+
var endRow = row;
|
251
|
+
if (endRow > startRow) {
|
252
|
+
return new Range(startRow, startColumn, endRow, line.length);
|
253
|
+
}
|
254
|
+
};
|
216
255
|
|
217
256
|
}).call(FoldMode.prototype);
|
218
257
|
|
@@ -233,6 +233,19 @@ var initContext = function(editor) {
|
|
233
233
|
};
|
234
234
|
};
|
235
235
|
|
236
|
+
var getWrapped = function(selection, selected, opening, closing) {
|
237
|
+
var rowDiff = selection.end.row - selection.start.row;
|
238
|
+
return {
|
239
|
+
text: opening + selected + closing,
|
240
|
+
selection: [
|
241
|
+
0,
|
242
|
+
selection.start.column + 1,
|
243
|
+
rowDiff,
|
244
|
+
selection.end.column + (rowDiff ? 0 : 1)
|
245
|
+
]
|
246
|
+
};
|
247
|
+
};
|
248
|
+
|
236
249
|
var CstyleBehaviour = function() {
|
237
250
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
238
251
|
var cursor = editor.getCursorPosition();
|
@@ -242,10 +255,7 @@ var CstyleBehaviour = function() {
|
|
242
255
|
var selection = editor.getSelectionRange();
|
243
256
|
var selected = session.doc.getTextRange(selection);
|
244
257
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
245
|
-
return {
|
246
|
-
text: '{' + selected + '}',
|
247
|
-
selection: false
|
248
|
-
};
|
258
|
+
return getWrapped(selection, selected, '{', '}');
|
249
259
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
250
260
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
251
261
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
@@ -325,10 +335,7 @@ var CstyleBehaviour = function() {
|
|
325
335
|
var selection = editor.getSelectionRange();
|
326
336
|
var selected = session.doc.getTextRange(selection);
|
327
337
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
328
|
-
return
|
329
|
-
text: '(' + selected + ')',
|
330
|
-
selection: false
|
331
|
-
};
|
338
|
+
return getWrapped(selection, selected, '(', ')');
|
332
339
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
333
340
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
334
341
|
return {
|
@@ -373,10 +380,7 @@ var CstyleBehaviour = function() {
|
|
373
380
|
var selection = editor.getSelectionRange();
|
374
381
|
var selected = session.doc.getTextRange(selection);
|
375
382
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
376
|
-
return
|
377
|
-
text: '[' + selected + ']',
|
378
|
-
selection: false
|
379
|
-
};
|
383
|
+
return getWrapped(selection, selected, '[', ']');
|
380
384
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
381
385
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
382
386
|
return {
|
@@ -422,49 +426,44 @@ var CstyleBehaviour = function() {
|
|
422
426
|
var selection = editor.getSelectionRange();
|
423
427
|
var selected = session.doc.getTextRange(selection);
|
424
428
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
425
|
-
return
|
426
|
-
|
427
|
-
selection: false
|
428
|
-
};
|
429
|
-
} else {
|
429
|
+
return getWrapped(selection, selected, quote, quote);
|
430
|
+
} else if (!selected) {
|
430
431
|
var cursor = editor.getCursorPosition();
|
431
432
|
var line = session.doc.getLine(cursor.row);
|
432
433
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
433
|
-
|
434
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
435
|
+
|
436
|
+
var token = session.getTokenAt(cursor.row, cursor.column);
|
437
|
+
var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
|
438
|
+
if (leftChar == "\\" && token && /escape/.test(token.type))
|
434
439
|
return null;
|
440
|
+
|
441
|
+
var stringBefore = token && /string/.test(token.type);
|
442
|
+
var stringAfter = !rightToken || /string/.test(rightToken.type);
|
443
|
+
|
444
|
+
var pair;
|
445
|
+
if (rightChar == quote) {
|
446
|
+
pair = stringBefore !== stringAfter;
|
447
|
+
} else {
|
448
|
+
if (stringBefore && !stringAfter)
|
449
|
+
return null; // wrap string with different quote
|
450
|
+
if (stringBefore && stringAfter)
|
451
|
+
return null; // do not pair quotes inside strings
|
452
|
+
var wordRe = session.$mode.tokenRe;
|
453
|
+
wordRe.lastIndex = 0;
|
454
|
+
var isWordBefore = wordRe.test(leftChar);
|
455
|
+
wordRe.lastIndex = 0;
|
456
|
+
var isWordAfter = wordRe.test(leftChar);
|
457
|
+
if (isWordBefore || isWordAfter)
|
458
|
+
return null; // before or after alphanumeric
|
459
|
+
if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
|
460
|
+
return null; // there is rightChar and it isn't closing
|
461
|
+
pair = true;
|
435
462
|
}
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
for (var x = 0; x < tokens.length; x++) {
|
441
|
-
token = tokens[x];
|
442
|
-
if (token.type == "string") {
|
443
|
-
quotepos = -1;
|
444
|
-
} else if (quotepos < 0) {
|
445
|
-
quotepos = token.value.indexOf(quote);
|
446
|
-
}
|
447
|
-
if ((token.value.length + col) > selection.start.column) {
|
448
|
-
break;
|
449
|
-
}
|
450
|
-
col += tokens[x].value.length;
|
451
|
-
}
|
452
|
-
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
453
|
-
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
454
|
-
return;
|
455
|
-
return {
|
456
|
-
text: quote + quote,
|
457
|
-
selection: [1,1]
|
458
|
-
};
|
459
|
-
} else if (token && token.type === "string") {
|
460
|
-
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
461
|
-
if (rightChar == quote) {
|
462
|
-
return {
|
463
|
-
text: '',
|
464
|
-
selection: [1, 1]
|
465
|
-
};
|
466
|
-
}
|
467
|
-
}
|
463
|
+
return {
|
464
|
+
text: pair ? quote + quote : "",
|
465
|
+
selection: [1,1]
|
466
|
+
};
|
468
467
|
}
|
469
468
|
}
|
470
469
|
});
|
@@ -576,12 +575,35 @@ var FoldMode = exports.FoldMode = function(commentRegex) {
|
|
576
575
|
oop.inherits(FoldMode, BaseFoldMode);
|
577
576
|
|
578
577
|
(function() {
|
579
|
-
|
578
|
+
|
580
579
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
581
580
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
581
|
+
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
|
582
|
+
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
583
|
+
this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
|
584
|
+
this._getFoldWidgetBase = this.getFoldWidget;
|
585
|
+
this.getFoldWidget = function(session, foldStyle, row) {
|
586
|
+
var line = session.getLine(row);
|
587
|
+
|
588
|
+
if (this.singleLineBlockCommentRe.test(line)) {
|
589
|
+
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
590
|
+
return "";
|
591
|
+
}
|
592
|
+
|
593
|
+
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
594
|
+
|
595
|
+
if (!fw && this.startRegionRe.test(line))
|
596
|
+
return "start"; // lineCommentRegionStart
|
597
|
+
|
598
|
+
return fw;
|
599
|
+
};
|
582
600
|
|
583
601
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
584
602
|
var line = session.getLine(row);
|
603
|
+
|
604
|
+
if (this.startRegionRe.test(line))
|
605
|
+
return this.getCommentRegionBlock(session, line, row);
|
606
|
+
|
585
607
|
var match = line.match(this.foldingStartMarker);
|
586
608
|
if (match) {
|
587
609
|
var i = match.index;
|
@@ -646,6 +668,29 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|
646
668
|
|
647
669
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
648
670
|
};
|
671
|
+
|
672
|
+
this.getCommentRegionBlock = function(session, line, row) {
|
673
|
+
var startColumn = line.search(/\s*$/);
|
674
|
+
var maxRow = session.getLength();
|
675
|
+
var startRow = row;
|
676
|
+
|
677
|
+
var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
|
678
|
+
var depth = 1;
|
679
|
+
while (++row < maxRow) {
|
680
|
+
line = session.getLine(row);
|
681
|
+
var m = re.exec(line);
|
682
|
+
if (!m) continue;
|
683
|
+
if (m[1]) depth--;
|
684
|
+
else depth++;
|
685
|
+
|
686
|
+
if (!depth) break;
|
687
|
+
}
|
688
|
+
|
689
|
+
var endRow = row;
|
690
|
+
if (endRow > startRow) {
|
691
|
+
return new Range(startRow, startColumn, endRow, line.length);
|
692
|
+
}
|
693
|
+
};
|
649
694
|
|
650
695
|
}).call(FoldMode.prototype);
|
651
696
|
|
@@ -176,7 +176,7 @@ var JavaScriptHighlightRules = function(options) {
|
|
176
176
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
177
177
|
}, {
|
178
178
|
token : ["punctuation.operator", "support.function.dom"],
|
179
|
-
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
179
|
+
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
180
180
|
}, {
|
181
181
|
token : ["punctuation.operator", "support.constant"],
|
182
182
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
@@ -475,6 +475,19 @@ var initContext = function(editor) {
|
|
475
475
|
};
|
476
476
|
};
|
477
477
|
|
478
|
+
var getWrapped = function(selection, selected, opening, closing) {
|
479
|
+
var rowDiff = selection.end.row - selection.start.row;
|
480
|
+
return {
|
481
|
+
text: opening + selected + closing,
|
482
|
+
selection: [
|
483
|
+
0,
|
484
|
+
selection.start.column + 1,
|
485
|
+
rowDiff,
|
486
|
+
selection.end.column + (rowDiff ? 0 : 1)
|
487
|
+
]
|
488
|
+
};
|
489
|
+
};
|
490
|
+
|
478
491
|
var CstyleBehaviour = function() {
|
479
492
|
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
480
493
|
var cursor = editor.getCursorPosition();
|
@@ -484,10 +497,7 @@ var CstyleBehaviour = function() {
|
|
484
497
|
var selection = editor.getSelectionRange();
|
485
498
|
var selected = session.doc.getTextRange(selection);
|
486
499
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
487
|
-
return {
|
488
|
-
text: '{' + selected + '}',
|
489
|
-
selection: false
|
490
|
-
};
|
500
|
+
return getWrapped(selection, selected, '{', '}');
|
491
501
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
492
502
|
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
493
503
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
@@ -567,10 +577,7 @@ var CstyleBehaviour = function() {
|
|
567
577
|
var selection = editor.getSelectionRange();
|
568
578
|
var selected = session.doc.getTextRange(selection);
|
569
579
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
570
|
-
return
|
571
|
-
text: '(' + selected + ')',
|
572
|
-
selection: false
|
573
|
-
};
|
580
|
+
return getWrapped(selection, selected, '(', ')');
|
574
581
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
575
582
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
576
583
|
return {
|
@@ -615,10 +622,7 @@ var CstyleBehaviour = function() {
|
|
615
622
|
var selection = editor.getSelectionRange();
|
616
623
|
var selected = session.doc.getTextRange(selection);
|
617
624
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
618
|
-
return
|
619
|
-
text: '[' + selected + ']',
|
620
|
-
selection: false
|
621
|
-
};
|
625
|
+
return getWrapped(selection, selected, '[', ']');
|
622
626
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
623
627
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
624
628
|
return {
|
@@ -664,49 +668,44 @@ var CstyleBehaviour = function() {
|
|
664
668
|
var selection = editor.getSelectionRange();
|
665
669
|
var selected = session.doc.getTextRange(selection);
|
666
670
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
667
|
-
return
|
668
|
-
|
669
|
-
selection: false
|
670
|
-
};
|
671
|
-
} else {
|
671
|
+
return getWrapped(selection, selected, quote, quote);
|
672
|
+
} else if (!selected) {
|
672
673
|
var cursor = editor.getCursorPosition();
|
673
674
|
var line = session.doc.getLine(cursor.row);
|
674
675
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
675
|
-
|
676
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
677
|
+
|
678
|
+
var token = session.getTokenAt(cursor.row, cursor.column);
|
679
|
+
var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
|
680
|
+
if (leftChar == "\\" && token && /escape/.test(token.type))
|
676
681
|
return null;
|
682
|
+
|
683
|
+
var stringBefore = token && /string/.test(token.type);
|
684
|
+
var stringAfter = !rightToken || /string/.test(rightToken.type);
|
685
|
+
|
686
|
+
var pair;
|
687
|
+
if (rightChar == quote) {
|
688
|
+
pair = stringBefore !== stringAfter;
|
689
|
+
} else {
|
690
|
+
if (stringBefore && !stringAfter)
|
691
|
+
return null; // wrap string with different quote
|
692
|
+
if (stringBefore && stringAfter)
|
693
|
+
return null; // do not pair quotes inside strings
|
694
|
+
var wordRe = session.$mode.tokenRe;
|
695
|
+
wordRe.lastIndex = 0;
|
696
|
+
var isWordBefore = wordRe.test(leftChar);
|
697
|
+
wordRe.lastIndex = 0;
|
698
|
+
var isWordAfter = wordRe.test(leftChar);
|
699
|
+
if (isWordBefore || isWordAfter)
|
700
|
+
return null; // before or after alphanumeric
|
701
|
+
if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
|
702
|
+
return null; // there is rightChar and it isn't closing
|
703
|
+
pair = true;
|
677
704
|
}
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
for (var x = 0; x < tokens.length; x++) {
|
683
|
-
token = tokens[x];
|
684
|
-
if (token.type == "string") {
|
685
|
-
quotepos = -1;
|
686
|
-
} else if (quotepos < 0) {
|
687
|
-
quotepos = token.value.indexOf(quote);
|
688
|
-
}
|
689
|
-
if ((token.value.length + col) > selection.start.column) {
|
690
|
-
break;
|
691
|
-
}
|
692
|
-
col += tokens[x].value.length;
|
693
|
-
}
|
694
|
-
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
695
|
-
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
696
|
-
return;
|
697
|
-
return {
|
698
|
-
text: quote + quote,
|
699
|
-
selection: [1,1]
|
700
|
-
};
|
701
|
-
} else if (token && token.type === "string") {
|
702
|
-
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
703
|
-
if (rightChar == quote) {
|
704
|
-
return {
|
705
|
-
text: '',
|
706
|
-
selection: [1, 1]
|
707
|
-
};
|
708
|
-
}
|
709
|
-
}
|
705
|
+
return {
|
706
|
+
text: pair ? quote + quote : "",
|
707
|
+
selection: [1,1]
|
708
|
+
};
|
710
709
|
}
|
711
710
|
}
|
712
711
|
});
|
@@ -818,12 +817,35 @@ var FoldMode = exports.FoldMode = function(commentRegex) {
|
|
818
817
|
oop.inherits(FoldMode, BaseFoldMode);
|
819
818
|
|
820
819
|
(function() {
|
821
|
-
|
820
|
+
|
822
821
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
823
822
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
823
|
+
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
|
824
|
+
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
825
|
+
this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
|
826
|
+
this._getFoldWidgetBase = this.getFoldWidget;
|
827
|
+
this.getFoldWidget = function(session, foldStyle, row) {
|
828
|
+
var line = session.getLine(row);
|
829
|
+
|
830
|
+
if (this.singleLineBlockCommentRe.test(line)) {
|
831
|
+
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
832
|
+
return "";
|
833
|
+
}
|
834
|
+
|
835
|
+
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
836
|
+
|
837
|
+
if (!fw && this.startRegionRe.test(line))
|
838
|
+
return "start"; // lineCommentRegionStart
|
839
|
+
|
840
|
+
return fw;
|
841
|
+
};
|
824
842
|
|
825
843
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
826
844
|
var line = session.getLine(row);
|
845
|
+
|
846
|
+
if (this.startRegionRe.test(line))
|
847
|
+
return this.getCommentRegionBlock(session, line, row);
|
848
|
+
|
827
849
|
var match = line.match(this.foldingStartMarker);
|
828
850
|
if (match) {
|
829
851
|
var i = match.index;
|
@@ -888,6 +910,29 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|
888
910
|
|
889
911
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
890
912
|
};
|
913
|
+
|
914
|
+
this.getCommentRegionBlock = function(session, line, row) {
|
915
|
+
var startColumn = line.search(/\s*$/);
|
916
|
+
var maxRow = session.getLength();
|
917
|
+
var startRow = row;
|
918
|
+
|
919
|
+
var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
|
920
|
+
var depth = 1;
|
921
|
+
while (++row < maxRow) {
|
922
|
+
line = session.getLine(row);
|
923
|
+
var m = re.exec(line);
|
924
|
+
if (!m) continue;
|
925
|
+
if (m[1]) depth--;
|
926
|
+
else depth++;
|
927
|
+
|
928
|
+
if (!depth) break;
|
929
|
+
}
|
930
|
+
|
931
|
+
var endRow = row;
|
932
|
+
if (endRow > startRow) {
|
933
|
+
return new Range(startRow, startColumn, endRow, line.length);
|
934
|
+
}
|
935
|
+
};
|
891
936
|
|
892
937
|
}).call(FoldMode.prototype);
|
893
938
|
|
@@ -963,7 +1008,7 @@ oop.inherits(Mode, TextMode);
|
|
963
1008
|
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
|
964
1009
|
worker.attachToDocument(session.getDocument());
|
965
1010
|
|
966
|
-
worker.on("
|
1011
|
+
worker.on("annotate", function(results) {
|
967
1012
|
session.setAnnotations(results.data);
|
968
1013
|
});
|
969
1014
|
|