codemirror-rails 5.0 → 5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/codemirror/rails/version.rb +2 -2
- data/vendor/assets/javascripts/codemirror.js +104 -64
- data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.js +3 -1
- data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +144 -121
- data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.js +4 -2
- data/vendor/assets/javascripts/codemirror/addons/hint/css-hint.js +4 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +13 -8
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +2 -0
- data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +40 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/multiplex_test.js +33 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.js +8 -2
- data/vendor/assets/javascripts/codemirror/addons/tern/tern.js +1 -1
- data/vendor/assets/javascripts/codemirror/keymaps/sublime.js +13 -0
- data/vendor/assets/javascripts/codemirror/keymaps/vim.js +43 -54
- data/vendor/assets/javascripts/codemirror/modes/asciiarmor.js +73 -0
- data/vendor/assets/javascripts/codemirror/modes/clike.js +2 -1
- data/vendor/assets/javascripts/codemirror/modes/clojure.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/cmake.js +97 -0
- data/vendor/assets/javascripts/codemirror/modes/commonlisp.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/css.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/groovy.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +18 -76
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +5 -0
- data/vendor/assets/javascripts/codemirror/modes/kotlin.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/less_test.js +51 -0
- data/vendor/assets/javascripts/codemirror/modes/mllike.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/properties.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/python.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/sass.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/scheme.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/scss_test.js +110 -0
- data/vendor/assets/javascripts/codemirror/modes/smarty.js +100 -107
- data/vendor/assets/javascripts/codemirror/modes/stylus.js +651 -332
- data/vendor/assets/javascripts/codemirror/modes/test.js +67 -0
- data/vendor/assets/javascripts/codemirror/modes/troff.js +82 -0
- data/vendor/assets/javascripts/codemirror/modes/vb.js +6 -5
- data/vendor/assets/javascripts/codemirror/modes/verilog.js +53 -53
- data/vendor/assets/stylesheets/codemirror.css +11 -8
- data/vendor/assets/stylesheets/codemirror/themes/mdn-like.css +1 -1
- metadata +9 -3
- data/vendor/assets/javascripts/codemirror/modes/smartymixed.js +0 -197
@@ -403,7 +403,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
403
403
|
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
404
404
|
return "atom";
|
405
405
|
}
|
406
|
-
}
|
406
|
+
},
|
407
|
+
modeProps: {closeBrackets: {triples: '"'}}
|
407
408
|
});
|
408
409
|
|
409
410
|
def(["x-shader/x-vertex", "x-shader/x-fragment"], {
|
@@ -0,0 +1,97 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object")
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd)
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
CodeMirror.defineMode("cmake", function () {
|
15
|
+
var variable_regex = /({)?[a-zA-Z0-9_]+(})?/;
|
16
|
+
|
17
|
+
function tokenString(stream, state) {
|
18
|
+
var current, prev, found_var = false;
|
19
|
+
while (!stream.eol() && (current = stream.next()) != state.pending) {
|
20
|
+
if (current === '$' && prev != '\\' && state.pending == '"') {
|
21
|
+
found_var = true;
|
22
|
+
break;
|
23
|
+
}
|
24
|
+
prev = current;
|
25
|
+
}
|
26
|
+
if (found_var) {
|
27
|
+
stream.backUp(1);
|
28
|
+
}
|
29
|
+
if (current == state.pending) {
|
30
|
+
state.continueString = false;
|
31
|
+
} else {
|
32
|
+
state.continueString = true;
|
33
|
+
}
|
34
|
+
return "string";
|
35
|
+
}
|
36
|
+
|
37
|
+
function tokenize(stream, state) {
|
38
|
+
var ch = stream.next();
|
39
|
+
|
40
|
+
// Have we found a variable?
|
41
|
+
if (ch === '$') {
|
42
|
+
if (stream.match(variable_regex)) {
|
43
|
+
return 'variable-2';
|
44
|
+
}
|
45
|
+
return 'variable';
|
46
|
+
}
|
47
|
+
// Should we still be looking for the end of a string?
|
48
|
+
if (state.continueString) {
|
49
|
+
// If so, go through the loop again
|
50
|
+
stream.backUp(1);
|
51
|
+
return tokenString(stream, state);
|
52
|
+
}
|
53
|
+
// Do we just have a function on our hands?
|
54
|
+
// In 'cmake_minimum_required (VERSION 2.8.8)', 'cmake_minimum_required' is matched
|
55
|
+
if (stream.match(/(\s+)?\w+\(/) || stream.match(/(\s+)?\w+\ \(/)) {
|
56
|
+
stream.backUp(1);
|
57
|
+
return 'def';
|
58
|
+
}
|
59
|
+
if (ch == "#") {
|
60
|
+
stream.skipToEnd();
|
61
|
+
return "comment";
|
62
|
+
}
|
63
|
+
// Have we found a string?
|
64
|
+
if (ch == "'" || ch == '"') {
|
65
|
+
// Store the type (single or double)
|
66
|
+
state.pending = ch;
|
67
|
+
// Perform the looping function to find the end
|
68
|
+
return tokenString(stream, state);
|
69
|
+
}
|
70
|
+
if (ch == '(' || ch == ')') {
|
71
|
+
return 'bracket';
|
72
|
+
}
|
73
|
+
if (ch.match(/[0-9]/)) {
|
74
|
+
return 'number';
|
75
|
+
}
|
76
|
+
stream.eatWhile(/[\w-]/);
|
77
|
+
return null;
|
78
|
+
}
|
79
|
+
return {
|
80
|
+
startState: function () {
|
81
|
+
var state = {};
|
82
|
+
state.inDefinition = false;
|
83
|
+
state.inInclude = false;
|
84
|
+
state.continueString = false;
|
85
|
+
state.pending = false;
|
86
|
+
return state;
|
87
|
+
},
|
88
|
+
token: function (stream, state) {
|
89
|
+
if (stream.eatSpace()) return null;
|
90
|
+
return tokenize(stream, state);
|
91
|
+
}
|
92
|
+
};
|
93
|
+
});
|
94
|
+
|
95
|
+
CodeMirror.defineMIME("text/x-cmake", "cmake");
|
96
|
+
|
97
|
+
});
|
@@ -239,6 +239,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
|
239
239
|
if (type == "{" || type == "}") return popAndPass(type, stream, state);
|
240
240
|
if (type == ")") return popContext(state);
|
241
241
|
if (type == "(") return pushContext(state, stream, "parens");
|
242
|
+
if (type == "interpolation") return pushContext(state, stream, "interpolation");
|
242
243
|
if (type == "word") wordAsValue(stream);
|
243
244
|
return "parens";
|
244
245
|
};
|
@@ -3,84 +3,26 @@
|
|
3
3
|
|
4
4
|
(function(mod) {
|
5
5
|
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
-
mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed")
|
6
|
+
mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"),
|
7
|
+
require("../../addon/mode/multiplex"));
|
7
8
|
else if (typeof define == "function" && define.amd) // AMD
|
8
|
-
define(["../../lib/codemirror", "../htmlmixed/htmlmixed"
|
9
|
+
define(["../../lib/codemirror", "../htmlmixed/htmlmixed",
|
10
|
+
"../../addon/mode/multiplex"], mod);
|
9
11
|
else // Plain browser env
|
10
12
|
mod(CodeMirror);
|
11
13
|
})(function(CodeMirror) {
|
12
|
-
"use strict";
|
13
|
-
|
14
|
-
CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
state.token=scriptingDispatch;
|
27
|
-
return scriptingMode.token(stream, state.scriptState);
|
28
|
-
}
|
29
|
-
else
|
30
|
-
return htmlMixedMode.token(stream, state.htmlState);
|
31
|
-
}
|
32
|
-
|
33
|
-
//tokenizer when in scripting mode
|
34
|
-
function scriptingDispatch(stream, state) {
|
35
|
-
if (stream.match(scriptEndRegex, false)) {
|
36
|
-
state.token=htmlDispatch;
|
37
|
-
return htmlMixedMode.token(stream, state.htmlState);
|
38
|
-
}
|
39
|
-
else
|
40
|
-
return scriptingMode.token(stream, state.scriptState);
|
41
|
-
}
|
42
|
-
|
43
|
-
|
44
|
-
return {
|
45
|
-
startState: function() {
|
46
|
-
scriptingMode = scriptingMode || CodeMirror.getMode(config, parserConfig.scriptingModeSpec);
|
47
|
-
htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed");
|
48
|
-
return {
|
49
|
-
token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch,
|
50
|
-
htmlState : CodeMirror.startState(htmlMixedMode),
|
51
|
-
scriptState : CodeMirror.startState(scriptingMode)
|
52
|
-
};
|
53
|
-
},
|
54
|
-
|
55
|
-
token: function(stream, state) {
|
56
|
-
return state.token(stream, state);
|
57
|
-
},
|
58
|
-
|
59
|
-
indent: function(state, textAfter) {
|
60
|
-
if (state.token == htmlDispatch)
|
61
|
-
return htmlMixedMode.indent(state.htmlState, textAfter);
|
62
|
-
else if (scriptingMode.indent)
|
63
|
-
return scriptingMode.indent(state.scriptState, textAfter);
|
64
|
-
},
|
65
|
-
|
66
|
-
copyState: function(state) {
|
67
|
-
return {
|
68
|
-
token : state.token,
|
69
|
-
htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState),
|
70
|
-
scriptState : CodeMirror.copyState(scriptingMode, state.scriptState)
|
71
|
-
};
|
72
|
-
},
|
73
|
-
|
74
|
-
innerMode: function(state) {
|
75
|
-
if (state.token == scriptingDispatch) return {state: state.scriptState, mode: scriptingMode};
|
76
|
-
else return {state: state.htmlState, mode: htmlMixedMode};
|
77
|
-
}
|
78
|
-
};
|
79
|
-
}, "htmlmixed");
|
80
|
-
|
81
|
-
CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"});
|
82
|
-
CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
|
83
|
-
CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingModeSpec:"text/x-java"});
|
84
|
-
CodeMirror.defineMIME("application/x-erb", { name: "htmlembedded", scriptingModeSpec:"ruby"});
|
85
|
-
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
|
17
|
+
return CodeMirror.multiplexingMode(CodeMirror.getMode(config, "htmlmixed"), {
|
18
|
+
open: parserConfig.open || parserConfig.scriptStartRegex || "<%",
|
19
|
+
close: parserConfig.close || parserConfig.scriptEndRegex || "%>",
|
20
|
+
mode: CodeMirror.getMode(config, parserConfig.scriptingModeSpec)
|
21
|
+
});
|
22
|
+
}, "htmlmixed");
|
23
|
+
|
24
|
+
CodeMirror.defineMIME("application/x-ejs", {name: "htmlembedded", scriptingModeSpec:"javascript"});
|
25
|
+
CodeMirror.defineMIME("application/x-aspx", {name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
|
26
|
+
CodeMirror.defineMIME("application/x-jsp", {name: "htmlembedded", scriptingModeSpec:"text/x-java"});
|
27
|
+
CodeMirror.defineMIME("application/x-erb", {name: "htmlembedded", scriptingModeSpec:"ruby"});
|
86
28
|
});
|
@@ -549,6 +549,10 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
549
549
|
}
|
550
550
|
function classBody(type, value) {
|
551
551
|
if (type == "variable" || cx.style == "keyword") {
|
552
|
+
if (value == "static") {
|
553
|
+
cx.marked = "keyword";
|
554
|
+
return cont(classBody);
|
555
|
+
}
|
552
556
|
cx.marked = "property";
|
553
557
|
if (value == "get" || value == "set") return cont(classGetterSetter, functiondef, classBody);
|
554
558
|
return cont(functiondef, classBody);
|
@@ -669,6 +673,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
669
673
|
blockCommentEnd: jsonMode ? null : "*/",
|
670
674
|
lineComment: jsonMode ? null : "//",
|
671
675
|
fold: "brace",
|
676
|
+
closeBrackets: "()[]{}''\"\"``",
|
672
677
|
|
673
678
|
helperType: jsonMode ? "json" : "javascript",
|
674
679
|
jsonldMode: jsonldMode,
|
@@ -0,0 +1,51 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function() {
|
5
|
+
"use strict";
|
6
|
+
|
7
|
+
var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-less");
|
8
|
+
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "less"); }
|
9
|
+
|
10
|
+
MT("variable",
|
11
|
+
"[variable-2 @base]: [atom #f04615];",
|
12
|
+
"[qualifier .class] {",
|
13
|
+
" [property width]: [variable percentage]([number 0.5]); [comment // returns `50%`]",
|
14
|
+
" [property color]: [variable saturate]([variable-2 @base], [number 5%]);",
|
15
|
+
"}");
|
16
|
+
|
17
|
+
MT("amp",
|
18
|
+
"[qualifier .child], [qualifier .sibling] {",
|
19
|
+
" [qualifier .parent] [atom &] {",
|
20
|
+
" [property color]: [keyword black];",
|
21
|
+
" }",
|
22
|
+
" [atom &] + [atom &] {",
|
23
|
+
" [property color]: [keyword red];",
|
24
|
+
" }",
|
25
|
+
"}");
|
26
|
+
|
27
|
+
MT("mixin",
|
28
|
+
"[qualifier .mixin] ([variable dark]; [variable-2 @color]) {",
|
29
|
+
" [property color]: [variable darken]([variable-2 @color], [number 10%]);",
|
30
|
+
"}",
|
31
|
+
"[qualifier .mixin] ([variable light]; [variable-2 @color]) {",
|
32
|
+
" [property color]: [variable lighten]([variable-2 @color], [number 10%]);",
|
33
|
+
"}",
|
34
|
+
"[qualifier .mixin] ([variable-2 @_]; [variable-2 @color]) {",
|
35
|
+
" [property display]: [atom block];",
|
36
|
+
"}",
|
37
|
+
"[variable-2 @switch]: [variable light];",
|
38
|
+
"[qualifier .class] {",
|
39
|
+
" [qualifier .mixin]([variable-2 @switch]; [atom #888]);",
|
40
|
+
"}");
|
41
|
+
|
42
|
+
MT("nest",
|
43
|
+
"[qualifier .one] {",
|
44
|
+
" [def @media] ([property width]: [number 400px]) {",
|
45
|
+
" [property font-size]: [number 1.2em];",
|
46
|
+
" [def @media] [attribute print] [keyword and] [property color] {",
|
47
|
+
" [property color]: [keyword blue];",
|
48
|
+
" }",
|
49
|
+
" }",
|
50
|
+
"}");
|
51
|
+
})();
|
@@ -85,7 +85,7 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) {
|
|
85
85
|
}
|
86
86
|
stream.eatWhile(/\w/);
|
87
87
|
var cur = stream.current();
|
88
|
-
return words[cur]
|
88
|
+
return words.hasOwnProperty(cur) ? words[cur] : 'variable';
|
89
89
|
}
|
90
90
|
|
91
91
|
function tokenString(stream, state) {
|
@@ -51,7 +51,7 @@ CodeMirror.defineMode("properties", function() {
|
|
51
51
|
state.position = "quote";
|
52
52
|
return null;
|
53
53
|
} else if (ch === "\\" && state.position === "quote") {
|
54
|
-
if (stream.
|
54
|
+
if (stream.eol()) { // end of line?
|
55
55
|
// Multiline value
|
56
56
|
state.nextMultiline = true;
|
57
57
|
}
|
@@ -0,0 +1,110 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function() {
|
5
|
+
var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-scss");
|
6
|
+
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "scss"); }
|
7
|
+
|
8
|
+
MT('url_with_quotation',
|
9
|
+
"[tag foo] { [property background]:[atom url]([string test.jpg]) }");
|
10
|
+
|
11
|
+
MT('url_with_double_quotes',
|
12
|
+
"[tag foo] { [property background]:[atom url]([string \"test.jpg\"]) }");
|
13
|
+
|
14
|
+
MT('url_with_single_quotes',
|
15
|
+
"[tag foo] { [property background]:[atom url]([string \'test.jpg\']) }");
|
16
|
+
|
17
|
+
MT('string',
|
18
|
+
"[def @import] [string \"compass/css3\"]");
|
19
|
+
|
20
|
+
MT('important_keyword',
|
21
|
+
"[tag foo] { [property background]:[atom url]([string \'test.jpg\']) [keyword !important] }");
|
22
|
+
|
23
|
+
MT('variable',
|
24
|
+
"[variable-2 $blue]:[atom #333]");
|
25
|
+
|
26
|
+
MT('variable_as_attribute',
|
27
|
+
"[tag foo] { [property color]:[variable-2 $blue] }");
|
28
|
+
|
29
|
+
MT('numbers',
|
30
|
+
"[tag foo] { [property padding]:[number 10px] [number 10] [number 10em] [number 8in] }");
|
31
|
+
|
32
|
+
MT('number_percentage',
|
33
|
+
"[tag foo] { [property width]:[number 80%] }");
|
34
|
+
|
35
|
+
MT('selector',
|
36
|
+
"[builtin #hello][qualifier .world]{}");
|
37
|
+
|
38
|
+
MT('singleline_comment',
|
39
|
+
"[comment // this is a comment]");
|
40
|
+
|
41
|
+
MT('multiline_comment',
|
42
|
+
"[comment /*foobar*/]");
|
43
|
+
|
44
|
+
MT('attribute_with_hyphen',
|
45
|
+
"[tag foo] { [property font-size]:[number 10px] }");
|
46
|
+
|
47
|
+
MT('string_after_attribute',
|
48
|
+
"[tag foo] { [property content]:[string \"::\"] }");
|
49
|
+
|
50
|
+
MT('directives',
|
51
|
+
"[def @include] [qualifier .mixin]");
|
52
|
+
|
53
|
+
MT('basic_structure',
|
54
|
+
"[tag p] { [property background]:[keyword red]; }");
|
55
|
+
|
56
|
+
MT('nested_structure',
|
57
|
+
"[tag p] { [tag a] { [property color]:[keyword red]; } }");
|
58
|
+
|
59
|
+
MT('mixin',
|
60
|
+
"[def @mixin] [tag table-base] {}");
|
61
|
+
|
62
|
+
MT('number_without_semicolon',
|
63
|
+
"[tag p] {[property width]:[number 12]}",
|
64
|
+
"[tag a] {[property color]:[keyword red];}");
|
65
|
+
|
66
|
+
MT('atom_in_nested_block',
|
67
|
+
"[tag p] { [tag a] { [property color]:[atom #000]; } }");
|
68
|
+
|
69
|
+
MT('interpolation_in_property',
|
70
|
+
"[tag foo] { #{[variable-2 $hello]}:[number 2]; }");
|
71
|
+
|
72
|
+
MT('interpolation_in_selector',
|
73
|
+
"[tag foo]#{[variable-2 $hello]} { [property color]:[atom #000]; }");
|
74
|
+
|
75
|
+
MT('interpolation_error',
|
76
|
+
"[tag foo]#{[error foo]} { [property color]:[atom #000]; }");
|
77
|
+
|
78
|
+
MT("divide_operator",
|
79
|
+
"[tag foo] { [property width]:[number 4] [operator /] [number 2] }");
|
80
|
+
|
81
|
+
MT('nested_structure_with_id_selector',
|
82
|
+
"[tag p] { [builtin #hello] { [property color]:[keyword red]; } }");
|
83
|
+
|
84
|
+
MT('indent_mixin',
|
85
|
+
"[def @mixin] [tag container] (",
|
86
|
+
" [variable-2 $a]: [number 10],",
|
87
|
+
" [variable-2 $b]: [number 10])",
|
88
|
+
"{}");
|
89
|
+
|
90
|
+
MT('indent_nested',
|
91
|
+
"[tag foo] {",
|
92
|
+
" [tag bar] {",
|
93
|
+
" }",
|
94
|
+
"}");
|
95
|
+
|
96
|
+
MT('indent_parentheses',
|
97
|
+
"[tag foo] {",
|
98
|
+
" [property color]: [variable darken]([variable-2 $blue],",
|
99
|
+
" [number 9%]);",
|
100
|
+
"}");
|
101
|
+
|
102
|
+
MT('indent_vardef',
|
103
|
+
"[variable-2 $name]:",
|
104
|
+
" [string 'val'];",
|
105
|
+
"[tag tag] {",
|
106
|
+
" [tag inner] {",
|
107
|
+
" [property margin]: [number 3px];",
|
108
|
+
" }",
|
109
|
+
"}");
|
110
|
+
})();
|