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
@@ -1,4 +1,4 @@
|
|
1
|
-
define('ace/mode/csharp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/csharp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/
|
1
|
+
define('ace/mode/csharp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/csharp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/csharp'], function(require, exports, module) {
|
2
2
|
|
3
3
|
|
4
4
|
var oop = require("../lib/oop");
|
@@ -7,10 +7,10 @@ var Tokenizer = require("../tokenizer").Tokenizer;
|
|
7
7
|
var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules;
|
8
8
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
9
9
|
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
10
|
-
var CStyleFoldMode = require("./folding/
|
10
|
+
var CStyleFoldMode = require("./folding/csharp").FoldMode;
|
11
11
|
|
12
12
|
var Mode = function() {
|
13
|
-
this
|
13
|
+
this.HighlightRules = CSharpHighlightRules;
|
14
14
|
this.$outdent = new MatchingBraceOutdent();
|
15
15
|
this.$behaviour = new CstyleBehaviour();
|
16
16
|
this.foldingRules = new CStyleFoldMode();
|
@@ -19,10 +19,13 @@ oop.inherits(Mode, TextMode);
|
|
19
19
|
|
20
20
|
(function() {
|
21
21
|
|
22
|
+
this.lineCommentStart = "//";
|
23
|
+
this.blockComment = {start: "/*", end: "*/"};
|
24
|
+
|
22
25
|
this.getNextLineIndent = function(state, line, tab) {
|
23
26
|
var indent = this.$getIndent(line);
|
24
27
|
|
25
|
-
var tokenizedLine = this
|
28
|
+
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
26
29
|
var tokens = tokenizedLine.tokens;
|
27
30
|
|
28
31
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
@@ -52,31 +55,24 @@ oop.inherits(Mode, TextMode);
|
|
52
55
|
return null;
|
53
56
|
};
|
54
57
|
|
58
|
+
this.$id = "ace/mode/csharp";
|
55
59
|
}).call(Mode.prototype);
|
56
60
|
|
57
61
|
exports.Mode = Mode;
|
58
62
|
});
|
59
|
-
define('ace/mode/csharp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/
|
63
|
+
define('ace/mode/csharp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
60
64
|
|
61
65
|
|
62
66
|
var oop = require("../lib/oop");
|
63
|
-
var lang = require("../lib/lang");
|
64
67
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
65
68
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
66
69
|
|
67
70
|
var CSharpHighlightRules = function() {
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
var buildinConstants = lang.arrayToMap(
|
74
|
-
("null|true|false").split("|")
|
75
|
-
);
|
76
|
-
|
77
|
-
|
78
|
-
// regexp must not have capturing parentheses. Use (?:) instead.
|
79
|
-
// regexps are ordered -> the first match is used
|
71
|
+
var keywordMapper = this.createKeywordMapper({
|
72
|
+
"variable.language": "this",
|
73
|
+
"keyword": "abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic",
|
74
|
+
"constant.language": "null|true|false"
|
75
|
+
}, "identifier");
|
80
76
|
|
81
77
|
this.$rules = {
|
82
78
|
"start" : [
|
@@ -88,17 +84,22 @@ var CSharpHighlightRules = function() {
|
|
88
84
|
{
|
89
85
|
token : "comment", // multi line comment
|
90
86
|
regex : "\\/\\*",
|
91
|
-
merge : true,
|
92
87
|
next : "comment"
|
93
88
|
}, {
|
94
89
|
token : "string.regexp",
|
95
90
|
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
|
96
91
|
}, {
|
97
|
-
token : "string", //
|
98
|
-
regex : '
|
92
|
+
token : "string", // character
|
93
|
+
regex : /'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))'/
|
94
|
+
}, {
|
95
|
+
token : "string", start : '"', end : '"|$', next: [
|
96
|
+
{token: "constant.language.escape", regex: /\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/},
|
97
|
+
{token: "invalid", regex: /\\./}
|
98
|
+
]
|
99
99
|
}, {
|
100
|
-
token : "string",
|
101
|
-
|
100
|
+
token : "string", start : '@"', end : '"', next:[
|
101
|
+
{token: "constant.language.escape", regex: '""'}
|
102
|
+
]
|
102
103
|
}, {
|
103
104
|
token : "constant.numeric", // hex
|
104
105
|
regex : "0[xX][0-9a-fA-F]+\\b"
|
@@ -109,22 +110,14 @@ var CSharpHighlightRules = function() {
|
|
109
110
|
token : "constant.language.boolean",
|
110
111
|
regex : "(?:true|false)\\b"
|
111
112
|
}, {
|
112
|
-
token :
|
113
|
-
if (value == "this")
|
114
|
-
return "variable.language";
|
115
|
-
else if (keywords.hasOwnProperty(value))
|
116
|
-
return "keyword";
|
117
|
-
else if (buildinConstants.hasOwnProperty(value))
|
118
|
-
return "constant.language";
|
119
|
-
else
|
120
|
-
return "identifier";
|
121
|
-
},
|
122
|
-
// TODO: Unicode escape sequences
|
123
|
-
// TODO: Unicode identifiers
|
113
|
+
token : keywordMapper,
|
124
114
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
125
115
|
}, {
|
126
116
|
token : "keyword.operator",
|
127
117
|
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
|
118
|
+
}, {
|
119
|
+
token : "keyword",
|
120
|
+
regex : "^\\s*#(if|else|elif|endif|define|undef|warning|error|line|region|endregion|pragma)"
|
128
121
|
}, {
|
129
122
|
token : "punctuation.operator",
|
130
123
|
regex : "\\?|\\:|\\,|\\;|\\."
|
@@ -146,14 +139,14 @@ var CSharpHighlightRules = function() {
|
|
146
139
|
next : "start"
|
147
140
|
}, {
|
148
141
|
token : "comment", // comment spanning whole line
|
149
|
-
merge : true,
|
150
142
|
regex : ".+"
|
151
143
|
}
|
152
144
|
]
|
153
145
|
};
|
154
|
-
|
146
|
+
|
155
147
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
156
148
|
[ DocCommentHighlightRules.getEndRule("start") ]);
|
149
|
+
this.normalizeRules();
|
157
150
|
};
|
158
151
|
|
159
152
|
oop.inherits(CSharpHighlightRules, TextHighlightRules);
|
@@ -174,21 +167,10 @@ var DocCommentHighlightRules = function() {
|
|
174
167
|
token : "comment.doc.tag",
|
175
168
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
176
169
|
}, {
|
177
|
-
token : "comment.doc",
|
178
|
-
|
179
|
-
regex : "\\s+"
|
180
|
-
}, {
|
181
|
-
token : "comment.doc",
|
182
|
-
merge : true,
|
183
|
-
regex : "TODO"
|
184
|
-
}, {
|
185
|
-
token : "comment.doc",
|
186
|
-
merge : true,
|
187
|
-
regex : "[^@\\*]+"
|
170
|
+
token : "comment.doc.tag",
|
171
|
+
regex : "\\bTODO\\b"
|
188
172
|
}, {
|
189
|
-
|
190
|
-
merge : true,
|
191
|
-
regex : "."
|
173
|
+
defaultToken : "comment.doc"
|
192
174
|
}]
|
193
175
|
};
|
194
176
|
};
|
@@ -198,7 +180,6 @@ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
|
198
180
|
DocCommentHighlightRules.getStartRule = function(start) {
|
199
181
|
return {
|
200
182
|
token : "comment.doc", // doc comment
|
201
|
-
merge : true,
|
202
183
|
regex : "\\/\\*(?=\\*)",
|
203
184
|
next : start
|
204
185
|
};
|
@@ -207,7 +188,6 @@ DocCommentHighlightRules.getStartRule = function(start) {
|
|
207
188
|
DocCommentHighlightRules.getEndRule = function (start) {
|
208
189
|
return {
|
209
190
|
token : "comment.doc", // closing comment
|
210
|
-
merge : true,
|
211
191
|
regex : "\\*\\/",
|
212
192
|
next : start
|
213
193
|
};
|
@@ -250,12 +230,7 @@ var MatchingBraceOutdent = function() {};
|
|
250
230
|
};
|
251
231
|
|
252
232
|
this.$getIndent = function(line) {
|
253
|
-
|
254
|
-
if (match) {
|
255
|
-
return match[1];
|
256
|
-
}
|
257
|
-
|
258
|
-
return "";
|
233
|
+
return line.match(/^\s*/)[0];
|
259
234
|
};
|
260
235
|
|
261
236
|
}).call(MatchingBraceOutdent.prototype);
|
@@ -263,59 +238,155 @@ var MatchingBraceOutdent = function() {};
|
|
263
238
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
264
239
|
});
|
265
240
|
|
266
|
-
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour'], function(require, exports, module) {
|
241
|
+
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
267
242
|
|
268
243
|
|
269
244
|
var oop = require("../../lib/oop");
|
270
245
|
var Behaviour = require("../behaviour").Behaviour;
|
246
|
+
var TokenIterator = require("../../token_iterator").TokenIterator;
|
247
|
+
var lang = require("../../lib/lang");
|
248
|
+
|
249
|
+
var SAFE_INSERT_IN_TOKENS =
|
250
|
+
["text", "paren.rparen", "punctuation.operator"];
|
251
|
+
var SAFE_INSERT_BEFORE_TOKENS =
|
252
|
+
["text", "paren.rparen", "punctuation.operator", "comment"];
|
253
|
+
|
254
|
+
|
255
|
+
var autoInsertedBrackets = 0;
|
256
|
+
var autoInsertedRow = -1;
|
257
|
+
var autoInsertedLineEnd = "";
|
258
|
+
var maybeInsertedBrackets = 0;
|
259
|
+
var maybeInsertedRow = -1;
|
260
|
+
var maybeInsertedLineStart = "";
|
261
|
+
var maybeInsertedLineEnd = "";
|
271
262
|
|
272
263
|
var CstyleBehaviour = function () {
|
264
|
+
|
265
|
+
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
266
|
+
var cursor = editor.getCursorPosition();
|
267
|
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
268
|
+
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
269
|
+
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
270
|
+
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
271
|
+
return false;
|
272
|
+
}
|
273
|
+
iterator.stepForward();
|
274
|
+
return iterator.getCurrentTokenRow() !== cursor.row ||
|
275
|
+
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
276
|
+
};
|
277
|
+
|
278
|
+
CstyleBehaviour.$matchTokenType = function(token, types) {
|
279
|
+
return types.indexOf(token.type || token) > -1;
|
280
|
+
};
|
281
|
+
|
282
|
+
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
283
|
+
var cursor = editor.getCursorPosition();
|
284
|
+
var line = session.doc.getLine(cursor.row);
|
285
|
+
if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
|
286
|
+
autoInsertedBrackets = 0;
|
287
|
+
autoInsertedRow = cursor.row;
|
288
|
+
autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
289
|
+
autoInsertedBrackets++;
|
290
|
+
};
|
291
|
+
|
292
|
+
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
293
|
+
var cursor = editor.getCursorPosition();
|
294
|
+
var line = session.doc.getLine(cursor.row);
|
295
|
+
if (!this.isMaybeInsertedClosing(cursor, line))
|
296
|
+
maybeInsertedBrackets = 0;
|
297
|
+
maybeInsertedRow = cursor.row;
|
298
|
+
maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
299
|
+
maybeInsertedLineEnd = line.substr(cursor.column);
|
300
|
+
maybeInsertedBrackets++;
|
301
|
+
};
|
302
|
+
|
303
|
+
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
304
|
+
return autoInsertedBrackets > 0 &&
|
305
|
+
cursor.row === autoInsertedRow &&
|
306
|
+
bracket === autoInsertedLineEnd[0] &&
|
307
|
+
line.substr(cursor.column) === autoInsertedLineEnd;
|
308
|
+
};
|
309
|
+
|
310
|
+
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
311
|
+
return maybeInsertedBrackets > 0 &&
|
312
|
+
cursor.row === maybeInsertedRow &&
|
313
|
+
line.substr(cursor.column) === maybeInsertedLineEnd &&
|
314
|
+
line.substr(0, cursor.column) == maybeInsertedLineStart;
|
315
|
+
};
|
316
|
+
|
317
|
+
CstyleBehaviour.popAutoInsertedClosing = function() {
|
318
|
+
autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
|
319
|
+
autoInsertedBrackets--;
|
320
|
+
};
|
321
|
+
|
322
|
+
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
323
|
+
maybeInsertedBrackets = 0;
|
324
|
+
maybeInsertedRow = -1;
|
325
|
+
};
|
273
326
|
|
274
327
|
this.add("braces", "insertion", function (state, action, editor, session, text) {
|
328
|
+
var cursor = editor.getCursorPosition();
|
329
|
+
var line = session.doc.getLine(cursor.row);
|
275
330
|
if (text == '{') {
|
276
331
|
var selection = editor.getSelectionRange();
|
277
332
|
var selected = session.doc.getTextRange(selection);
|
278
|
-
if (selected !== "") {
|
333
|
+
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
279
334
|
return {
|
280
335
|
text: '{' + selected + '}',
|
281
336
|
selection: false
|
282
337
|
};
|
283
|
-
} else {
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
338
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
339
|
+
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
340
|
+
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
341
|
+
return {
|
342
|
+
text: '{}',
|
343
|
+
selection: [1, 1]
|
344
|
+
};
|
345
|
+
} else {
|
346
|
+
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
347
|
+
return {
|
348
|
+
text: '{',
|
349
|
+
selection: [1, 1]
|
350
|
+
};
|
351
|
+
}
|
288
352
|
}
|
289
353
|
} else if (text == '}') {
|
290
|
-
var cursor = editor.getCursorPosition();
|
291
|
-
var line = session.doc.getLine(cursor.row);
|
292
354
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
293
355
|
if (rightChar == '}') {
|
294
356
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
295
|
-
if (matching !== null) {
|
357
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
358
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
296
359
|
return {
|
297
360
|
text: '',
|
298
361
|
selection: [1, 1]
|
299
362
|
};
|
300
363
|
}
|
301
364
|
}
|
302
|
-
} else if (text == "\n") {
|
303
|
-
var
|
304
|
-
|
365
|
+
} else if (text == "\n" || text == "\r\n") {
|
366
|
+
var closing = "";
|
367
|
+
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
368
|
+
closing = lang.stringRepeat("}", maybeInsertedBrackets);
|
369
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
370
|
+
}
|
305
371
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
306
|
-
if (rightChar
|
307
|
-
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column
|
372
|
+
if (rightChar === '}') {
|
373
|
+
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
308
374
|
if (!openBracePos)
|
309
375
|
return null;
|
310
|
-
|
311
|
-
|
312
|
-
var next_indent = this.$getIndent(
|
313
|
-
|
314
|
-
return
|
315
|
-
text: '\n' + indent + '\n' + next_indent,
|
316
|
-
selection: [1, indent.length, 1, indent.length]
|
317
|
-
};
|
376
|
+
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
377
|
+
} else if (closing) {
|
378
|
+
var next_indent = this.$getIndent(line);
|
379
|
+
} else {
|
380
|
+
return;
|
318
381
|
}
|
382
|
+
var indent = next_indent + session.getTabString();
|
383
|
+
|
384
|
+
return {
|
385
|
+
text: '\n' + indent + '\n' + next_indent + closing,
|
386
|
+
selection: [1, indent.length, 1, indent.length]
|
387
|
+
};
|
388
|
+
} else {
|
389
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
319
390
|
}
|
320
391
|
});
|
321
392
|
|
@@ -327,6 +398,8 @@ var CstyleBehaviour = function () {
|
|
327
398
|
if (rightChar == '}') {
|
328
399
|
range.end.column++;
|
329
400
|
return range;
|
401
|
+
} else {
|
402
|
+
maybeInsertedBrackets--;
|
330
403
|
}
|
331
404
|
}
|
332
405
|
});
|
@@ -335,12 +408,13 @@ var CstyleBehaviour = function () {
|
|
335
408
|
if (text == '(') {
|
336
409
|
var selection = editor.getSelectionRange();
|
337
410
|
var selected = session.doc.getTextRange(selection);
|
338
|
-
if (selected !== "") {
|
411
|
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
339
412
|
return {
|
340
413
|
text: '(' + selected + ')',
|
341
414
|
selection: false
|
342
415
|
};
|
343
|
-
} else {
|
416
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
417
|
+
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
344
418
|
return {
|
345
419
|
text: '()',
|
346
420
|
selection: [1, 1]
|
@@ -352,7 +426,8 @@ var CstyleBehaviour = function () {
|
|
352
426
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
353
427
|
if (rightChar == ')') {
|
354
428
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
355
|
-
if (matching !== null) {
|
429
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
430
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
356
431
|
return {
|
357
432
|
text: '',
|
358
433
|
selection: [1, 1]
|
@@ -378,12 +453,13 @@ var CstyleBehaviour = function () {
|
|
378
453
|
if (text == '[') {
|
379
454
|
var selection = editor.getSelectionRange();
|
380
455
|
var selected = session.doc.getTextRange(selection);
|
381
|
-
if (selected !== "") {
|
456
|
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
382
457
|
return {
|
383
458
|
text: '[' + selected + ']',
|
384
459
|
selection: false
|
385
460
|
};
|
386
|
-
} else {
|
461
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
462
|
+
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
387
463
|
return {
|
388
464
|
text: '[]',
|
389
465
|
selection: [1, 1]
|
@@ -395,7 +471,8 @@ var CstyleBehaviour = function () {
|
|
395
471
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
396
472
|
if (rightChar == ']') {
|
397
473
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
398
|
-
if (matching !== null) {
|
474
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
475
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
399
476
|
return {
|
400
477
|
text: '',
|
401
478
|
selection: [1, 1]
|
@@ -422,7 +499,7 @@ var CstyleBehaviour = function () {
|
|
422
499
|
var quote = text;
|
423
500
|
var selection = editor.getSelectionRange();
|
424
501
|
var selected = session.doc.getTextRange(selection);
|
425
|
-
if (selected !== "") {
|
502
|
+
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
426
503
|
return {
|
427
504
|
text: quote + selected + quote,
|
428
505
|
selection: false
|
@@ -431,13 +508,9 @@ var CstyleBehaviour = function () {
|
|
431
508
|
var cursor = editor.getCursorPosition();
|
432
509
|
var line = session.doc.getLine(cursor.row);
|
433
510
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
434
|
-
|
435
|
-
// We're escaped.
|
436
511
|
if (leftChar == '\\') {
|
437
512
|
return null;
|
438
513
|
}
|
439
|
-
|
440
|
-
// Find what token we're inside.
|
441
514
|
var tokens = session.getTokens(selection.start.row);
|
442
515
|
var col = 0, token;
|
443
516
|
var quotepos = -1; // Track whether we're inside an open quote.
|
@@ -454,15 +527,14 @@ var CstyleBehaviour = function () {
|
|
454
527
|
}
|
455
528
|
col += tokens[x].value.length;
|
456
529
|
}
|
457
|
-
|
458
|
-
// Try and be smart about when we auto insert.
|
459
530
|
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)))) {
|
531
|
+
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
532
|
+
return;
|
460
533
|
return {
|
461
534
|
text: quote + quote,
|
462
535
|
selection: [1,1]
|
463
536
|
};
|
464
537
|
} else if (token && token.type === "string") {
|
465
|
-
// Ignore input and move right one if we're typing over the closing quote.
|
466
538
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
467
539
|
if (rightChar == quote) {
|
468
540
|
return {
|
@@ -480,7 +552,7 @@ var CstyleBehaviour = function () {
|
|
480
552
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
481
553
|
var line = session.doc.getLine(range.start.row);
|
482
554
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
483
|
-
if (rightChar ==
|
555
|
+
if (rightChar == selected) {
|
484
556
|
range.end.column++;
|
485
557
|
return range;
|
486
558
|
}
|
@@ -494,138 +566,204 @@ oop.inherits(CstyleBehaviour, Behaviour);
|
|
494
566
|
exports.CstyleBehaviour = CstyleBehaviour;
|
495
567
|
});
|
496
568
|
|
497
|
-
define('ace/mode/folding/
|
569
|
+
define('ace/mode/folding/csharp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
498
570
|
|
499
571
|
|
500
572
|
var oop = require("../../lib/oop");
|
501
573
|
var Range = require("../../range").Range;
|
502
|
-
var
|
503
|
-
|
504
|
-
var FoldMode = exports.FoldMode = function() {
|
505
|
-
|
574
|
+
var CFoldMode = require("./cstyle").FoldMode;
|
575
|
+
|
576
|
+
var FoldMode = exports.FoldMode = function(commentRegex) {
|
577
|
+
if (commentRegex) {
|
578
|
+
this.foldingStartMarker = new RegExp(
|
579
|
+
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
580
|
+
);
|
581
|
+
this.foldingStopMarker = new RegExp(
|
582
|
+
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
583
|
+
);
|
584
|
+
}
|
585
|
+
};
|
586
|
+
oop.inherits(FoldMode, CFoldMode);
|
506
587
|
|
507
588
|
(function() {
|
589
|
+
this.usingRe = /^\s*using \S/;
|
508
590
|
|
509
|
-
this.
|
510
|
-
this.
|
591
|
+
this.getFoldWidgetRangeBase = this.getFoldWidgetRange;
|
592
|
+
this.getFoldWidgetBase = this.getFoldWidget;
|
593
|
+
|
594
|
+
this.getFoldWidget = function(session, foldStyle, row) {
|
595
|
+
var fw = this.getFoldWidgetBase(session, foldStyle, row);
|
596
|
+
if (!fw) {
|
597
|
+
var line = session.getLine(row);
|
598
|
+
if (/^\s*#region\b/.test(line))
|
599
|
+
return "start";
|
600
|
+
var usingRe = this.usingRe;
|
601
|
+
if (usingRe.test(line)) {
|
602
|
+
var prev = session.getLine(row - 1);
|
603
|
+
var next = session.getLine(row + 1);
|
604
|
+
if (!usingRe.test(prev) && usingRe.test(next))
|
605
|
+
return "start"
|
606
|
+
}
|
607
|
+
}
|
608
|
+
return fw;
|
609
|
+
};
|
511
610
|
|
512
611
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
513
|
-
var
|
514
|
-
|
515
|
-
if (match) {
|
516
|
-
var i = match.index;
|
517
|
-
|
518
|
-
if (match[1])
|
519
|
-
return this.openingBracketBlock(session, match[1], row, i);
|
520
|
-
|
521
|
-
var range = session.getCommentFoldRange(row, i + match[0].length);
|
522
|
-
range.end.column -= 2;
|
612
|
+
var range = this.getFoldWidgetRangeBase(session, foldStyle, row);
|
613
|
+
if (range)
|
523
614
|
return range;
|
524
|
-
}
|
525
615
|
|
526
|
-
|
527
|
-
|
616
|
+
var line = session.getLine(row);
|
617
|
+
if (this.usingRe.test(line))
|
618
|
+
return this.getUsingStatementBlock(session, line, row);
|
528
619
|
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
620
|
+
if (/^\s*#region\b/.test(line))
|
621
|
+
return this.getRegionBlock(session, line, row);
|
622
|
+
};
|
623
|
+
|
624
|
+
this.getUsingStatementBlock = function(session, line, row) {
|
625
|
+
var startColumn = line.match(this.usingRe)[0].length - 1;
|
626
|
+
var maxRow = session.getLength();
|
627
|
+
var startRow = row;
|
628
|
+
var endRow = row;
|
538
629
|
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
630
|
+
while (++row < maxRow) {
|
631
|
+
line = session.getLine(row);
|
632
|
+
if (/^\s*$/.test(line))
|
633
|
+
continue;
|
634
|
+
if (!this.usingRe.test(line))
|
635
|
+
break;
|
544
636
|
|
545
|
-
|
546
|
-
|
637
|
+
endRow = row;
|
638
|
+
}
|
547
639
|
|
548
|
-
|
640
|
+
if (endRow > startRow) {
|
641
|
+
var endColumn = session.getLine(endRow).length;
|
642
|
+
return new Range(startRow, startColumn, endRow, endColumn);
|
549
643
|
}
|
550
644
|
};
|
551
645
|
|
646
|
+
this.getRegionBlock = function(session, line, row) {
|
647
|
+
var startColumn = line.search(/\s*$/);
|
648
|
+
var maxRow = session.getLength();
|
649
|
+
var startRow = row;
|
650
|
+
|
651
|
+
var re = /^\s*#(end)?region\b/
|
652
|
+
var depth = 1
|
653
|
+
while (++row < maxRow) {
|
654
|
+
line = session.getLine(row);
|
655
|
+
var m = re.exec(line);
|
656
|
+
if (!m)
|
657
|
+
continue;
|
658
|
+
if (m[1])
|
659
|
+
depth--;
|
660
|
+
else
|
661
|
+
depth++;
|
662
|
+
|
663
|
+
if (!depth)
|
664
|
+
break;
|
665
|
+
}
|
666
|
+
|
667
|
+
var endRow = row;
|
668
|
+
if (endRow > startRow) {
|
669
|
+
var endColumn = line.search(/\S/);
|
670
|
+
return new Range(startRow, startColumn, endRow, endColumn);
|
671
|
+
}
|
672
|
+
};
|
673
|
+
|
552
674
|
}).call(FoldMode.prototype);
|
553
675
|
|
554
676
|
});
|
555
677
|
|
556
|
-
define('ace/mode/folding/
|
678
|
+
define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
557
679
|
|
558
680
|
|
681
|
+
var oop = require("../../lib/oop");
|
559
682
|
var Range = require("../../range").Range;
|
683
|
+
var BaseFoldMode = require("./fold_mode").FoldMode;
|
560
684
|
|
561
|
-
var FoldMode = exports.FoldMode = function() {
|
685
|
+
var FoldMode = exports.FoldMode = function(commentRegex) {
|
686
|
+
if (commentRegex) {
|
687
|
+
this.foldingStartMarker = new RegExp(
|
688
|
+
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
689
|
+
);
|
690
|
+
this.foldingStopMarker = new RegExp(
|
691
|
+
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
692
|
+
);
|
693
|
+
}
|
694
|
+
};
|
695
|
+
oop.inherits(FoldMode, BaseFoldMode);
|
562
696
|
|
563
697
|
(function() {
|
564
698
|
|
565
|
-
this.foldingStartMarker =
|
566
|
-
this.foldingStopMarker =
|
699
|
+
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
700
|
+
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
567
701
|
|
568
|
-
|
569
|
-
this.getFoldWidget = function(session, foldStyle, row) {
|
702
|
+
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
570
703
|
var line = session.getLine(row);
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
&& this.foldingStopMarker
|
575
|
-
&& this.foldingStopMarker.test(line))
|
576
|
-
return "end";
|
577
|
-
return "";
|
578
|
-
};
|
704
|
+
var match = line.match(this.foldingStartMarker);
|
705
|
+
if (match) {
|
706
|
+
var i = match.index;
|
579
707
|
|
580
|
-
|
581
|
-
|
582
|
-
|
708
|
+
if (match[1])
|
709
|
+
return this.openingBracketBlock(session, match[1], row, i);
|
710
|
+
|
711
|
+
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
712
|
+
|
713
|
+
if (range && !range.isMultiLine()) {
|
714
|
+
if (forceMultiline) {
|
715
|
+
range = this.getSectionRange(session, row);
|
716
|
+
} else if (foldStyle != "all")
|
717
|
+
range = null;
|
718
|
+
}
|
719
|
+
|
720
|
+
return range;
|
721
|
+
}
|
583
722
|
|
584
|
-
|
585
|
-
var re = /\S/;
|
586
|
-
var line = session.getLine(row);
|
587
|
-
var startLevel = line.search(re);
|
588
|
-
if (startLevel == -1)
|
723
|
+
if (foldStyle === "markbegin")
|
589
724
|
return;
|
590
725
|
|
591
|
-
var
|
592
|
-
|
726
|
+
var match = line.match(this.foldingStopMarker);
|
727
|
+
if (match) {
|
728
|
+
var i = match.index + match[0].length;
|
729
|
+
|
730
|
+
if (match[1])
|
731
|
+
return this.closingBracketBlock(session, match[1], row, i);
|
732
|
+
|
733
|
+
return session.getCommentFoldRange(row, i, -1);
|
734
|
+
}
|
735
|
+
};
|
736
|
+
|
737
|
+
this.getSectionRange = function(session, row) {
|
738
|
+
var line = session.getLine(row);
|
739
|
+
var startIndent = line.search(/\S/);
|
593
740
|
var startRow = row;
|
741
|
+
var startColumn = line.length;
|
742
|
+
row = row + 1;
|
594
743
|
var endRow = row;
|
595
|
-
|
744
|
+
var maxRow = session.getLength();
|
596
745
|
while (++row < maxRow) {
|
597
|
-
|
598
|
-
|
599
|
-
if (
|
746
|
+
line = session.getLine(row);
|
747
|
+
var indent = line.search(/\S/);
|
748
|
+
if (indent === -1)
|
600
749
|
continue;
|
601
|
-
|
602
|
-
if (level <= startLevel)
|
750
|
+
if (startIndent > indent)
|
603
751
|
break;
|
604
|
-
|
752
|
+
var subRange = this.getFoldWidgetRange(session, "all", row);
|
753
|
+
|
754
|
+
if (subRange) {
|
755
|
+
if (subRange.start.row <= startRow) {
|
756
|
+
break;
|
757
|
+
} else if (subRange.isMultiLine()) {
|
758
|
+
row = subRange.end.row;
|
759
|
+
} else if (startIndent == indent) {
|
760
|
+
break;
|
761
|
+
}
|
762
|
+
}
|
605
763
|
endRow = row;
|
606
764
|
}
|
607
|
-
|
608
|
-
|
609
|
-
var endColumn = session.getLine(endRow).length;
|
610
|
-
return new Range(startRow, startColumn, endRow, endColumn);
|
611
|
-
}
|
612
|
-
};
|
613
|
-
|
614
|
-
this.openingBracketBlock = function(session, bracket, row, column, typeRe) {
|
615
|
-
var start = {row: row, column: column + 1};
|
616
|
-
var end = session.$findClosingBracket(bracket, start, typeRe);
|
617
|
-
if (!end)
|
618
|
-
return;
|
619
|
-
|
620
|
-
var fw = session.foldWidgets[end.row];
|
621
|
-
if (fw == null)
|
622
|
-
fw = this.getFoldWidget(session, end.row);
|
623
|
-
|
624
|
-
if (fw == "start" && end.row > start.row) {
|
625
|
-
end.row --;
|
626
|
-
end.column = session.getLine(end.row).length;
|
627
|
-
}
|
628
|
-
return Range.fromPoints(start, end);
|
765
|
+
|
766
|
+
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
629
767
|
};
|
630
768
|
|
631
769
|
}).call(FoldMode.prototype);
|