ace-rails-ap 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +1 -1
- data/lib/ace/rails/version.rb +1 -1
- data/vendor/assets/javascripts/ace/ace.js +6911 -5290
- data/vendor/assets/javascripts/ace/ext-chromevox.js +537 -0
- data/vendor/assets/javascripts/ace/ext-elastic_tabstops_lite.js +301 -0
- data/vendor/assets/javascripts/ace/ext-emmet.js +1109 -0
- data/vendor/assets/javascripts/ace/ext-keybinding_menu.js +207 -0
- data/vendor/assets/javascripts/ace/ext-language_tools.js +1665 -0
- data/vendor/assets/javascripts/ace/ext-modelist.js +168 -0
- data/vendor/assets/javascripts/ace/ext-old_ie.js +500 -0
- data/vendor/assets/javascripts/ace/ext-options.js +252 -0
- data/vendor/assets/javascripts/ace/ext-searchbox.js +421 -0
- data/vendor/assets/javascripts/ace/ext-settings_menu.js +632 -0
- data/vendor/assets/javascripts/ace/ext-spellcheck.js +68 -0
- data/vendor/assets/javascripts/ace/ext-split.js +271 -0
- data/vendor/assets/javascripts/ace/ext-static_highlight.js +178 -0
- data/vendor/assets/javascripts/ace/ext-statusbar.js +47 -0
- data/vendor/assets/javascripts/ace/ext-textarea.js +478 -0
- data/vendor/assets/javascripts/ace/ext-themelist.js +86 -0
- data/vendor/assets/javascripts/ace/ext-whitespace.js +206 -0
- data/vendor/assets/javascripts/ace/keybinding-emacs.js +822 -131
- data/vendor/assets/javascripts/ace/keybinding-vim.js +382 -258
- data/vendor/assets/javascripts/ace/mode-abap.js +261 -0
- data/vendor/assets/javascripts/ace/mode-actionscript.js +257 -0
- data/vendor/assets/javascripts/ace/mode-ada.js +118 -0
- data/vendor/assets/javascripts/ace/mode-asciidoc.js +373 -0
- data/vendor/assets/javascripts/ace/mode-assembly_x86.js +217 -0
- data/vendor/assets/javascripts/ace/mode-autohotkey.js +225 -0
- data/vendor/assets/javascripts/ace/mode-batchfile.js +213 -0
- data/vendor/assets/javascripts/ace/mode-c9search.js +144 -124
- data/vendor/assets/javascripts/ace/mode-c_cpp.js +296 -254
- data/vendor/assets/javascripts/ace/mode-clojure.js +113 -177
- data/vendor/assets/javascripts/ace/mode-cobol.js +125 -0
- data/vendor/assets/javascripts/ace/mode-coffee.js +152 -235
- data/vendor/assets/javascripts/ace/mode-coldfusion.js +823 -835
- data/vendor/assets/javascripts/ace/mode-csharp.js +325 -187
- data/vendor/assets/javascripts/ace/mode-css.js +583 -297
- data/vendor/assets/javascripts/ace/mode-curly.js +2423 -0
- data/vendor/assets/javascripts/ace/mode-d.js +492 -0
- data/vendor/assets/javascripts/ace/mode-dart.js +993 -0
- data/vendor/assets/javascripts/ace/mode-diff.js +124 -204
- data/vendor/assets/javascripts/ace/mode-django.js +2448 -0
- data/vendor/assets/javascripts/ace/mode-dot.js +361 -0
- data/vendor/assets/javascripts/ace/mode-ejs.js +2817 -0
- data/vendor/assets/javascripts/ace/mode-erlang.js +987 -0
- data/vendor/assets/javascripts/ace/mode-forth.js +280 -0
- data/vendor/assets/javascripts/ace/mode-ftl.js +1061 -0
- data/vendor/assets/javascripts/ace/mode-glsl.js +313 -275
- data/vendor/assets/javascripts/ace/mode-golang.js +268 -275
- data/vendor/assets/javascripts/ace/mode-groovy.js +347 -492
- data/vendor/assets/javascripts/ace/mode-haml.js +498 -0
- data/vendor/assets/javascripts/ace/mode-handlebars.js +2433 -0
- data/vendor/assets/javascripts/ace/mode-haskell.js +362 -0
- data/vendor/assets/javascripts/ace/mode-haxe.js +226 -202
- data/vendor/assets/javascripts/ace/mode-html.js +1099 -802
- data/vendor/assets/javascripts/ace/mode-html_completions.js +309 -0
- data/vendor/assets/javascripts/ace/mode-html_ruby.js +2822 -0
- data/vendor/assets/javascripts/ace/mode-ini.js +185 -0
- data/vendor/assets/javascripts/ace/mode-jack.js +653 -0
- data/vendor/assets/javascripts/ace/mode-jade.js +2081 -0
- data/vendor/assets/javascripts/ace/mode-java.js +339 -488
- data/vendor/assets/javascripts/ace/mode-javascript.js +342 -478
- data/vendor/assets/javascripts/ace/mode-json.js +215 -178
- data/vendor/assets/javascripts/ace/mode-jsoniq.js +2761 -0
- data/vendor/assets/javascripts/ace/mode-jsp.js +1553 -0
- data/vendor/assets/javascripts/ace/mode-jsx.js +325 -289
- data/vendor/assets/javascripts/ace/mode-julia.js +286 -0
- data/vendor/assets/javascripts/ace/mode-latex.js +141 -46
- data/vendor/assets/javascripts/ace/mode-less.js +493 -151
- data/vendor/assets/javascripts/ace/mode-liquid.js +594 -656
- data/vendor/assets/javascripts/ace/mode-lisp.js +137 -0
- data/vendor/assets/javascripts/ace/mode-livescript.js +288 -0
- data/vendor/assets/javascripts/ace/mode-logiql.js +669 -0
- data/vendor/assets/javascripts/ace/mode-lsl.js +890 -0
- data/vendor/assets/javascripts/ace/mode-lua.js +274 -368
- data/vendor/assets/javascripts/ace/mode-luapage.js +1331 -1107
- data/vendor/assets/javascripts/ace/mode-lucene.js +64 -0
- data/vendor/assets/javascripts/ace/mode-makefile.js +332 -0
- data/vendor/assets/javascripts/ace/mode-markdown.js +1303 -948
- data/vendor/assets/javascripts/ace/mode-matlab.js +230 -0
- data/vendor/assets/javascripts/ace/mode-mushcode.js +705 -0
- data/vendor/assets/javascripts/ace/mode-mushcode_high_rules.js +569 -0
- data/vendor/assets/javascripts/ace/mode-mysql.js +185 -0
- data/vendor/assets/javascripts/ace/mode-nix.js +935 -0
- data/vendor/assets/javascripts/ace/mode-objectivec.js +699 -0
- data/vendor/assets/javascripts/ace/mode-ocaml.js +44 -63
- data/vendor/assets/javascripts/ace/mode-pascal.js +233 -0
- data/vendor/assets/javascripts/ace/mode-perl.js +116 -189
- data/vendor/assets/javascripts/ace/mode-pgsql.js +886 -500
- data/vendor/assets/javascripts/ace/mode-php.js +1158 -380
- data/vendor/assets/javascripts/ace/mode-plain_text.js +56 -0
- data/vendor/assets/javascripts/ace/mode-powershell.js +222 -167
- data/vendor/assets/javascripts/ace/mode-prolog.js +354 -0
- data/vendor/assets/javascripts/ace/mode-properties.js +100 -0
- data/vendor/assets/javascripts/ace/mode-protobuf.js +885 -0
- data/vendor/assets/javascripts/ace/mode-python.js +99 -201
- data/vendor/assets/javascripts/ace/mode-r.js +337 -0
- data/vendor/assets/javascripts/ace/mode-rdoc.js +210 -0
- data/vendor/assets/javascripts/ace/mode-rhtml.js +2663 -0
- data/vendor/assets/javascripts/ace/mode-ruby.js +262 -136
- data/vendor/assets/javascripts/ace/mode-rust.js +245 -0
- data/vendor/assets/javascripts/ace/mode-sass.js +443 -0
- data/vendor/assets/javascripts/ace/mode-scad.js +225 -240
- data/vendor/assets/javascripts/ace/mode-scala.js +340 -494
- data/vendor/assets/javascripts/ace/mode-scheme.js +143 -0
- data/vendor/assets/javascripts/ace/mode-scss.js +499 -157
- data/vendor/assets/javascripts/ace/mode-sh.js +180 -110
- data/vendor/assets/javascripts/ace/mode-sjs.js +1154 -0
- data/vendor/assets/javascripts/ace/mode-snippets.js +198 -0
- data/vendor/assets/javascripts/ace/mode-soy_template.js +2707 -0
- data/vendor/assets/javascripts/ace/mode-space.js +160 -0
- data/vendor/assets/javascripts/ace/mode-sql.js +48 -69
- data/vendor/assets/javascripts/ace/mode-stylus.js +447 -0
- data/vendor/assets/javascripts/ace/mode-svg.js +552 -605
- data/vendor/assets/javascripts/ace/mode-tcl.js +139 -98
- data/vendor/assets/javascripts/ace/mode-tex.js +187 -0
- data/vendor/assets/javascripts/ace/mode-textile.js +29 -40
- data/vendor/assets/javascripts/ace/mode-tmsnippet.js +200 -0
- data/vendor/assets/javascripts/ace/mode-toml.js +177 -0
- data/vendor/assets/javascripts/ace/mode-twig.js +2228 -0
- data/vendor/assets/javascripts/ace/mode-typescript.js +1018 -0
- data/vendor/assets/javascripts/ace/mode-vbscript.js +250 -0
- data/vendor/assets/javascripts/ace/mode-velocity.js +1621 -0
- data/vendor/assets/javascripts/ace/mode-verilog.js +127 -0
- data/vendor/assets/javascripts/ace/mode-vhdl.js +139 -0
- data/vendor/assets/javascripts/ace/mode-xml.js +350 -242
- data/vendor/assets/javascripts/ace/mode-xquery.js +2490 -300
- data/vendor/assets/javascripts/ace/mode-yaml.js +146 -45
- data/vendor/assets/javascripts/ace/theme-ambiance.js +202 -0
- data/vendor/assets/javascripts/ace/theme-chaos.js +179 -0
- data/vendor/assets/javascripts/ace/theme-chrome.js +97 -153
- data/vendor/assets/javascripts/ace/theme-clouds.js +78 -119
- data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +79 -120
- data/vendor/assets/javascripts/ace/theme-cobalt.js +89 -140
- data/vendor/assets/javascripts/ace/theme-crimson_editor.js +93 -145
- data/vendor/assets/javascripts/ace/theme-dawn.js +84 -143
- data/vendor/assets/javascripts/ace/theme-dreamweaver.js +99 -162
- data/vendor/assets/javascripts/ace/theme-eclipse.js +78 -111
- data/vendor/assets/javascripts/ace/theme-github.js +70 -121
- data/vendor/assets/javascripts/ace/theme-idle_fingers.js +75 -134
- data/vendor/assets/javascripts/ace/theme-kr.js +135 -0
- data/vendor/assets/javascripts/ace/theme-merbivore.js +80 -143
- data/vendor/assets/javascripts/ace/theme-merbivore_soft.js +81 -149
- data/vendor/assets/javascripts/ace/theme-mono_industrial.js +87 -146
- data/vendor/assets/javascripts/ace/theme-monokai.js +88 -146
- data/vendor/assets/javascripts/ace/theme-pastel_on_dark.js +82 -142
- data/vendor/assets/javascripts/ace/theme-solarized_dark.js +83 -144
- data/vendor/assets/javascripts/ace/theme-solarized_light.js +76 -133
- data/vendor/assets/javascripts/ace/theme-terminal.js +145 -0
- data/vendor/assets/javascripts/ace/theme-textmate.js +101 -158
- data/vendor/assets/javascripts/ace/theme-tomorrow.js +89 -163
- data/vendor/assets/javascripts/ace/theme-tomorrow_night.js +89 -163
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue.js +89 -165
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +101 -162
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties.js +90 -160
- data/vendor/assets/javascripts/ace/theme-twilight.js +87 -158
- data/vendor/assets/javascripts/ace/theme-vibrant_ink.js +75 -140
- data/vendor/assets/javascripts/ace/theme-xcode.js +120 -0
- data/vendor/assets/javascripts/ace/worker-coffee.js +3049 -2665
- data/vendor/assets/javascripts/ace/worker-css.js +1779 -4376
- data/vendor/assets/javascripts/ace/worker-javascript.js +8701 -9008
- data/vendor/assets/javascripts/ace/worker-json.js +709 -1340
- data/vendor/assets/javascripts/ace/worker-lua.js +3525 -0
- data/vendor/assets/javascripts/ace/worker-php.js +6893 -0
- data/vendor/assets/javascripts/ace/worker-xquery.js +19924 -64507
- metadata +100 -17
@@ -10,7 +10,7 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
|
10
10
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
11
11
|
|
12
12
|
function Mode() {
|
13
|
-
this
|
13
|
+
this.HighlightRules = JsxHighlightRules;
|
14
14
|
this.$outdent = new MatchingBraceOutdent();
|
15
15
|
this.$behaviour = new CstyleBehaviour();
|
16
16
|
this.foldingRules = new CStyleFoldMode();
|
@@ -19,159 +19,159 @@ oop.inherits(Mode, TextMode);
|
|
19
19
|
|
20
20
|
(function() {
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
this.lineCommentStart = "//";
|
23
|
+
this.blockComment = {start: "/*", end: "*/"};
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
this.getNextLineIndent = function(state, line, tab) {
|
26
|
+
var indent = this.$getIndent(line);
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
}
|
28
|
+
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
29
|
+
var tokens = tokenizedLine.tokens;
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
indent += tab;
|
36
|
-
}
|
37
|
-
}
|
31
|
+
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
32
|
+
return indent;
|
33
|
+
}
|
38
34
|
|
39
|
-
|
40
|
-
|
35
|
+
if (state == "start") {
|
36
|
+
var match = line.match(/^.*[\{\(\[]\s*$/);
|
37
|
+
if (match) {
|
38
|
+
indent += tab;
|
39
|
+
}
|
40
|
+
}
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
};
|
42
|
+
return indent;
|
43
|
+
};
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
this.checkOutdent = function(state, line, input) {
|
46
|
+
return this.$outdent.checkOutdent(line, input);
|
47
|
+
};
|
49
48
|
|
49
|
+
this.autoOutdent = function(state, doc, row) {
|
50
|
+
this.$outdent.autoOutdent(doc, row);
|
51
|
+
};
|
52
|
+
|
53
|
+
this.$id = "ace/mode/jsx";
|
50
54
|
}).call(Mode.prototype);
|
51
55
|
|
52
56
|
exports.Mode = Mode;
|
53
57
|
});
|
54
58
|
define('ace/mode/jsx_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
+
var oop = require("../lib/oop");
|
60
|
+
var lang = require("../lib/lang");
|
61
|
+
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
62
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
63
|
+
|
64
|
+
var JsxHighlightRules = function() {
|
65
|
+
var keywords = lang.arrayToMap(
|
66
|
+
("break|do|instanceof|typeof|case|else|new|var|catch|finally|return|void|continue|for|switch|default|while|function|this|" +
|
67
|
+
"if|throw|" +
|
68
|
+
"delete|in|try|" +
|
69
|
+
"class|extends|super|import|from|into|implements|interface|static|mixin|override|abstract|final|" +
|
70
|
+
"number|int|string|boolean|variant|" +
|
71
|
+
"log|assert").split("|")
|
72
|
+
);
|
59
73
|
|
60
|
-
var
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
74
|
+
var buildinConstants = lang.arrayToMap(
|
75
|
+
("null|true|false|NaN|Infinity|__FILE__|__LINE__|undefined").split("|")
|
76
|
+
);
|
77
|
+
|
78
|
+
var reserved = lang.arrayToMap(
|
79
|
+
("debugger|with|" +
|
80
|
+
"const|export|" +
|
81
|
+
"let|private|public|yield|protected|" +
|
82
|
+
"extern|native|as|operator|__fake__|__readonly__").split("|")
|
83
|
+
);
|
84
|
+
|
85
|
+
var identifierRe = "[a-zA-Z_][a-zA-Z0-9_]*\\b";
|
86
|
+
|
87
|
+
this.$rules = {
|
88
|
+
"start" : [
|
89
|
+
{
|
90
|
+
token : "comment",
|
91
|
+
regex : "\\/\\/.*$"
|
92
|
+
},
|
93
|
+
DocCommentHighlightRules.getStartRule("doc-start"),
|
94
|
+
{
|
95
|
+
token : "comment", // multi line comment
|
96
|
+
regex : "\\/\\*",
|
97
|
+
next : "comment"
|
98
|
+
}, {
|
99
|
+
token : "string.regexp",
|
100
|
+
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
|
101
|
+
}, {
|
102
|
+
token : "string", // single line
|
103
|
+
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
104
|
+
}, {
|
105
|
+
token : "string", // single line
|
106
|
+
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
107
|
+
}, {
|
108
|
+
token : "constant.numeric", // hex
|
109
|
+
regex : "0[xX][0-9a-fA-F]+\\b"
|
110
|
+
}, {
|
111
|
+
token : "constant.numeric", // float
|
112
|
+
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
113
|
+
}, {
|
114
|
+
token : "constant.language.boolean",
|
115
|
+
regex : "(?:true|false)\\b"
|
116
|
+
}, {
|
117
|
+
token : [
|
118
|
+
"storage.type",
|
119
|
+
"text",
|
120
|
+
"entity.name.function"
|
121
|
+
],
|
122
|
+
regex : "(function)(\\s+)(" + identifierRe + ")"
|
123
|
+
}, {
|
124
|
+
token : function(value) {
|
125
|
+
if (value == "this")
|
126
|
+
return "variable.language";
|
127
|
+
else if (value == "function")
|
128
|
+
return "storage.type";
|
129
|
+
else if (keywords.hasOwnProperty(value) || reserved.hasOwnProperty(value))
|
130
|
+
return "keyword";
|
131
|
+
else if (buildinConstants.hasOwnProperty(value))
|
132
|
+
return "constant.language";
|
133
|
+
else if (/^_?[A-Z][a-zA-Z0-9_]*$/.test(value))
|
134
|
+
return "language.support.class";
|
135
|
+
else
|
136
|
+
return "identifier";
|
88
137
|
},
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
}
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
"entity.name.function"
|
118
|
-
],
|
119
|
-
regex : "(function)(\\s+)(" + identifierRe + ")"
|
120
|
-
}, {
|
121
|
-
token : function(value) {
|
122
|
-
if (value == "this")
|
123
|
-
return "variable.language";
|
124
|
-
else if (value == "function")
|
125
|
-
return "storage.type";
|
126
|
-
else if (keywords.hasOwnProperty(value) || reserved.hasOwnProperty(value))
|
127
|
-
return "keyword";
|
128
|
-
else if (buildinConstants.hasOwnProperty(value))
|
129
|
-
return "constant.language";
|
130
|
-
else if (/^_?[A-Z][a-zA-Z0-9_]*$/.test(value))
|
131
|
-
return "language.support.class";
|
132
|
-
else
|
133
|
-
return "identifier";
|
134
|
-
},
|
135
|
-
// TODO: Unicode escape sequences
|
136
|
-
// TODO: Unicode identifiers
|
137
|
-
regex : identifierRe
|
138
|
-
}, {
|
139
|
-
token : "keyword.operator",
|
140
|
-
regex : "!|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
|
141
|
-
}, {
|
142
|
-
token : "punctuation.operator",
|
143
|
-
regex : "\\?|\\:|\\,|\\;|\\."
|
144
|
-
}, {
|
145
|
-
token : "paren.lparen",
|
146
|
-
regex : "[[({<]"
|
147
|
-
}, {
|
148
|
-
token : "paren.rparen",
|
149
|
-
regex : "[\\])}>]"
|
150
|
-
}, {
|
151
|
-
token : "text",
|
152
|
-
regex : "\\s+"
|
153
|
-
}
|
154
|
-
],
|
155
|
-
"comment" : [
|
156
|
-
{
|
157
|
-
token : "comment", // closing comment
|
158
|
-
regex : ".*?\\*\\/",
|
159
|
-
next : "start"
|
160
|
-
}, {
|
161
|
-
token : "comment", // comment spanning whole line
|
162
|
-
merge : true,
|
163
|
-
regex : ".+"
|
164
|
-
}
|
165
|
-
]
|
166
|
-
};
|
167
|
-
|
168
|
-
this.embedRules(DocCommentHighlightRules, "doc-",
|
169
|
-
[ DocCommentHighlightRules.getEndRule("start") ]);
|
138
|
+
regex : identifierRe
|
139
|
+
}, {
|
140
|
+
token : "keyword.operator",
|
141
|
+
regex : "!|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
|
142
|
+
}, {
|
143
|
+
token : "punctuation.operator",
|
144
|
+
regex : "\\?|\\:|\\,|\\;|\\."
|
145
|
+
}, {
|
146
|
+
token : "paren.lparen",
|
147
|
+
regex : "[[({<]"
|
148
|
+
}, {
|
149
|
+
token : "paren.rparen",
|
150
|
+
regex : "[\\])}>]"
|
151
|
+
}, {
|
152
|
+
token : "text",
|
153
|
+
regex : "\\s+"
|
154
|
+
}
|
155
|
+
],
|
156
|
+
"comment" : [
|
157
|
+
{
|
158
|
+
token : "comment", // closing comment
|
159
|
+
regex : ".*?\\*\\/",
|
160
|
+
next : "start"
|
161
|
+
}, {
|
162
|
+
token : "comment", // comment spanning whole line
|
163
|
+
regex : ".+"
|
164
|
+
}
|
165
|
+
]
|
170
166
|
};
|
171
167
|
|
172
|
-
|
168
|
+
this.embedRules(DocCommentHighlightRules, "doc-",
|
169
|
+
[ DocCommentHighlightRules.getEndRule("start") ]);
|
170
|
+
};
|
173
171
|
|
174
|
-
|
172
|
+
oop.inherits(JsxHighlightRules, TextHighlightRules);
|
173
|
+
|
174
|
+
exports.JsxHighlightRules = JsxHighlightRules;
|
175
175
|
});
|
176
176
|
|
177
177
|
define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
@@ -187,21 +187,10 @@ var DocCommentHighlightRules = function() {
|
|
187
187
|
token : "comment.doc.tag",
|
188
188
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
189
189
|
}, {
|
190
|
-
token : "comment.doc",
|
191
|
-
|
192
|
-
regex : "\\s+"
|
193
|
-
}, {
|
194
|
-
token : "comment.doc",
|
195
|
-
merge : true,
|
196
|
-
regex : "TODO"
|
197
|
-
}, {
|
198
|
-
token : "comment.doc",
|
199
|
-
merge : true,
|
200
|
-
regex : "[^@\\*]+"
|
190
|
+
token : "comment.doc.tag",
|
191
|
+
regex : "\\bTODO\\b"
|
201
192
|
}, {
|
202
|
-
|
203
|
-
merge : true,
|
204
|
-
regex : "."
|
193
|
+
defaultToken : "comment.doc"
|
205
194
|
}]
|
206
195
|
};
|
207
196
|
};
|
@@ -211,7 +200,6 @@ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
|
211
200
|
DocCommentHighlightRules.getStartRule = function(start) {
|
212
201
|
return {
|
213
202
|
token : "comment.doc", // doc comment
|
214
|
-
merge : true,
|
215
203
|
regex : "\\/\\*(?=\\*)",
|
216
204
|
next : start
|
217
205
|
};
|
@@ -220,7 +208,6 @@ DocCommentHighlightRules.getStartRule = function(start) {
|
|
220
208
|
DocCommentHighlightRules.getEndRule = function (start) {
|
221
209
|
return {
|
222
210
|
token : "comment.doc", // closing comment
|
223
|
-
merge : true,
|
224
211
|
regex : "\\*\\/",
|
225
212
|
next : start
|
226
213
|
};
|
@@ -263,12 +250,7 @@ var MatchingBraceOutdent = function() {};
|
|
263
250
|
};
|
264
251
|
|
265
252
|
this.$getIndent = function(line) {
|
266
|
-
|
267
|
-
if (match) {
|
268
|
-
return match[1];
|
269
|
-
}
|
270
|
-
|
271
|
-
return "";
|
253
|
+
return line.match(/^\s*/)[0];
|
272
254
|
};
|
273
255
|
|
274
256
|
}).call(MatchingBraceOutdent.prototype);
|
@@ -276,59 +258,155 @@ var MatchingBraceOutdent = function() {};
|
|
276
258
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
277
259
|
});
|
278
260
|
|
279
|
-
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour'], function(require, exports, module) {
|
261
|
+
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
280
262
|
|
281
263
|
|
282
264
|
var oop = require("../../lib/oop");
|
283
265
|
var Behaviour = require("../behaviour").Behaviour;
|
266
|
+
var TokenIterator = require("../../token_iterator").TokenIterator;
|
267
|
+
var lang = require("../../lib/lang");
|
268
|
+
|
269
|
+
var SAFE_INSERT_IN_TOKENS =
|
270
|
+
["text", "paren.rparen", "punctuation.operator"];
|
271
|
+
var SAFE_INSERT_BEFORE_TOKENS =
|
272
|
+
["text", "paren.rparen", "punctuation.operator", "comment"];
|
273
|
+
|
274
|
+
|
275
|
+
var autoInsertedBrackets = 0;
|
276
|
+
var autoInsertedRow = -1;
|
277
|
+
var autoInsertedLineEnd = "";
|
278
|
+
var maybeInsertedBrackets = 0;
|
279
|
+
var maybeInsertedRow = -1;
|
280
|
+
var maybeInsertedLineStart = "";
|
281
|
+
var maybeInsertedLineEnd = "";
|
284
282
|
|
285
283
|
var CstyleBehaviour = function () {
|
284
|
+
|
285
|
+
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
286
|
+
var cursor = editor.getCursorPosition();
|
287
|
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
288
|
+
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
289
|
+
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
290
|
+
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
291
|
+
return false;
|
292
|
+
}
|
293
|
+
iterator.stepForward();
|
294
|
+
return iterator.getCurrentTokenRow() !== cursor.row ||
|
295
|
+
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
296
|
+
};
|
297
|
+
|
298
|
+
CstyleBehaviour.$matchTokenType = function(token, types) {
|
299
|
+
return types.indexOf(token.type || token) > -1;
|
300
|
+
};
|
301
|
+
|
302
|
+
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
303
|
+
var cursor = editor.getCursorPosition();
|
304
|
+
var line = session.doc.getLine(cursor.row);
|
305
|
+
if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
|
306
|
+
autoInsertedBrackets = 0;
|
307
|
+
autoInsertedRow = cursor.row;
|
308
|
+
autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
309
|
+
autoInsertedBrackets++;
|
310
|
+
};
|
311
|
+
|
312
|
+
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
313
|
+
var cursor = editor.getCursorPosition();
|
314
|
+
var line = session.doc.getLine(cursor.row);
|
315
|
+
if (!this.isMaybeInsertedClosing(cursor, line))
|
316
|
+
maybeInsertedBrackets = 0;
|
317
|
+
maybeInsertedRow = cursor.row;
|
318
|
+
maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
319
|
+
maybeInsertedLineEnd = line.substr(cursor.column);
|
320
|
+
maybeInsertedBrackets++;
|
321
|
+
};
|
322
|
+
|
323
|
+
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
324
|
+
return autoInsertedBrackets > 0 &&
|
325
|
+
cursor.row === autoInsertedRow &&
|
326
|
+
bracket === autoInsertedLineEnd[0] &&
|
327
|
+
line.substr(cursor.column) === autoInsertedLineEnd;
|
328
|
+
};
|
329
|
+
|
330
|
+
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
331
|
+
return maybeInsertedBrackets > 0 &&
|
332
|
+
cursor.row === maybeInsertedRow &&
|
333
|
+
line.substr(cursor.column) === maybeInsertedLineEnd &&
|
334
|
+
line.substr(0, cursor.column) == maybeInsertedLineStart;
|
335
|
+
};
|
336
|
+
|
337
|
+
CstyleBehaviour.popAutoInsertedClosing = function() {
|
338
|
+
autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
|
339
|
+
autoInsertedBrackets--;
|
340
|
+
};
|
341
|
+
|
342
|
+
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
343
|
+
maybeInsertedBrackets = 0;
|
344
|
+
maybeInsertedRow = -1;
|
345
|
+
};
|
286
346
|
|
287
347
|
this.add("braces", "insertion", function (state, action, editor, session, text) {
|
348
|
+
var cursor = editor.getCursorPosition();
|
349
|
+
var line = session.doc.getLine(cursor.row);
|
288
350
|
if (text == '{') {
|
289
351
|
var selection = editor.getSelectionRange();
|
290
352
|
var selected = session.doc.getTextRange(selection);
|
291
|
-
if (selected !== "") {
|
353
|
+
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
292
354
|
return {
|
293
355
|
text: '{' + selected + '}',
|
294
356
|
selection: false
|
295
357
|
};
|
296
|
-
} else {
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
358
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
359
|
+
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
360
|
+
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
361
|
+
return {
|
362
|
+
text: '{}',
|
363
|
+
selection: [1, 1]
|
364
|
+
};
|
365
|
+
} else {
|
366
|
+
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
367
|
+
return {
|
368
|
+
text: '{',
|
369
|
+
selection: [1, 1]
|
370
|
+
};
|
371
|
+
}
|
301
372
|
}
|
302
373
|
} else if (text == '}') {
|
303
|
-
var cursor = editor.getCursorPosition();
|
304
|
-
var line = session.doc.getLine(cursor.row);
|
305
374
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
306
375
|
if (rightChar == '}') {
|
307
376
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
308
|
-
if (matching !== null) {
|
377
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
378
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
309
379
|
return {
|
310
380
|
text: '',
|
311
381
|
selection: [1, 1]
|
312
382
|
};
|
313
383
|
}
|
314
384
|
}
|
315
|
-
} else if (text == "\n") {
|
316
|
-
var
|
317
|
-
|
385
|
+
} else if (text == "\n" || text == "\r\n") {
|
386
|
+
var closing = "";
|
387
|
+
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
388
|
+
closing = lang.stringRepeat("}", maybeInsertedBrackets);
|
389
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
390
|
+
}
|
318
391
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
319
|
-
if (rightChar
|
320
|
-
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column
|
392
|
+
if (rightChar === '}') {
|
393
|
+
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
321
394
|
if (!openBracePos)
|
322
395
|
return null;
|
323
|
-
|
324
|
-
|
325
|
-
var next_indent = this.$getIndent(
|
326
|
-
|
327
|
-
return
|
328
|
-
text: '\n' + indent + '\n' + next_indent,
|
329
|
-
selection: [1, indent.length, 1, indent.length]
|
330
|
-
};
|
396
|
+
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
397
|
+
} else if (closing) {
|
398
|
+
var next_indent = this.$getIndent(line);
|
399
|
+
} else {
|
400
|
+
return;
|
331
401
|
}
|
402
|
+
var indent = next_indent + session.getTabString();
|
403
|
+
|
404
|
+
return {
|
405
|
+
text: '\n' + indent + '\n' + next_indent + closing,
|
406
|
+
selection: [1, indent.length, 1, indent.length]
|
407
|
+
};
|
408
|
+
} else {
|
409
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
332
410
|
}
|
333
411
|
});
|
334
412
|
|
@@ -340,6 +418,8 @@ var CstyleBehaviour = function () {
|
|
340
418
|
if (rightChar == '}') {
|
341
419
|
range.end.column++;
|
342
420
|
return range;
|
421
|
+
} else {
|
422
|
+
maybeInsertedBrackets--;
|
343
423
|
}
|
344
424
|
}
|
345
425
|
});
|
@@ -348,12 +428,13 @@ var CstyleBehaviour = function () {
|
|
348
428
|
if (text == '(') {
|
349
429
|
var selection = editor.getSelectionRange();
|
350
430
|
var selected = session.doc.getTextRange(selection);
|
351
|
-
if (selected !== "") {
|
431
|
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
352
432
|
return {
|
353
433
|
text: '(' + selected + ')',
|
354
434
|
selection: false
|
355
435
|
};
|
356
|
-
} else {
|
436
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
437
|
+
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
357
438
|
return {
|
358
439
|
text: '()',
|
359
440
|
selection: [1, 1]
|
@@ -365,7 +446,8 @@ var CstyleBehaviour = function () {
|
|
365
446
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
366
447
|
if (rightChar == ')') {
|
367
448
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
368
|
-
if (matching !== null) {
|
449
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
450
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
369
451
|
return {
|
370
452
|
text: '',
|
371
453
|
selection: [1, 1]
|
@@ -391,12 +473,13 @@ var CstyleBehaviour = function () {
|
|
391
473
|
if (text == '[') {
|
392
474
|
var selection = editor.getSelectionRange();
|
393
475
|
var selected = session.doc.getTextRange(selection);
|
394
|
-
if (selected !== "") {
|
476
|
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
395
477
|
return {
|
396
478
|
text: '[' + selected + ']',
|
397
479
|
selection: false
|
398
480
|
};
|
399
|
-
} else {
|
481
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
482
|
+
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
400
483
|
return {
|
401
484
|
text: '[]',
|
402
485
|
selection: [1, 1]
|
@@ -408,7 +491,8 @@ var CstyleBehaviour = function () {
|
|
408
491
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
409
492
|
if (rightChar == ']') {
|
410
493
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
411
|
-
if (matching !== null) {
|
494
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
495
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
412
496
|
return {
|
413
497
|
text: '',
|
414
498
|
selection: [1, 1]
|
@@ -435,7 +519,7 @@ var CstyleBehaviour = function () {
|
|
435
519
|
var quote = text;
|
436
520
|
var selection = editor.getSelectionRange();
|
437
521
|
var selected = session.doc.getTextRange(selection);
|
438
|
-
if (selected !== "") {
|
522
|
+
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
439
523
|
return {
|
440
524
|
text: quote + selected + quote,
|
441
525
|
selection: false
|
@@ -444,13 +528,9 @@ var CstyleBehaviour = function () {
|
|
444
528
|
var cursor = editor.getCursorPosition();
|
445
529
|
var line = session.doc.getLine(cursor.row);
|
446
530
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
447
|
-
|
448
|
-
// We're escaped.
|
449
531
|
if (leftChar == '\\') {
|
450
532
|
return null;
|
451
533
|
}
|
452
|
-
|
453
|
-
// Find what token we're inside.
|
454
534
|
var tokens = session.getTokens(selection.start.row);
|
455
535
|
var col = 0, token;
|
456
536
|
var quotepos = -1; // Track whether we're inside an open quote.
|
@@ -467,15 +547,14 @@ var CstyleBehaviour = function () {
|
|
467
547
|
}
|
468
548
|
col += tokens[x].value.length;
|
469
549
|
}
|
470
|
-
|
471
|
-
// Try and be smart about when we auto insert.
|
472
550
|
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)))) {
|
551
|
+
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
552
|
+
return;
|
473
553
|
return {
|
474
554
|
text: quote + quote,
|
475
555
|
selection: [1,1]
|
476
556
|
};
|
477
557
|
} else if (token && token.type === "string") {
|
478
|
-
// Ignore input and move right one if we're typing over the closing quote.
|
479
558
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
480
559
|
if (rightChar == quote) {
|
481
560
|
return {
|
@@ -493,7 +572,7 @@ var CstyleBehaviour = function () {
|
|
493
572
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
494
573
|
var line = session.doc.getLine(range.start.row);
|
495
574
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
496
|
-
if (rightChar ==
|
575
|
+
if (rightChar == selected) {
|
497
576
|
range.end.column++;
|
498
577
|
return range;
|
499
578
|
}
|
@@ -514,15 +593,24 @@ var oop = require("../../lib/oop");
|
|
514
593
|
var Range = require("../../range").Range;
|
515
594
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
516
595
|
|
517
|
-
var FoldMode = exports.FoldMode = function() {
|
596
|
+
var FoldMode = exports.FoldMode = function(commentRegex) {
|
597
|
+
if (commentRegex) {
|
598
|
+
this.foldingStartMarker = new RegExp(
|
599
|
+
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
600
|
+
);
|
601
|
+
this.foldingStopMarker = new RegExp(
|
602
|
+
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
603
|
+
);
|
604
|
+
}
|
605
|
+
};
|
518
606
|
oop.inherits(FoldMode, BaseFoldMode);
|
519
607
|
|
520
608
|
(function() {
|
521
609
|
|
522
610
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
523
611
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
524
|
-
|
525
|
-
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
612
|
+
|
613
|
+
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
526
614
|
var line = session.getLine(row);
|
527
615
|
var match = line.match(this.foldingStartMarker);
|
528
616
|
if (match) {
|
@@ -530,115 +618,63 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|
530
618
|
|
531
619
|
if (match[1])
|
532
620
|
return this.openingBracketBlock(session, match[1], row, i);
|
533
|
-
|
534
|
-
var range = session.getCommentFoldRange(row, i + match[0].length);
|
535
|
-
|
621
|
+
|
622
|
+
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
623
|
+
|
624
|
+
if (range && !range.isMultiLine()) {
|
625
|
+
if (forceMultiline) {
|
626
|
+
range = this.getSectionRange(session, row);
|
627
|
+
} else if (foldStyle != "all")
|
628
|
+
range = null;
|
629
|
+
}
|
630
|
+
|
536
631
|
return range;
|
537
632
|
}
|
538
633
|
|
539
|
-
if (foldStyle
|
634
|
+
if (foldStyle === "markbegin")
|
540
635
|
return;
|
541
|
-
|
636
|
+
|
542
637
|
var match = line.match(this.foldingStopMarker);
|
543
638
|
if (match) {
|
544
639
|
var i = match.index + match[0].length;
|
545
640
|
|
546
|
-
if (match[
|
547
|
-
|
548
|
-
range.end.column -= 2;
|
549
|
-
return range;
|
550
|
-
}
|
551
|
-
|
552
|
-
var end = {row: row, column: i};
|
553
|
-
var start = session.$findOpeningBracket(match[1], end);
|
554
|
-
|
555
|
-
if (!start)
|
556
|
-
return;
|
557
|
-
|
558
|
-
start.column++;
|
559
|
-
end.column--;
|
641
|
+
if (match[1])
|
642
|
+
return this.closingBracketBlock(session, match[1], row, i);
|
560
643
|
|
561
|
-
return
|
644
|
+
return session.getCommentFoldRange(row, i, -1);
|
562
645
|
}
|
563
646
|
};
|
564
647
|
|
565
|
-
|
566
|
-
|
567
|
-
});
|
568
|
-
|
569
|
-
define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
570
|
-
|
571
|
-
|
572
|
-
var Range = require("../../range").Range;
|
573
|
-
|
574
|
-
var FoldMode = exports.FoldMode = function() {};
|
575
|
-
|
576
|
-
(function() {
|
577
|
-
|
578
|
-
this.foldingStartMarker = null;
|
579
|
-
this.foldingStopMarker = null;
|
580
|
-
|
581
|
-
// must return "" if there's no fold, to enable caching
|
582
|
-
this.getFoldWidget = function(session, foldStyle, row) {
|
648
|
+
this.getSectionRange = function(session, row) {
|
583
649
|
var line = session.getLine(row);
|
584
|
-
|
585
|
-
return "start";
|
586
|
-
if (foldStyle == "markbeginend"
|
587
|
-
&& this.foldingStopMarker
|
588
|
-
&& this.foldingStopMarker.test(line))
|
589
|
-
return "end";
|
590
|
-
return "";
|
591
|
-
};
|
592
|
-
|
593
|
-
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
594
|
-
return null;
|
595
|
-
};
|
596
|
-
|
597
|
-
this.indentationBlock = function(session, row, column) {
|
598
|
-
var re = /\S/;
|
599
|
-
var line = session.getLine(row);
|
600
|
-
var startLevel = line.search(re);
|
601
|
-
if (startLevel == -1)
|
602
|
-
return;
|
603
|
-
|
604
|
-
var startColumn = column || line.length;
|
605
|
-
var maxRow = session.getLength();
|
650
|
+
var startIndent = line.search(/\S/);
|
606
651
|
var startRow = row;
|
652
|
+
var startColumn = line.length;
|
653
|
+
row = row + 1;
|
607
654
|
var endRow = row;
|
608
|
-
|
655
|
+
var maxRow = session.getLength();
|
609
656
|
while (++row < maxRow) {
|
610
|
-
|
611
|
-
|
612
|
-
if (
|
657
|
+
line = session.getLine(row);
|
658
|
+
var indent = line.search(/\S/);
|
659
|
+
if (indent === -1)
|
613
660
|
continue;
|
614
|
-
|
615
|
-
if (level <= startLevel)
|
661
|
+
if (startIndent > indent)
|
616
662
|
break;
|
617
|
-
|
663
|
+
var subRange = this.getFoldWidgetRange(session, "all", row);
|
664
|
+
|
665
|
+
if (subRange) {
|
666
|
+
if (subRange.start.row <= startRow) {
|
667
|
+
break;
|
668
|
+
} else if (subRange.isMultiLine()) {
|
669
|
+
row = subRange.end.row;
|
670
|
+
} else if (startIndent == indent) {
|
671
|
+
break;
|
672
|
+
}
|
673
|
+
}
|
618
674
|
endRow = row;
|
619
675
|
}
|
620
|
-
|
621
|
-
|
622
|
-
var endColumn = session.getLine(endRow).length;
|
623
|
-
return new Range(startRow, startColumn, endRow, endColumn);
|
624
|
-
}
|
625
|
-
};
|
626
|
-
|
627
|
-
this.openingBracketBlock = function(session, bracket, row, column, typeRe) {
|
628
|
-
var start = {row: row, column: column + 1};
|
629
|
-
var end = session.$findClosingBracket(bracket, start, typeRe);
|
630
|
-
if (!end)
|
631
|
-
return;
|
632
|
-
|
633
|
-
var fw = session.foldWidgets[end.row];
|
634
|
-
if (fw == null)
|
635
|
-
fw = this.getFoldWidget(session, end.row);
|
636
|
-
|
637
|
-
if (fw == "start" && end.row > start.row) {
|
638
|
-
end.row --;
|
639
|
-
end.column = session.getLine(end.row).length;
|
640
|
-
}
|
641
|
-
return Range.fromPoints(start, end);
|
676
|
+
|
677
|
+
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
642
678
|
};
|
643
679
|
|
644
680
|
}).call(FoldMode.prototype);
|