codemirror-rails 5.6 → 5.7
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 +30 -17
- data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +3 -1
- data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +10 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +21 -3
- data/vendor/assets/javascripts/codemirror/addons/search/search.js +29 -14
- data/vendor/assets/javascripts/codemirror/keymaps/sublime.js +11 -3
- data/vendor/assets/javascripts/codemirror/modes/clike.js +15 -0
- data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +14 -17
- data/vendor/assets/javascripts/codemirror/modes/css.js +66 -15
- data/vendor/assets/javascripts/codemirror/modes/elm.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/gfm.js +23 -17
- data/vendor/assets/javascripts/codemirror/modes/haxe.js +68 -80
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +125 -96
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +14 -5
- data/vendor/assets/javascripts/codemirror/modes/markdown.js +40 -29
- data/vendor/assets/javascripts/codemirror/modes/mscgen.js +169 -0
- data/vendor/assets/javascripts/codemirror/modes/oz.js +252 -0
- data/vendor/assets/javascripts/codemirror/modes/php.js +6 -3
- data/vendor/assets/javascripts/codemirror/modes/ruby.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/vhdl.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/vue.js +69 -0
- data/vendor/assets/stylesheets/codemirror/themes/icecoder.css +1 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5b46bf2cc4d84c5328446d21e4413549fd7c9ac
|
4
|
+
data.tar.gz: 88eb7a4719bf7581129e309f5c95878abd1e2938
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ae50e29d8a8dd42eb29b620cf3a24634051bdff92b18ef65d4b7b3c2806f1e1cf6f87bced7b7564af06f96acd18b7964f35b3929825052d8467cffa24bfb48f
|
7
|
+
data.tar.gz: 3edf6831421146808b87717e34636a3bfa5d468cf90393802a853205368057e2417fa29d8c336dabedee41aa24b65ed0eb1ba3fca22bc9e0864667b67ce8e0bc
|
@@ -1285,6 +1285,7 @@
|
|
1285
1285
|
|
1286
1286
|
on(te, "compositionstart", function() {
|
1287
1287
|
var start = cm.getCursor("from");
|
1288
|
+
if (input.composing) input.composing.range.clear()
|
1288
1289
|
input.composing = {
|
1289
1290
|
start: start,
|
1290
1291
|
range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
|
@@ -1533,6 +1534,10 @@
|
|
1533
1534
|
}
|
1534
1535
|
},
|
1535
1536
|
|
1537
|
+
readOnlyChanged: function(val) {
|
1538
|
+
if (!val) this.reset();
|
1539
|
+
},
|
1540
|
+
|
1536
1541
|
setUneditable: nothing,
|
1537
1542
|
|
1538
1543
|
needsContentAttribute: false
|
@@ -1551,7 +1556,6 @@
|
|
1551
1556
|
init: function(display) {
|
1552
1557
|
var input = this, cm = input.cm;
|
1553
1558
|
var div = input.div = display.lineDiv;
|
1554
|
-
div.contentEditable = "true";
|
1555
1559
|
disableBrowserMagic(div);
|
1556
1560
|
|
1557
1561
|
on(div, "paste", function(e) { handlePaste(e, cm); })
|
@@ -1592,7 +1596,7 @@
|
|
1592
1596
|
|
1593
1597
|
on(div, "input", function() {
|
1594
1598
|
if (input.composing) return;
|
1595
|
-
if (!input.pollContent())
|
1599
|
+
if (isReadOnly(cm) || !input.pollContent())
|
1596
1600
|
runInOp(input.cm, function() {regChange(cm);});
|
1597
1601
|
});
|
1598
1602
|
|
@@ -1817,17 +1821,24 @@
|
|
1817
1821
|
this.div.focus();
|
1818
1822
|
},
|
1819
1823
|
applyComposition: function(composing) {
|
1820
|
-
if (
|
1824
|
+
if (isReadOnly(this.cm))
|
1825
|
+
operation(this.cm, regChange)(this.cm)
|
1826
|
+
else if (composing.data && composing.data != composing.startData)
|
1821
1827
|
operation(this.cm, applyTextInput)(this.cm, composing.data, 0, composing.sel);
|
1822
1828
|
},
|
1823
1829
|
|
1824
1830
|
setUneditable: function(node) {
|
1825
|
-
node.
|
1831
|
+
node.contentEditable = "false"
|
1826
1832
|
},
|
1827
1833
|
|
1828
1834
|
onKeyPress: function(e) {
|
1829
1835
|
e.preventDefault();
|
1830
|
-
|
1836
|
+
if (!isReadOnly(this.cm))
|
1837
|
+
operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0);
|
1838
|
+
},
|
1839
|
+
|
1840
|
+
readOnlyChanged: function(val) {
|
1841
|
+
this.div.contentEditable = String(val != "nocursor")
|
1831
1842
|
},
|
1832
1843
|
|
1833
1844
|
onContextMenu: nothing,
|
@@ -5388,8 +5399,8 @@
|
|
5388
5399
|
cm.display.disabled = true;
|
5389
5400
|
} else {
|
5390
5401
|
cm.display.disabled = false;
|
5391
|
-
if (!val) cm.display.input.reset();
|
5392
5402
|
}
|
5403
|
+
cm.display.input.readOnlyChanged(val)
|
5393
5404
|
});
|
5394
5405
|
option("disableInput", false, function(cm, val) {if (!val) cm.display.input.reset();}, true);
|
5395
5406
|
option("dragDrop", true, dragDropChanged);
|
@@ -6952,7 +6963,7 @@
|
|
6952
6963
|
txt.setAttribute("cm-text", "\t");
|
6953
6964
|
builder.col += tabWidth;
|
6954
6965
|
} else if (m[0] == "\r" || m[0] == "\n") {
|
6955
|
-
var txt = content.appendChild(elt("span", m[0] == "\r" ? "
|
6966
|
+
var txt = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
|
6956
6967
|
txt.setAttribute("cm-text", m[0]);
|
6957
6968
|
builder.col += 1;
|
6958
6969
|
} else {
|
@@ -8211,7 +8222,7 @@
|
|
8211
8222
|
|
8212
8223
|
// The inverse of countColumn -- find the offset that corresponds to
|
8213
8224
|
// a particular column.
|
8214
|
-
|
8225
|
+
var findColumn = CodeMirror.findColumn = function(string, goal, tabSize) {
|
8215
8226
|
for (var pos = 0, col = 0;;) {
|
8216
8227
|
var nextTab = string.indexOf("\t", pos);
|
8217
8228
|
if (nextTab == -1) nextTab = string.length;
|
@@ -8504,14 +8515,16 @@
|
|
8504
8515
|
|
8505
8516
|
// KEY NAMES
|
8506
8517
|
|
8507
|
-
var keyNames =
|
8508
|
-
|
8509
|
-
|
8510
|
-
|
8511
|
-
|
8512
|
-
|
8513
|
-
|
8514
|
-
|
8518
|
+
var keyNames = CodeMirror.keyNames = {
|
8519
|
+
3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
|
8520
|
+
19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
|
8521
|
+
36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
|
8522
|
+
46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
|
8523
|
+
106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete",
|
8524
|
+
173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
|
8525
|
+
221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
|
8526
|
+
63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
|
8527
|
+
};
|
8515
8528
|
(function() {
|
8516
8529
|
// Number keys
|
8517
8530
|
for (var i = 0; i < 10; i++) keyNames[i + 48] = keyNames[i + 96] = String(i);
|
@@ -8816,7 +8829,7 @@
|
|
8816
8829
|
|
8817
8830
|
// THE END
|
8818
8831
|
|
8819
|
-
CodeMirror.version = "5.
|
8832
|
+
CodeMirror.version = "5.7.0";
|
8820
8833
|
|
8821
8834
|
return CodeMirror;
|
8822
8835
|
});
|
@@ -37,7 +37,9 @@
|
|
37
37
|
var elt = cm.state.placeholder = document.createElement("pre");
|
38
38
|
elt.style.cssText = "height: 0; overflow: visible";
|
39
39
|
elt.className = "CodeMirror-placeholder";
|
40
|
-
|
40
|
+
var placeHolder = cm.getOption("placeholder")
|
41
|
+
if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder)
|
42
|
+
elt.appendChild(placeHolder)
|
41
43
|
cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);
|
42
44
|
}
|
43
45
|
|
@@ -90,6 +90,12 @@
|
|
90
90
|
});
|
91
91
|
}
|
92
92
|
|
93
|
+
function contractSelection(sel) {
|
94
|
+
var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0;
|
95
|
+
return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)),
|
96
|
+
head: new Pos(sel.head.line, sel.head.ch + (inverted ? 1 : -1))};
|
97
|
+
}
|
98
|
+
|
93
99
|
function handleChar(cm, ch) {
|
94
100
|
var conf = getConfig(cm);
|
95
101
|
if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
|
@@ -145,6 +151,10 @@
|
|
145
151
|
for (var i = 0; i < sels.length; i++)
|
146
152
|
sels[i] = left + sels[i] + right;
|
147
153
|
cm.replaceSelections(sels, "around");
|
154
|
+
sels = cm.listSelections().slice();
|
155
|
+
for (var i = 0; i < sels.length; i++)
|
156
|
+
sels[i] = contractSelection(sels[i]);
|
157
|
+
cm.setSelections(sels);
|
148
158
|
} else if (type == "both") {
|
149
159
|
cm.replaceSelection(left + right, null);
|
150
160
|
cm.triggerElectric(left + right);
|
@@ -61,6 +61,7 @@
|
|
61
61
|
this.timeout = null;
|
62
62
|
this.hasGutter = hasGutter;
|
63
63
|
this.onMouseOver = function(e) { onMouseOver(cm, e); };
|
64
|
+
this.waitingFor = 0
|
64
65
|
}
|
65
66
|
|
66
67
|
function parseOptions(_cm, options) {
|
@@ -115,15 +116,32 @@
|
|
115
116
|
return tip;
|
116
117
|
}
|
117
118
|
|
119
|
+
function lintAsync(cm, getAnnotations, passOptions) {
|
120
|
+
var state = cm.state.lint
|
121
|
+
var id = ++state.waitingFor
|
122
|
+
function abort() {
|
123
|
+
id = -1
|
124
|
+
cm.off("change", abort)
|
125
|
+
}
|
126
|
+
cm.on("change", abort)
|
127
|
+
getAnnotations(cm.getValue(), function(annotations, arg2) {
|
128
|
+
cm.off("change", abort)
|
129
|
+
if (state.waitingFor != id) return
|
130
|
+
if (arg2 && annotations instanceof CodeMirror) annotations = arg2
|
131
|
+
updateLinting(cm, annotations)
|
132
|
+
}, passOptions, cm);
|
133
|
+
}
|
134
|
+
|
118
135
|
function startLinting(cm) {
|
119
136
|
var state = cm.state.lint, options = state.options;
|
120
137
|
var passOptions = options.options || options; // Support deprecated passing of `options` property in options
|
121
138
|
var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint");
|
122
139
|
if (!getAnnotations) return;
|
123
|
-
if (options.async || getAnnotations.async)
|
124
|
-
|
125
|
-
else
|
140
|
+
if (options.async || getAnnotations.async) {
|
141
|
+
lintAsync(cm, getAnnotations, passOptions)
|
142
|
+
} else {
|
126
143
|
updateLinting(cm, getAnnotations(cm.getValue(), passOptions, cm));
|
144
|
+
}
|
127
145
|
}
|
128
146
|
|
129
147
|
function updateLinting(cm, annotationsNotSorted) {
|
@@ -117,11 +117,19 @@
|
|
117
117
|
if (state.query) return findNext(cm, rev);
|
118
118
|
var q = cm.getSelection() || state.lastQuery;
|
119
119
|
if (persistent && cm.openDialog) {
|
120
|
+
var hiding = null
|
120
121
|
persistentDialog(cm, queryDialog, q, function(query, event) {
|
121
122
|
CodeMirror.e_stop(event);
|
122
123
|
if (!query) return;
|
123
124
|
if (query != state.queryText) startSearch(cm, state, query);
|
124
|
-
|
125
|
+
if (hiding) hiding.style.opacity = 1
|
126
|
+
findNext(cm, event.shiftKey, function(_, to) {
|
127
|
+
var dialog
|
128
|
+
if (to.line < 3 && document.querySelector &&
|
129
|
+
(dialog = cm.display.wrapper.querySelector(".CodeMirror-dialog")) &&
|
130
|
+
dialog.getBoundingClientRect().bottom - 4 > cm.cursorCoords(to, "window").top)
|
131
|
+
(hiding = dialog).style.opacity = .4
|
132
|
+
})
|
125
133
|
});
|
126
134
|
} else {
|
127
135
|
dialog(cm, queryDialog, "Search for:", q, function(query) {
|
@@ -134,7 +142,7 @@
|
|
134
142
|
}
|
135
143
|
}
|
136
144
|
|
137
|
-
function findNext(cm, rev) {cm.operation(function() {
|
145
|
+
function findNext(cm, rev, callback) {cm.operation(function() {
|
138
146
|
var state = getSearchState(cm);
|
139
147
|
var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
|
140
148
|
if (!cursor.find(rev)) {
|
@@ -144,6 +152,7 @@
|
|
144
152
|
cm.setSelection(cursor.from(), cursor.to());
|
145
153
|
cm.scrollIntoView({from: cursor.from(), to: cursor.to()}, 20);
|
146
154
|
state.posFrom = cursor.from(); state.posTo = cursor.to();
|
155
|
+
if (callback) callback(cursor.from(), cursor.to())
|
147
156
|
});}
|
148
157
|
|
149
158
|
function clearSearch(cm) {cm.operation(function() {
|
@@ -156,27 +165,32 @@
|
|
156
165
|
});}
|
157
166
|
|
158
167
|
var replaceQueryDialog =
|
159
|
-
'
|
168
|
+
' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>';
|
160
169
|
var replacementQueryDialog = 'With: <input type="text" style="width: 10em" class="CodeMirror-search-field"/>';
|
161
|
-
var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";
|
170
|
+
var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>All</button> <button>Stop</button>";
|
171
|
+
|
172
|
+
function replaceAll(cm, query, text) {
|
173
|
+
cm.operation(function() {
|
174
|
+
for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
|
175
|
+
if (typeof query != "string") {
|
176
|
+
var match = cm.getRange(cursor.from(), cursor.to()).match(query);
|
177
|
+
cursor.replace(text.replace(/\$(\d)/g, function(_, i) {return match[i];}));
|
178
|
+
} else cursor.replace(text);
|
179
|
+
}
|
180
|
+
});
|
181
|
+
}
|
162
182
|
|
163
183
|
function replace(cm, all) {
|
164
184
|
if (cm.getOption("readOnly")) return;
|
165
185
|
var query = cm.getSelection() || getSearchState(cm).lastQuery;
|
166
|
-
|
186
|
+
var dialogText = all ? "Replace all:" : "Replace:"
|
187
|
+
dialog(cm, dialogText + replaceQueryDialog, dialogText, query, function(query) {
|
167
188
|
if (!query) return;
|
168
189
|
query = parseQuery(query);
|
169
190
|
dialog(cm, replacementQueryDialog, "Replace with:", "", function(text) {
|
170
191
|
text = parseString(text)
|
171
192
|
if (all) {
|
172
|
-
cm
|
173
|
-
for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
|
174
|
-
if (typeof query != "string") {
|
175
|
-
var match = cm.getRange(cursor.from(), cursor.to()).match(query);
|
176
|
-
cursor.replace(text.replace(/\$(\d)/g, function(_, i) {return match[i];}));
|
177
|
-
} else cursor.replace(text);
|
178
|
-
}
|
179
|
-
});
|
193
|
+
replaceAll(cm, query, text)
|
180
194
|
} else {
|
181
195
|
clearSearch(cm);
|
182
196
|
var cursor = getSearchCursor(cm, query, cm.getCursor());
|
@@ -190,7 +204,8 @@
|
|
190
204
|
cm.setSelection(cursor.from(), cursor.to());
|
191
205
|
cm.scrollIntoView({from: cursor.from(), to: cursor.to()});
|
192
206
|
confirmDialog(cm, doReplaceConfirm, "Replace?",
|
193
|
-
[function() {doReplace(match);}, advance
|
207
|
+
[function() {doReplace(match);}, advance,
|
208
|
+
function() {replaceAll(cm, query, text)}]);
|
194
209
|
};
|
195
210
|
var doReplace = function(match) {
|
196
211
|
cursor.replace(typeof query == "string" ? text :
|
@@ -417,11 +417,19 @@
|
|
417
417
|
var cursor = cm.getCursor();
|
418
418
|
var toStartOfLine = cm.getRange({line: cursor.line, ch: 0}, cursor);
|
419
419
|
var column = CodeMirror.countColumn(toStartOfLine, null, cm.getOption("tabSize"));
|
420
|
+
var indentUnit = cm.getOption("indentUnit");
|
420
421
|
|
421
|
-
if (toStartOfLine && !/\S/.test(toStartOfLine) && column %
|
422
|
-
|
423
|
-
|
422
|
+
if (toStartOfLine && !/\S/.test(toStartOfLine) && column % indentUnit == 0) {
|
423
|
+
var prevIndent = new Pos(cursor.line,
|
424
|
+
CodeMirror.findColumn(toStartOfLine, column - indentUnit, indentUnit));
|
425
|
+
|
426
|
+
// If no smart delete is happening (due to tab sizing) just do a regular delete
|
427
|
+
if (prevIndent.ch == cursor.ch) return CodeMirror.Pass;
|
428
|
+
|
429
|
+
return cm.replaceRange("", prevIndent, cursor, "+delete");
|
430
|
+
} else {
|
424
431
|
return CodeMirror.Pass;
|
432
|
+
}
|
425
433
|
};
|
426
434
|
|
427
435
|
cmds[map[cK + ctrl + "K"] = "delLineRight"] = function(cm) {
|
@@ -266,6 +266,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
266
266
|
return false;
|
267
267
|
}
|
268
268
|
|
269
|
+
function cpp14Literal(stream) {
|
270
|
+
stream.eatWhile(/[\w\.']/);
|
271
|
+
return "number";
|
272
|
+
}
|
273
|
+
|
269
274
|
function cpp11StringHook(stream, state) {
|
270
275
|
stream.backUp(1);
|
271
276
|
// Raw strings.
|
@@ -373,6 +378,16 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
373
378
|
"U": cpp11StringHook,
|
374
379
|
"L": cpp11StringHook,
|
375
380
|
"R": cpp11StringHook,
|
381
|
+
"0": cpp14Literal,
|
382
|
+
"1": cpp14Literal,
|
383
|
+
"2": cpp14Literal,
|
384
|
+
"3": cpp14Literal,
|
385
|
+
"4": cpp14Literal,
|
386
|
+
"5": cpp14Literal,
|
387
|
+
"6": cpp14Literal,
|
388
|
+
"7": cpp14Literal,
|
389
|
+
"8": cpp14Literal,
|
390
|
+
"9": cpp14Literal,
|
376
391
|
token: function(stream, state, style) {
|
377
392
|
if (style == "variable" && stream.peek() == "(" &&
|
378
393
|
(state.prevToken == ";" || state.prevToken == null ||
|
@@ -25,7 +25,7 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|
25
25
|
var operators = /^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/;
|
26
26
|
var delimiters = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/;
|
27
27
|
var identifiers = /^[_A-Za-z$][_A-Za-z$0-9]*/;
|
28
|
-
var
|
28
|
+
var atProp = /^@[_A-Za-z$][_A-Za-z$0-9]*/;
|
29
29
|
|
30
30
|
var wordOperators = wordRegexp(["and", "or", "not",
|
31
31
|
"is", "isnt", "in",
|
@@ -145,6 +145,8 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|
145
145
|
}
|
146
146
|
}
|
147
147
|
|
148
|
+
|
149
|
+
|
148
150
|
// Handle operators and delimiters
|
149
151
|
if (stream.match(operators) || stream.match(wordOperators)) {
|
150
152
|
return "operator";
|
@@ -157,6 +159,10 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|
157
159
|
return "atom";
|
158
160
|
}
|
159
161
|
|
162
|
+
if (stream.match(atProp) || state.prop && stream.match(identifiers)) {
|
163
|
+
return "property";
|
164
|
+
}
|
165
|
+
|
160
166
|
if (stream.match(keywords)) {
|
161
167
|
return "keyword";
|
162
168
|
}
|
@@ -165,10 +171,6 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|
165
171
|
return "variable";
|
166
172
|
}
|
167
173
|
|
168
|
-
if (stream.match(properties)) {
|
169
|
-
return "property";
|
170
|
-
}
|
171
|
-
|
172
174
|
// Handle non-detected items
|
173
175
|
stream.next();
|
174
176
|
return ERRORCLASS;
|
@@ -266,7 +268,7 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|
266
268
|
var current = stream.current();
|
267
269
|
|
268
270
|
// Handle "." connected identifiers
|
269
|
-
if (current === ".") {
|
271
|
+
if (false && current === ".") {
|
270
272
|
style = state.tokenize(stream, state);
|
271
273
|
current = stream.current();
|
272
274
|
if (/^\.[\w$]+$/.test(current)) {
|
@@ -280,9 +282,7 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|
280
282
|
if (current === "return") {
|
281
283
|
state.dedent = true;
|
282
284
|
}
|
283
|
-
if (((current === "->" || current === "=>") &&
|
284
|
-
!state.lambda &&
|
285
|
-
!stream.peek())
|
285
|
+
if (((current === "->" || current === "=>") && stream.eol())
|
286
286
|
|| style === "indent") {
|
287
287
|
indent(stream, state);
|
288
288
|
}
|
@@ -324,8 +324,7 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|
324
324
|
return {
|
325
325
|
tokenize: tokenBase,
|
326
326
|
scope: {offset:basecolumn || 0, type:"coffee", prev: null, align: false},
|
327
|
-
|
328
|
-
lambda: false,
|
327
|
+
prop: false,
|
329
328
|
dedent: 0
|
330
329
|
};
|
331
330
|
},
|
@@ -335,12 +334,9 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|
335
334
|
if (fillAlign && stream.sol()) fillAlign.align = false;
|
336
335
|
|
337
336
|
var style = tokenLexer(stream, state);
|
338
|
-
if (
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
if (stream.eol() && stream.lambda) {
|
343
|
-
state.lambda = false;
|
337
|
+
if (style && style != "comment") {
|
338
|
+
if (fillAlign) fillAlign.align = true;
|
339
|
+
state.prop = style == "punctuation" && stream.current() == "."
|
344
340
|
}
|
345
341
|
|
346
342
|
return style;
|
@@ -365,5 +361,6 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|
365
361
|
});
|
366
362
|
|
367
363
|
CodeMirror.defineMIME("text/x-coffeescript", "coffeescript");
|
364
|
+
CodeMirror.defineMIME("text/coffeescript", "coffeescript");
|
368
365
|
|
369
366
|
});
|