CodeMirror 5.32
This commit is contained in:
parent
15c5df0e6e
commit
08fab9559c
4
vendor/codemirror/addon/comment/comment.js
vendored
4
vendor/codemirror/addon/comment/comment.js
vendored
|
@ -172,10 +172,6 @@
|
||||||
if (open == -1) return false
|
if (open == -1) return false
|
||||||
var endLine = end == start ? startLine : self.getLine(end)
|
var endLine = end == start ? startLine : self.getLine(end)
|
||||||
var close = endLine.indexOf(endString, end == start ? open + startString.length : 0);
|
var close = endLine.indexOf(endString, end == start ? open + startString.length : 0);
|
||||||
if (close == -1 && start != end) {
|
|
||||||
endLine = self.getLine(--end);
|
|
||||||
close = endLine.indexOf(endString);
|
|
||||||
}
|
|
||||||
var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
|
var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
|
||||||
if (close == -1 ||
|
if (close == -1 ||
|
||||||
!/comment/.test(self.getTokenTypeAt(insideStart)) ||
|
!/comment/.test(self.getTokenTypeAt(insideStart)) ||
|
||||||
|
|
19
vendor/codemirror/addon/edit/closebrackets.js
vendored
19
vendor/codemirror/addon/edit/closebrackets.js
vendored
|
@ -133,7 +133,8 @@
|
||||||
(cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != ch)) {
|
(cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != ch)) {
|
||||||
curType = "addFour";
|
curType = "addFour";
|
||||||
} else if (identical) {
|
} else if (identical) {
|
||||||
if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, ch)) curType = "both";
|
var prev = cur.ch == 0 ? " " : cm.getRange(Pos(cur.line, cur.ch - 1), cur)
|
||||||
|
if (!CodeMirror.isWordChar(next) && prev != ch && !CodeMirror.isWordChar(prev)) curType = "both";
|
||||||
else return CodeMirror.Pass;
|
else return CodeMirror.Pass;
|
||||||
} else if (opening && (cm.getLine(cur.line).length == cur.ch ||
|
} else if (opening && (cm.getLine(cur.line).length == cur.ch ||
|
||||||
isClosingBracket(next, pairs) ||
|
isClosingBracket(next, pairs) ||
|
||||||
|
@ -185,22 +186,6 @@
|
||||||
return str.length == 2 ? str : null;
|
return str.length == 2 ? str : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Project the token type that will exists after the given char is
|
|
||||||
// typed, and use it to determine whether it would cause the start
|
|
||||||
// of a string token.
|
|
||||||
function enteringString(cm, pos, ch) {
|
|
||||||
var line = cm.getLine(pos.line);
|
|
||||||
var token = cm.getTokenAt(pos);
|
|
||||||
if (/\bstring2?\b/.test(token.type) || stringStartsAfter(cm, pos)) return false;
|
|
||||||
var stream = new CodeMirror.StringStream(line.slice(0, pos.ch) + ch + line.slice(pos.ch), 4);
|
|
||||||
stream.pos = stream.start = token.start;
|
|
||||||
for (;;) {
|
|
||||||
var type1 = cm.getMode().token(stream, token.state);
|
|
||||||
if (stream.pos >= pos.ch + 1) return /\bstring2?\b/.test(type1);
|
|
||||||
stream.start = stream.pos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function stringStartsAfter(cm, pos) {
|
function stringStartsAfter(cm, pos) {
|
||||||
var token = cm.getTokenAt(Pos(pos.line, pos.ch + 1))
|
var token = cm.getTokenAt(Pos(pos.line, pos.ch + 1))
|
||||||
return /\bstring/.test(token.type) && token.start == pos.ch &&
|
return /\bstring/.test(token.type) && token.start == pos.ch &&
|
||||||
|
|
6
vendor/codemirror/addon/hint/show-hint.js
vendored
6
vendor/codemirror/addon/hint/show-hint.js
vendored
|
@ -121,7 +121,6 @@
|
||||||
var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
|
var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
|
||||||
if (this.widget) this.widget.close();
|
if (this.widget) this.widget.close();
|
||||||
|
|
||||||
if (data && this.data && isNewCompletion(this.data, data)) return;
|
|
||||||
this.data = data;
|
this.data = data;
|
||||||
|
|
||||||
if (data && data.list.length) {
|
if (data && data.list.length) {
|
||||||
|
@ -135,11 +134,6 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function isNewCompletion(old, nw) {
|
|
||||||
var moved = CodeMirror.cmpPos(nw.from, old.from)
|
|
||||||
return moved > 0 && old.to.ch - old.from.ch != nw.to.ch - nw.from.ch
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseOptions(cm, pos, options) {
|
function parseOptions(cm, pos, options) {
|
||||||
var editor = cm.options.hintOptions;
|
var editor = cm.options.hintOptions;
|
||||||
var out = {};
|
var out = {};
|
||||||
|
|
|
@ -159,7 +159,7 @@
|
||||||
for (var i = 1; i < lines.length - 1; i++)
|
for (var i = 1; i < lines.length - 1; i++)
|
||||||
if (fold(doc.getLine(line + i)) != lines[i]) continue search
|
if (fold(doc.getLine(line + i)) != lines[i]) continue search
|
||||||
var end = doc.getLine(line + lines.length - 1), endString = fold(end), lastLine = lines[lines.length - 1]
|
var end = doc.getLine(line + lines.length - 1), endString = fold(end), lastLine = lines[lines.length - 1]
|
||||||
if (end.slice(0, lastLine.length) != lastLine) continue search
|
if (endString.slice(0, lastLine.length) != lastLine) continue search
|
||||||
return {from: Pos(line, adjustPos(orig, string, cutFrom, fold) + ch),
|
return {from: Pos(line, adjustPos(orig, string, cutFrom, fold) + ch),
|
||||||
to: Pos(line + lines.length - 1, adjustPos(end, endString, lastLine.length, fold))}
|
to: Pos(line + lines.length - 1, adjustPos(end, endString, lastLine.length, fold))}
|
||||||
}
|
}
|
||||||
|
|
42
vendor/codemirror/keymap/emacs.js
vendored
42
vendor/codemirror/keymap/emacs.js
vendored
|
@ -30,16 +30,16 @@
|
||||||
|
|
||||||
var lastKill = null;
|
var lastKill = null;
|
||||||
|
|
||||||
function kill(cm, from, to, mayGrow, text) {
|
function kill(cm, from, to, ring, text) {
|
||||||
if (text == null) text = cm.getRange(from, to);
|
if (text == null) text = cm.getRange(from, to);
|
||||||
|
|
||||||
if (mayGrow && lastKill && lastKill.cm == cm && posEq(from, lastKill.pos) && cm.isClean(lastKill.gen))
|
if (ring == "grow" && lastKill && lastKill.cm == cm && posEq(from, lastKill.pos) && cm.isClean(lastKill.gen))
|
||||||
growRingTop(text);
|
growRingTop(text);
|
||||||
else
|
else if (ring !== false)
|
||||||
addToRing(text);
|
addToRing(text);
|
||||||
cm.replaceRange("", from, to, "+delete");
|
cm.replaceRange("", from, to, "+delete");
|
||||||
|
|
||||||
if (mayGrow) lastKill = {cm: cm, pos: from, gen: cm.changeGeneration()};
|
if (ring == "grow") lastKill = {cm: cm, pos: from, gen: cm.changeGeneration()};
|
||||||
else lastKill = null;
|
else lastKill = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,22 +151,22 @@
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
function killTo(cm, by, dir) {
|
function killTo(cm, by, dir, ring) {
|
||||||
var selections = cm.listSelections(), cursor;
|
var selections = cm.listSelections(), cursor;
|
||||||
var i = selections.length;
|
var i = selections.length;
|
||||||
while (i--) {
|
while (i--) {
|
||||||
cursor = selections[i].head;
|
cursor = selections[i].head;
|
||||||
kill(cm, cursor, findEnd(cm, cursor, by, dir), true);
|
kill(cm, cursor, findEnd(cm, cursor, by, dir), ring);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function killRegion(cm) {
|
function killRegion(cm, ring) {
|
||||||
if (cm.somethingSelected()) {
|
if (cm.somethingSelected()) {
|
||||||
var selections = cm.listSelections(), selection;
|
var selections = cm.listSelections(), selection;
|
||||||
var i = selections.length;
|
var i = selections.length;
|
||||||
while (i--) {
|
while (i--) {
|
||||||
selection = selections[i];
|
selection = selections[i];
|
||||||
kill(cm, selection.anchor, selection.head);
|
kill(cm, selection.anchor, selection.head, ring);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@
|
||||||
// Actual keymap
|
// Actual keymap
|
||||||
|
|
||||||
var keyMap = CodeMirror.keyMap.emacs = CodeMirror.normalizeKeyMap({
|
var keyMap = CodeMirror.keyMap.emacs = CodeMirror.normalizeKeyMap({
|
||||||
"Ctrl-W": function(cm) {kill(cm, cm.getCursor("start"), cm.getCursor("end"));},
|
"Ctrl-W": function(cm) {kill(cm, cm.getCursor("start"), cm.getCursor("end"), true);},
|
||||||
"Ctrl-K": repeated(function(cm) {
|
"Ctrl-K": repeated(function(cm) {
|
||||||
var start = cm.getCursor(), end = cm.clipPos(Pos(start.line));
|
var start = cm.getCursor(), end = cm.clipPos(Pos(start.line));
|
||||||
var text = cm.getRange(start, end);
|
var text = cm.getRange(start, end);
|
||||||
|
@ -284,7 +284,7 @@
|
||||||
text += "\n";
|
text += "\n";
|
||||||
end = Pos(start.line + 1, 0);
|
end = Pos(start.line + 1, 0);
|
||||||
}
|
}
|
||||||
kill(cm, start, end, true, text);
|
kill(cm, start, end, "grow", text);
|
||||||
}),
|
}),
|
||||||
"Alt-W": function(cm) {
|
"Alt-W": function(cm) {
|
||||||
addToRing(cm.getSelection());
|
addToRing(cm.getSelection());
|
||||||
|
@ -301,14 +301,14 @@
|
||||||
|
|
||||||
"Ctrl-F": move(byChar, 1), "Ctrl-B": move(byChar, -1),
|
"Ctrl-F": move(byChar, 1), "Ctrl-B": move(byChar, -1),
|
||||||
"Right": move(byChar, 1), "Left": move(byChar, -1),
|
"Right": move(byChar, 1), "Left": move(byChar, -1),
|
||||||
"Ctrl-D": function(cm) { killTo(cm, byChar, 1); },
|
"Ctrl-D": function(cm) { killTo(cm, byChar, 1, false); },
|
||||||
"Delete": function(cm) { killRegion(cm) || killTo(cm, byChar, 1); },
|
"Delete": function(cm) { killRegion(cm, false) || killTo(cm, byChar, 1, false); },
|
||||||
"Ctrl-H": function(cm) { killTo(cm, byChar, -1); },
|
"Ctrl-H": function(cm) { killTo(cm, byChar, -1, false); },
|
||||||
"Backspace": function(cm) { killRegion(cm) || killTo(cm, byChar, -1); },
|
"Backspace": function(cm) { killRegion(cm, false) || killTo(cm, byChar, -1, false); },
|
||||||
|
|
||||||
"Alt-F": move(byWord, 1), "Alt-B": move(byWord, -1),
|
"Alt-F": move(byWord, 1), "Alt-B": move(byWord, -1),
|
||||||
"Alt-D": function(cm) { killTo(cm, byWord, 1); },
|
"Alt-D": function(cm) { killTo(cm, byWord, 1, "grow"); },
|
||||||
"Alt-Backspace": function(cm) { killTo(cm, byWord, -1); },
|
"Alt-Backspace": function(cm) { killTo(cm, byWord, -1, "grow"); },
|
||||||
|
|
||||||
"Ctrl-N": move(byLine, 1), "Ctrl-P": move(byLine, -1),
|
"Ctrl-N": move(byLine, 1), "Ctrl-P": move(byLine, -1),
|
||||||
"Down": move(byLine, 1), "Up": move(byLine, -1),
|
"Down": move(byLine, 1), "Up": move(byLine, -1),
|
||||||
|
@ -321,11 +321,11 @@
|
||||||
"Ctrl-Up": move(byParagraph, -1), "Ctrl-Down": move(byParagraph, 1),
|
"Ctrl-Up": move(byParagraph, -1), "Ctrl-Down": move(byParagraph, 1),
|
||||||
|
|
||||||
"Alt-A": move(bySentence, -1), "Alt-E": move(bySentence, 1),
|
"Alt-A": move(bySentence, -1), "Alt-E": move(bySentence, 1),
|
||||||
"Alt-K": function(cm) { killTo(cm, bySentence, 1); },
|
"Alt-K": function(cm) { killTo(cm, bySentence, 1, "grow"); },
|
||||||
|
|
||||||
"Ctrl-Alt-K": function(cm) { killTo(cm, byExpr, 1); },
|
"Ctrl-Alt-K": function(cm) { killTo(cm, byExpr, 1, "grow"); },
|
||||||
"Ctrl-Alt-Backspace": function(cm) { killTo(cm, byExpr, -1); },
|
"Ctrl-Alt-Backspace": function(cm) { killTo(cm, byExpr, -1, "grow"); },
|
||||||
"Ctrl-Alt-F": move(byExpr, 1), "Ctrl-Alt-B": move(byExpr, -1),
|
"Ctrl-Alt-F": move(byExpr, 1), "Ctrl-Alt-B": move(byExpr, -1, "grow"),
|
||||||
|
|
||||||
"Shift-Ctrl-Alt-2": function(cm) {
|
"Shift-Ctrl-Alt-2": function(cm) {
|
||||||
var cursor = cm.getCursor();
|
var cursor = cm.getCursor();
|
||||||
|
@ -398,7 +398,7 @@
|
||||||
"Ctrl-X F": "open",
|
"Ctrl-X F": "open",
|
||||||
"Ctrl-X U": repeated("undo"),
|
"Ctrl-X U": repeated("undo"),
|
||||||
"Ctrl-X K": "close",
|
"Ctrl-X K": "close",
|
||||||
"Ctrl-X Delete": function(cm) { kill(cm, cm.getCursor(), bySentence(cm, cm.getCursor(), 1), true); },
|
"Ctrl-X Delete": function(cm) { kill(cm, cm.getCursor(), bySentence(cm, cm.getCursor(), 1), "grow"); },
|
||||||
"Ctrl-X H": "selectAll",
|
"Ctrl-X H": "selectAll",
|
||||||
|
|
||||||
"Ctrl-Q Tab": repeated("insertTab"),
|
"Ctrl-Q Tab": repeated("insertTab"),
|
||||||
|
|
4
vendor/codemirror/lib/codemirror.css
vendored
4
vendor/codemirror/lib/codemirror.css
vendored
|
@ -145,8 +145,8 @@
|
||||||
|
|
||||||
/* Default styles for common addons */
|
/* Default styles for common addons */
|
||||||
|
|
||||||
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
|
||||||
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
|
||||||
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
|
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
|
||||||
.CodeMirror-activeline-background {background: #e8f2ff;}
|
.CodeMirror-activeline-background {background: #e8f2ff;}
|
||||||
|
|
||||||
|
|
34
vendor/codemirror/lib/codemirror.js
vendored
34
vendor/codemirror/lib/codemirror.js
vendored
|
@ -3274,8 +3274,10 @@ function updateHeightsInViewport(cm) {
|
||||||
// Read and store the height of line widgets associated with the
|
// Read and store the height of line widgets associated with the
|
||||||
// given line.
|
// given line.
|
||||||
function updateWidgetHeight(line) {
|
function updateWidgetHeight(line) {
|
||||||
if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)
|
if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {
|
||||||
{ line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight } }
|
var w = line.widgets[i], parent = w.node.parentNode
|
||||||
|
if (parent) { w.height = parent.offsetHeight }
|
||||||
|
} }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the lines that are visible in a given viewport (defaults
|
// Compute the lines that are visible in a given viewport (defaults
|
||||||
|
@ -7061,18 +7063,26 @@ function lookupKeyForEditor(cm, name, handle) {
|
||||||
// for bound mouse clicks.
|
// for bound mouse clicks.
|
||||||
|
|
||||||
var stopSeq = new Delayed
|
var stopSeq = new Delayed
|
||||||
|
|
||||||
function dispatchKey(cm, name, e, handle) {
|
function dispatchKey(cm, name, e, handle) {
|
||||||
var seq = cm.state.keySeq
|
var seq = cm.state.keySeq
|
||||||
if (seq) {
|
if (seq) {
|
||||||
if (isModifierKey(name)) { return "handled" }
|
if (isModifierKey(name)) { return "handled" }
|
||||||
stopSeq.set(50, function () {
|
if (/\'$/.test(name))
|
||||||
if (cm.state.keySeq == seq) {
|
{ cm.state.keySeq = null }
|
||||||
cm.state.keySeq = null
|
else
|
||||||
cm.display.input.reset()
|
{ stopSeq.set(50, function () {
|
||||||
}
|
if (cm.state.keySeq == seq) {
|
||||||
})
|
cm.state.keySeq = null
|
||||||
name = seq + " " + name
|
cm.display.input.reset()
|
||||||
|
}
|
||||||
|
}) }
|
||||||
|
if (dispatchKeyInner(cm, seq + " " + name, e, handle)) { return true }
|
||||||
}
|
}
|
||||||
|
return dispatchKeyInner(cm, name, e, handle)
|
||||||
|
}
|
||||||
|
|
||||||
|
function dispatchKeyInner(cm, name, e, handle) {
|
||||||
var result = lookupKeyForEditor(cm, name, handle)
|
var result = lookupKeyForEditor(cm, name, handle)
|
||||||
|
|
||||||
if (result == "multi")
|
if (result == "multi")
|
||||||
|
@ -7085,10 +7095,6 @@ function dispatchKey(cm, name, e, handle) {
|
||||||
restartBlink(cm)
|
restartBlink(cm)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seq && !result && /\'$/.test(name)) {
|
|
||||||
e_preventDefault(e)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return !!result
|
return !!result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9640,7 +9646,7 @@ CodeMirror.fromTextArea = fromTextArea
|
||||||
|
|
||||||
addLegacyProps(CodeMirror)
|
addLegacyProps(CodeMirror)
|
||||||
|
|
||||||
CodeMirror.version = "5.31.0"
|
CodeMirror.version = "5.32.1"
|
||||||
|
|
||||||
return CodeMirror;
|
return CodeMirror;
|
||||||
|
|
||||||
|
|
36
vendor/codemirror/mode/javascript/javascript.js
vendored
36
vendor/codemirror/mode/javascript/javascript.js
vendored
|
@ -47,8 +47,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
"interface": kw("class"),
|
"interface": kw("class"),
|
||||||
"implements": C,
|
"implements": C,
|
||||||
"namespace": C,
|
"namespace": C,
|
||||||
"module": kw("module"),
|
|
||||||
"enum": kw("module"),
|
|
||||||
|
|
||||||
// scope modifiers
|
// scope modifiers
|
||||||
"public": kw("modifier"),
|
"public": kw("modifier"),
|
||||||
|
@ -155,7 +153,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
var kw = keywords[word]
|
var kw = keywords[word]
|
||||||
return ret(kw.type, kw.style, word)
|
return ret(kw.type, kw.style, word)
|
||||||
}
|
}
|
||||||
if (word == "async" && stream.match(/^\s*[\(\w]/, false))
|
if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\(\w]/, false))
|
||||||
return ret("async", "keyword", word)
|
return ret("async", "keyword", word)
|
||||||
}
|
}
|
||||||
return ret("variable", "variable", word)
|
return ret("variable", "variable", word)
|
||||||
|
@ -372,9 +370,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
if (isTS && value == "type") {
|
if (isTS && value == "type") {
|
||||||
cx.marked = "keyword"
|
cx.marked = "keyword"
|
||||||
return cont(typeexpr, expect("operator"), typeexpr, expect(";"));
|
return cont(typeexpr, expect("operator"), typeexpr, expect(";"));
|
||||||
} if (isTS && value == "declare") {
|
} else if (isTS && value == "declare") {
|
||||||
cx.marked = "keyword"
|
cx.marked = "keyword"
|
||||||
return cont(statement)
|
return cont(statement)
|
||||||
|
} else if (isTS && (value == "module" || value == "enum") && cx.stream.match(/^\s*\w/, false)) {
|
||||||
|
cx.marked = "keyword"
|
||||||
|
return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex)
|
||||||
} else {
|
} else {
|
||||||
return cont(pushlex("stat"), maybelabel);
|
return cont(pushlex("stat"), maybelabel);
|
||||||
}
|
}
|
||||||
|
@ -388,7 +389,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
if (type == "class") return cont(pushlex("form"), className, poplex);
|
if (type == "class") return cont(pushlex("form"), className, poplex);
|
||||||
if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
|
if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
|
||||||
if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
|
if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
|
||||||
if (type == "module") return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex)
|
|
||||||
if (type == "async") return cont(statement)
|
if (type == "async") return cont(statement)
|
||||||
if (value == "@") return cont(expression, statement)
|
if (value == "@") return cont(expression, statement)
|
||||||
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
||||||
|
@ -438,6 +438,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
|
if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
|
||||||
if (type == "operator") {
|
if (type == "operator") {
|
||||||
if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me);
|
if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me);
|
||||||
|
if (isTS && value == "<" && cx.stream.match(/^([^>]|<.*?>)*>\s*\(/, false))
|
||||||
|
return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, me);
|
||||||
if (value == "?") return cont(expression, expect(":"), expr);
|
if (value == "?") return cont(expression, expect(":"), expr);
|
||||||
return cont(expr);
|
return cont(expr);
|
||||||
}
|
}
|
||||||
|
@ -564,6 +566,18 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
if (value == "?") return cont(maybetype);
|
if (value == "?") return cont(maybetype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function mayberettype(type) {
|
||||||
|
if (isTS && type == ":") {
|
||||||
|
if (cx.stream.match(/^\s*\w+\s+is\b/, false)) return cont(expression, isKW, typeexpr)
|
||||||
|
else return cont(typeexpr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function isKW(_, value) {
|
||||||
|
if (value == "is") {
|
||||||
|
cx.marked = "keyword"
|
||||||
|
return cont()
|
||||||
|
}
|
||||||
|
}
|
||||||
function typeexpr(type, value) {
|
function typeexpr(type, value) {
|
||||||
if (type == "variable" || value == "void") {
|
if (type == "variable" || value == "void") {
|
||||||
if (value == "keyof") {
|
if (value == "keyof") {
|
||||||
|
@ -607,6 +621,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
function maybeTypeArgs(_, value) {
|
function maybeTypeArgs(_, value) {
|
||||||
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
|
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
|
||||||
}
|
}
|
||||||
|
function typeparam() {
|
||||||
|
return pass(typeexpr, maybeTypeDefault)
|
||||||
|
}
|
||||||
|
function maybeTypeDefault(_, value) {
|
||||||
|
if (value == "=") return cont(typeexpr)
|
||||||
|
}
|
||||||
function vardef() {
|
function vardef() {
|
||||||
return pass(pattern, maybetype, maybeAssign, vardefCont);
|
return pass(pattern, maybetype, maybeAssign, vardefCont);
|
||||||
}
|
}
|
||||||
|
@ -660,8 +680,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
function functiondef(type, value) {
|
function functiondef(type, value) {
|
||||||
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
|
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
|
||||||
if (type == "variable") {register(value); return cont(functiondef);}
|
if (type == "variable") {register(value); return cont(functiondef);}
|
||||||
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, maybetype, statement, popcontext);
|
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, statement, popcontext);
|
||||||
if (isTS && value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, functiondef)
|
if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondef)
|
||||||
}
|
}
|
||||||
function funarg(type, value) {
|
function funarg(type, value) {
|
||||||
if (value == "@") cont(expression, funarg)
|
if (value == "@") cont(expression, funarg)
|
||||||
|
@ -677,7 +697,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
if (type == "variable") {register(value); return cont(classNameAfter);}
|
if (type == "variable") {register(value); return cont(classNameAfter);}
|
||||||
}
|
}
|
||||||
function classNameAfter(type, value) {
|
function classNameAfter(type, value) {
|
||||||
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, classNameAfter)
|
if (value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, classNameAfter)
|
||||||
if (value == "extends" || value == "implements" || (isTS && type == ","))
|
if (value == "extends" || value == "implements" || (isTS && type == ","))
|
||||||
return cont(isTS ? typeexpr : expression, classNameAfter);
|
return cont(isTS ? typeexpr : expression, classNameAfter);
|
||||||
if (type == "{") return cont(pushlex("}"), classBody, poplex);
|
if (type == "{") return cont(pushlex("}"), classBody, poplex);
|
||||||
|
|
1
vendor/codemirror/theme/solarized.css
vendored
1
vendor/codemirror/theme/solarized.css
vendored
|
@ -87,7 +87,6 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
text-decoration-style: dotted;
|
text-decoration-style: dotted;
|
||||||
}
|
}
|
||||||
.cm-s-solarized .cm-strong { color: #eee; }
|
|
||||||
.cm-s-solarized .cm-error,
|
.cm-s-solarized .cm-error,
|
||||||
.cm-s-solarized .cm-invalidchar {
|
.cm-s-solarized .cm-invalidchar {
|
||||||
color: #586e75;
|
color: #586e75;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user