Move to latest codemirror (3.02)
parent
3075f966d1
commit
091bf37762
@ -1,6 +1,7 @@
|
||||
# Default settings for GCC Explorer.
|
||||
port=10240
|
||||
compileTimeoutMs=4000
|
||||
compilers=/usr/bin/gdc:/usr/bin/gdc-4.4:/usr/bin/gdc-4.6
|
||||
compileFilename=example.d
|
||||
postProcess=d/demangle
|
||||
compilers=/usr/bin/g++-4.4:/usr/bin/g++-4.5:/usr/bin/g++-4.6:/usr/bin/g++-4.7:/usr/bin/clang++:/home/mgodbolt/apps/intel-icc-oss/bin/icc:/site/apps/gcc-4.7.2-drw.patched.6/bin/g++
|
||||
#compilers=/usr/bin/gdc:/usr/bin/gdc-4.4:/usr/bin/gdc-4.6
|
||||
#compileFilename=example.d
|
||||
#postProcess=d/demangle
|
||||
|
@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Tag-closer extension for CodeMirror.
|
||||
*
|
||||
* This extension adds an "autoCloseTags" option that can be set to
|
||||
* either true to get the default behavior, or an object to further
|
||||
* configure its behavior.
|
||||
*
|
||||
* These are supported options:
|
||||
*
|
||||
* `whenClosing` (default true)
|
||||
* Whether to autoclose when the '/' of a closing tag is typed.
|
||||
* `whenOpening` (default true)
|
||||
* Whether to autoclose the tag when the final '>' of an opening
|
||||
* tag is typed.
|
||||
* `dontCloseTags` (default is empty tags for HTML, none for XML)
|
||||
* An array of tag names that should not be autoclosed.
|
||||
* `indentTags` (default is block tags for HTML, none for XML)
|
||||
* An array of tag names that should, when opened, cause a
|
||||
* blank line to be added inside the tag, and the blank line and
|
||||
* closing line to be indented.
|
||||
*
|
||||
* See demos/closetag.html for a usage example.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) {
|
||||
if (val && (old == CodeMirror.Init || !old)) {
|
||||
var map = {name: "autoCloseTags"};
|
||||
if (typeof val != "object" || val.whenClosing)
|
||||
map["'/'"] = function(cm) { autoCloseTag(cm, '/'); };
|
||||
if (typeof val != "object" || val.whenOpening)
|
||||
map["'>'"] = function(cm) { autoCloseTag(cm, '>'); };
|
||||
cm.addKeyMap(map);
|
||||
} else if (!val && (old != CodeMirror.Init && old)) {
|
||||
cm.removeKeyMap("autoCloseTags");
|
||||
}
|
||||
});
|
||||
|
||||
var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param",
|
||||
"source", "track", "wbr"];
|
||||
var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4",
|
||||
"h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"];
|
||||
|
||||
function autoCloseTag(cm, ch) {
|
||||
var pos = cm.getCursor(), tok = cm.getTokenAt(pos);
|
||||
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
|
||||
if (inner.mode.name != "xml") throw CodeMirror.Pass;
|
||||
|
||||
var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html";
|
||||
var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
|
||||
var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);
|
||||
|
||||
if (ch == ">" && state.tagName) {
|
||||
var tagName = state.tagName;
|
||||
if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
|
||||
var lowerTagName = tagName.toLowerCase();
|
||||
// Don't process the '>' at the end of an end-tag or self-closing tag
|
||||
if (tok.type == "tag" && state.type == "closeTag" ||
|
||||
/\/\s*$/.test(tok.string) ||
|
||||
dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1)
|
||||
throw CodeMirror.Pass;
|
||||
|
||||
var doIndent = indentTags && indexOf(indentTags, lowerTagName) > -1;
|
||||
cm.replaceSelection(">" + (doIndent ? "\n\n" : "") + "</" + tagName + ">",
|
||||
doIndent ? {line: pos.line + 1, ch: 0} : {line: pos.line, ch: pos.ch + 1});
|
||||
if (doIndent) {
|
||||
cm.indentLine(pos.line + 1);
|
||||
cm.indentLine(pos.line + 2);
|
||||
}
|
||||
return;
|
||||
} else if (ch == "/" && tok.type == "tag" && tok.string == "<") {
|
||||
var tagName = state.context && state.context.tagName;
|
||||
if (tagName) cm.replaceSelection("/" + tagName + ">", "end");
|
||||
return;
|
||||
}
|
||||
throw CodeMirror.Pass;
|
||||
}
|
||||
|
||||
function indexOf(collection, elt) {
|
||||
if (collection.indexOf) return collection.indexOf(elt);
|
||||
for (var i = 0, e = collection.length; i < e; ++i)
|
||||
if (collection[i] == elt) return i;
|
||||
return -1;
|
||||
}
|
||||
})();
|
@ -0,0 +1,36 @@
|
||||
(function() {
|
||||
var modes = ["clike", "css", "javascript"];
|
||||
for (var i = 0; i < modes.length; ++i)
|
||||
CodeMirror.extendMode(modes[i], {blockCommentStart: "/*",
|
||||
blockCommentEnd: "*/",
|
||||
blockCommentContinue: " * "});
|
||||
|
||||
CodeMirror.commands.newlineAndIndentContinueComment = function(cm) {
|
||||
var pos = cm.getCursor(), token = cm.getTokenAt(pos);
|
||||
var mode = CodeMirror.innerMode(cm.getMode(), token.state).mode;
|
||||
var space;
|
||||
|
||||
if (token.type == "comment" && mode.blockCommentStart) {
|
||||
var end = token.string.indexOf(mode.blockCommentEnd);
|
||||
var full = cm.getRange({line: pos.line, ch: 0}, {line: pos.line, ch: token.end}), found;
|
||||
if (end != -1 && end == token.string.length - mode.blockCommentEnd.length) {
|
||||
// Comment ended, don't continue it
|
||||
} else if (token.string.indexOf(mode.blockCommentStart) == 0) {
|
||||
space = full.slice(0, token.start);
|
||||
if (!/^\s*$/.test(space)) {
|
||||
space = "";
|
||||
for (var i = 0; i < token.start; ++i) space += " ";
|
||||
}
|
||||
} else if ((found = full.indexOf(mode.blockCommentContinue)) != -1 &&
|
||||
found + mode.blockCommentContinue.length > token.start &&
|
||||
/^\s*$/.test(full.slice(0, found))) {
|
||||
space = full.slice(0, found);
|
||||
}
|
||||
}
|
||||
|
||||
if (space != null)
|
||||
cm.replaceSelection("\n" + space + mode.blockCommentContinue, "end");
|
||||
else
|
||||
cm.execCommand("newlineAndIndent");
|
||||
};
|
||||
})();
|
@ -0,0 +1,28 @@
|
||||
(function() {
|
||||
CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
|
||||
var pos = cm.getCursor(), token = cm.getTokenAt(pos);
|
||||
var space;
|
||||
if (token.className == "string") {
|
||||
var full = cm.getRange({line: pos.line, ch: 0}, {line: pos.line, ch: token.end});
|
||||
var listStart = /\*|\d+\./, listContinue;
|
||||
if (token.string.search(listStart) == 0) {
|
||||
var reg = /^[\W]*(\d+)\./g;
|
||||
var matches = reg.exec(full);
|
||||
if(matches)
|
||||
listContinue = (parseInt(matches[1]) + 1) + ". ";
|
||||
else
|
||||
listContinue = "* ";
|
||||
space = full.slice(0, token.start);
|
||||
if (!/^\s*$/.test(space)) {
|
||||
space = "";
|
||||
for (var i = 0; i < token.start; ++i) space += " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (space != null)
|
||||
cm.replaceSelection("\n" + space + listContinue, "end");
|
||||
else
|
||||
cm.execCommand("newlineAndIndent");
|
||||
};
|
||||
})();
|
@ -0,0 +1,63 @@
|
||||
(function() {
|
||||
var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
|
||||
function findMatchingBracket(cm) {
|
||||
var cur = cm.getCursor(), line = cm.getLineHandle(cur.line), pos = cur.ch - 1;
|
||||
var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
|
||||
if (!match) return null;
|
||||
var forward = match.charAt(1) == ">", d = forward ? 1 : -1;
|
||||
var style = cm.getTokenAt({line: cur.line, ch: pos + 1}).type;
|
||||
|
||||
var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
|
||||
function scan(line, lineNo, start) {
|
||||
if (!line.text) return;
|
||||
var pos = forward ? 0 : line.text.length - 1, end = forward ? line.text.length : -1;
|
||||
if (start != null) pos = start + d;
|
||||
for (; pos != end; pos += d) {
|
||||
var ch = line.text.charAt(pos);
|
||||
if (re.test(ch) && cm.getTokenAt({line: lineNo, ch: pos + 1}).type == style) {
|
||||
var match = matching[ch];
|
||||
if (match.charAt(1) == ">" == forward) stack.push(ch);
|
||||
else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
|
||||
else if (!stack.length) return {pos: pos, match: true};
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i = cur.line, found, e = forward ? Math.min(i + 100, cm.lineCount()) : Math.max(-1, i - 100); i != e; i+=d) {
|
||||
if (i == cur.line) found = scan(line, i, pos);
|
||||
else found = scan(cm.getLineHandle(i), i);
|
||||
if (found) break;
|
||||
}
|
||||
return {from: {line: cur.line, ch: pos}, to: found && {line: i, ch: found.pos}, match: found && found.match};
|
||||
}
|
||||
|
||||
function matchBrackets(cm, autoclear) {
|
||||
var found = findMatchingBracket(cm);
|
||||
if (!found) return;
|
||||
var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
|
||||
var one = cm.markText(found.from, {line: found.from.line, ch: found.from.ch + 1},
|
||||
{className: style});
|
||||
var two = found.to && cm.markText(found.to, {line: found.to.line, ch: found.to.ch + 1},
|
||||
{className: style});
|
||||
var clear = function() {
|
||||
cm.operation(function() { one.clear(); two && two.clear(); });
|
||||
};
|
||||
if (autoclear) setTimeout(clear, 800);
|
||||
else return clear;
|
||||
}
|
||||
|
||||
var currentlyHighlighted = null;
|
||||
function doMatchBrackets(cm) {
|
||||
cm.operation(function() {
|
||||
if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;}
|
||||
if (!cm.somethingSelected()) currentlyHighlighted = matchBrackets(cm, false);
|
||||
});
|
||||
}
|
||||
|
||||
CodeMirror.defineOption("matchBrackets", false, function(cm, val) {
|
||||
if (val) cm.on("cursorActivity", doMatchBrackets);
|
||||
else cm.off("cursorActivity", doMatchBrackets);
|
||||
});
|
||||
|
||||
CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
|
||||
CodeMirror.defineExtension("findMatchingBracket", function(){return findMatchingBracket(this);});
|
||||
})();
|
@ -0,0 +1,68 @@
|
||||
(function() {
|
||||
CodeMirror.defineOption("collapseRange", false, function(cm, val, old) {
|
||||
var wasOn = old && old != CodeMirror.Init;
|
||||
if (val && !wasOn)
|
||||
enableRangeCollapsing(cm);
|
||||
else if (!val && wasOn)
|
||||
disableRangeCollapsing(cm);
|
||||
});
|
||||
|
||||
var gutterClass = "CodeMirror-collapserange";
|
||||
|
||||
function enableRangeCollapsing(cm) {
|
||||
cm.on("gutterClick", gutterClick);
|
||||
cm.setOption("gutters", (cm.getOption("gutters") || []).concat([gutterClass]));
|
||||
}
|
||||
|
||||
function disableRangeCollapsing(cm) {
|
||||
cm.rangeCollapseStart = null;
|
||||
cm.off("gutterClick", gutterClick);
|
||||
var gutters = cm.getOption("gutters");
|
||||
for (var i = 0; i < gutters.length && gutters[i] != gutterClass; ++i) {}
|
||||
cm.setOption("gutters", gutters.slice(0, i).concat(gutters.slice(i + 1)));
|
||||
}
|
||||
|
||||
function gutterClick(cm, line, gutter) {
|
||||
if (gutter != gutterClass) return;
|
||||
|
||||
var start = cm.rangeCollapseStart;
|
||||
if (start) {
|
||||
var old = cm.getLineNumber(start);
|
||||
cm.setGutterMarker(start, gutterClass, null);
|
||||
cm.rangeCollapseStart = null;
|
||||
var from = Math.min(old, line), to = Math.max(old, line);
|
||||
if (from != to) {
|
||||
// Finish this fold
|
||||
var fold = cm.markText({line: from + 1, ch: 0}, {line: to - 1}, {
|
||||
collapsed: true,
|
||||
inclusiveLeft: true,
|
||||
inclusiveRight: true,
|
||||
clearOnEnter: true
|
||||
});
|
||||
var clear = function() {
|
||||
cm.setGutterMarker(topLine, gutterClass, null);
|
||||
cm.setGutterMarker(botLine, gutterClass, null);
|
||||
fold.clear();
|
||||
};
|
||||
var topLine = cm.setGutterMarker(from, gutterClass, makeMarker(true, true, clear));
|
||||
var botLine = cm.setGutterMarker(to, gutterClass, makeMarker(false, true, clear));
|
||||
CodeMirror.on(fold, "clear", clear);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Start a new fold
|
||||
cm.rangeCollapseStart = cm.setGutterMarker(line, gutterClass, makeMarker(true, false));
|
||||
}
|
||||
|
||||
function makeMarker(isTop, isFinished, handler) {
|
||||
var node = document.createElement("div");
|
||||
node.innerHTML = isTop ? "\u25bc" : "\u25b2";
|
||||
if (!isFinished) node.style.color = "red";
|
||||
node.style.fontSize = "85%";
|
||||
node.style.cursor = "pointer";
|
||||
if (handler) CodeMirror.on(node, "mousedown", handler);
|
||||
return node;
|
||||
}
|
||||
})();
|
@ -0,0 +1,114 @@
|
||||
(function() {
|
||||
|
||||
CodeMirror.extendMode("css", {
|
||||
commentStart: "/*",
|
||||
commentEnd: "*/",
|
||||
newlineAfterToken: function(_type, content) {
|
||||
return /^[;{}]$/.test(content);
|
||||
}
|
||||
});
|
||||
|
||||
CodeMirror.extendMode("javascript", {
|
||||
commentStart: "/*",
|
||||
commentEnd: "*/",
|
||||
// FIXME semicolons inside of for
|
||||
newlineAfterToken: function(_type, content, textAfter, state) {
|
||||
if (this.jsonMode) {
|
||||
return /^[\[,{]$/.test(content) || /^}/.test(textAfter);
|
||||
} else {
|
||||
if (content == ";" && state.lexical && state.lexical.type == ")") return false;
|
||||
return /^[;{}]$/.test(content) && !/^;/.test(textAfter);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var inlineElements = /^(a|abbr|acronym|area|base|bdo|big|br|button|caption|cite|code|col|colgroup|dd|del|dfn|em|frame|hr|iframe|img|input|ins|kbd|label|legend|link|map|object|optgroup|option|param|q|samp|script|select|small|span|strong|sub|sup|textarea|tt|var)$/;
|
||||
|
||||
CodeMirror.extendMode("xml", {
|
||||
commentStart: "<!--",
|
||||
commentEnd: "-->",
|
||||
newlineAfterToken: function(type, content, textAfter, state) {
|
||||
var inline = false;
|
||||
if (this.configuration == "html")
|
||||
inline = state.context ? inlineElements.test(state.context.tagName) : false;
|
||||
return !inline && ((type == "tag" && />$/.test(content) && state.context) ||
|
||||
/^</.test(textAfter));
|
||||
}
|
||||
});
|
||||
|
||||
// Comment/uncomment the specified range
|
||||
CodeMirror.defineExtension("commentRange", function (isComment, from, to) {
|
||||
var cm = this, curMode = CodeMirror.innerMode(cm.getMode(), cm.getTokenAt(from).state).mode;
|
||||
cm.operation(function() {
|
||||
if (isComment) { // Comment range
|
||||
cm.replaceRange(curMode.commentEnd, to);
|
||||
cm.replaceRange(curMode.commentStart, from);
|
||||
if (from.line == to.line && from.ch == to.ch) // An empty comment inserted - put cursor inside
|
||||
cm.setCursor(from.line, from.ch + curMode.commentStart.length);
|
||||
} else { // Uncomment range
|
||||
var selText = cm.getRange(from, to);
|
||||
var startIndex = selText.indexOf(curMode.commentStart);
|
||||
var endIndex = selText.lastIndexOf(curMode.commentEnd);
|
||||
if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) {
|
||||
// Take string till comment start
|
||||
selText = selText.substr(0, startIndex)
|
||||
// From comment start till comment end
|
||||
+ selText.substring(startIndex + curMode.commentStart.length, endIndex)
|
||||
// From comment end till string end
|
||||
+ selText.substr(endIndex + curMode.commentEnd.length);
|
||||
}
|
||||
cm.replaceRange(selText, from, to);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Applies automatic mode-aware indentation to the specified range
|
||||
CodeMirror.defineExtension("autoIndentRange", function (from, to) {
|
||||
var cmInstance = this;
|
||||
this.operation(function () {
|
||||
for (var i = from.line; i <= to.line; i++) {
|
||||
cmInstance.indentLine(i, "smart");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Applies automatic formatting to the specified range
|
||||
CodeMirror.defineExtension("autoFormatRange", function (from, to) {
|
||||
var cm = this;
|
||||
var outer = cm.getMode(), text = cm.getRange(from, to).split("\n");
|
||||
var state = CodeMirror.copyState(outer, cm.getTokenAt(from).state);
|
||||
var tabSize = cm.getOption("tabSize");
|
||||
|
||||
var out = "", lines = 0, atSol = from.ch == 0;
|
||||
function newline() {
|
||||
out += "\n";
|
||||
atSol = true;
|
||||
++lines;
|
||||
}
|
||||
|
||||
for (var i = 0; i < text.length; ++i) {
|
||||
var stream = new CodeMirror.StringStream(text[i], tabSize);
|
||||
while (!stream.eol()) {
|
||||
var inner = CodeMirror.innerMode(outer, state);
|
||||
var style = outer.token(stream, state), cur = stream.current();
|
||||
stream.start = stream.pos;
|
||||
if (!atSol || /\S/.test(cur)) {
|
||||
out += cur;
|
||||
atSol = false;
|
||||
}
|
||||
if (!atSol && inner.mode.newlineAfterToken &&
|
||||
inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i+1] || "", inner.state))
|
||||
newline();
|
||||
}
|
||||
if (!stream.pos && outer.blankLine) outer.blankLine(state);
|
||||
if (!atSol && i < text.length - 1) newline();
|
||||
}
|
||||
|
||||
cm.operation(function () {
|
||||
cm.replaceRange(out, from, to);
|
||||
for (var cur = from.line + 1, end = from.line + lines; cur <= end; ++cur)
|
||||
cm.indentLine(cur, "smart");
|
||||
cm.setSelection(from, cm.getCursor(false));
|
||||
});
|
||||
});
|
||||
})();
|
@ -0,0 +1,93 @@
|
||||
(function () {
|
||||
function forEach(arr, f) {
|
||||
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
|
||||
}
|
||||
|
||||
function arrayContains(arr, item) {
|
||||
if (!Array.prototype.indexOf) {
|
||||
var i = arr.length;
|
||||
while (i--) {
|
||||
if (arr[i] === item) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return arr.indexOf(item) != -1;
|
||||
}
|
||||
|
||||
function scriptHint(editor, _keywords, getToken) {
|
||||
// Find the token at the cursor
|
||||
var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
|
||||
// If it's not a 'word-style' token, ignore the token.
|
||||
|
||||
if (!/^[\w$_]*$/.test(token.string)) {
|
||||
token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
|
||||
className: token.string == ":" ? "python-type" : null};
|
||||
}
|
||||
|
||||
if (!context) var context = [];
|
||||
context.push(tprop);
|
||||
|
||||
var completionList = getCompletions(token, context);
|
||||
completionList = completionList.sort();
|
||||
//prevent autocomplete for last word, instead show dropdown with one word
|
||||
if(completionList.length == 1) {
|
||||
completionList.push(" ");
|
||||
}
|
||||
|
||||
return {list: completionList,
|
||||
from: {line: cur.line, ch: token.start},
|
||||
to: {line: cur.line, ch: token.end}};
|
||||
}
|
||||
|
||||
CodeMirror.pythonHint = function(editor) {
|
||||
return scriptHint(editor, pythonKeywordsU, function (e, cur) {return e.getTokenAt(cur);});
|
||||
};
|
||||
|
||||
var pythonKeywords = "and del from not while as elif global or with assert else if pass yield"
|
||||
+ "break except import print class exec in raise continue finally is return def for lambda try";
|
||||
var pythonKeywordsL = pythonKeywords.split(" ");
|
||||
var pythonKeywordsU = pythonKeywords.toUpperCase().split(" ");
|
||||
|
||||
var pythonBuiltins = "abs divmod input open staticmethod all enumerate int ord str "
|
||||
+ "any eval isinstance pow sum basestring execfile issubclass print super"
|
||||
+ "bin file iter property tuple bool filter len range type"
|
||||
+ "bytearray float list raw_input unichr callable format locals reduce unicode"
|
||||
+ "chr frozenset long reload vars classmethod getattr map repr xrange"
|
||||
+ "cmp globals max reversed zip compile hasattr memoryview round __import__"
|
||||
+ "complex hash min set apply delattr help next setattr buffer"
|
||||
+ "dict hex object slice coerce dir id oct sorted intern ";
|
||||
var pythonBuiltinsL = pythonBuiltins.split(" ").join("() ").split(" ");
|
||||
var pythonBuiltinsU = pythonBuiltins.toUpperCase().split(" ").join("() ").split(" ");
|
||||
|
||||
function getCompletions(token, context) {
|
||||
var found = [], start = token.string;
|
||||
function maybeAdd(str) {
|
||||
if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
|
||||
}
|
||||
|
||||
function gatherCompletions(_obj) {
|
||||
forEach(pythonBuiltinsL, maybeAdd);
|
||||
forEach(pythonBuiltinsU, maybeAdd);
|
||||
forEach(pythonKeywordsL, maybeAdd);
|
||||
forEach(pythonKeywordsU, maybeAdd);
|
||||
}
|
||||
|
||||
if (context) {
|
||||
// If this is a property, see if it belongs to some object we can
|
||||
// find in the current environment.
|
||||
var obj = context.pop(), base;
|
||||
|
||||
if (obj.type == "variable")
|
||||
base = obj.string;
|
||||
else if(obj.type == "variable-3")
|
||||
base = ":" + obj.string;
|
||||
|
||||
while (base != null && context.length)
|
||||
base = base[context.pop().string];
|
||||
if (base != null) gatherCompletions(base);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
})();
|
@ -0,0 +1,29 @@
|
||||
CodeMirror.colorize = (function() {
|
||||
|
||||
var isBlock = /^(p|li|div|h\\d|pre|blockquote|td)$/;
|
||||
|
||||