codemirror
Advanced tools
Comparing version 4.11.0 to 4.12.0
@@ -97,5 +97,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
function autoCloseSlash(cm) { | ||
if (cm.getOption("disableInput")) return CodeMirror.Pass; | ||
function autoCloseCurrent(cm, typingSlash) { | ||
var ranges = cm.listSelections(), replacements = []; | ||
var head = typingSlash ? "/" : "</"; | ||
for (var i = 0; i < ranges.length; i++) { | ||
@@ -105,4 +105,4 @@ if (!ranges[i].empty()) return CodeMirror.Pass; | ||
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state; | ||
if (tok.type == "string" || tok.string.charAt(0) != "<" || | ||
tok.start != pos.ch - 1) | ||
if (typingSlash && (tok.type == "string" || tok.string.charAt(0) != "<" || | ||
tok.start != pos.ch - 1)) | ||
return CodeMirror.Pass; | ||
@@ -115,5 +115,5 @@ // Kludge to get around the fact that we are not in XML mode | ||
if (cm.getMode().name == "htmlmixed" && inner.mode.name == "javascript") | ||
replacements[i] = "/script>"; | ||
replacements[i] = head + "script>"; | ||
else if (cm.getMode().name == "htmlmixed" && inner.mode.name == "css") | ||
replacements[i] = "/style>"; | ||
replacements[i] = head + "style>"; | ||
else | ||
@@ -125,3 +125,3 @@ return CodeMirror.Pass; | ||
return CodeMirror.Pass; | ||
replacements[i] = "/" + state.context.tagName + ">"; | ||
replacements[i] = head + state.context.tagName + ">"; | ||
} | ||
@@ -136,2 +136,9 @@ } | ||
function autoCloseSlash(cm) { | ||
if (cm.getOption("disableInput")) return CodeMirror.Pass; | ||
autoCloseCurrent(cm, true); | ||
} | ||
CodeMirror.commands.closeTag = function(cm) { return autoCloseCurrent(cm); }; | ||
function indexOf(collection, elt) { | ||
@@ -138,0 +145,0 @@ if (collection.indexOf) return collection.indexOf(elt); |
@@ -145,2 +145,6 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
} | ||
CodeMirror.defineExtension("foldOption", function(options, name) { | ||
return getOption(this, options, name); | ||
}); | ||
}); |
@@ -70,2 +70,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var opts = cm.state.foldGutter.options, cur = from; | ||
var minSize = cm.foldOption(opts, "minFoldSize"); | ||
var func = cm.foldOption(opts, "rangeFinder"); | ||
cm.eachLine(from, to, function(line) { | ||
@@ -76,5 +78,5 @@ var mark = null; | ||
} else { | ||
var pos = Pos(cur, 0), func = opts.rangeFinder || CodeMirror.fold.auto; | ||
var pos = Pos(cur, 0); | ||
var range = func && func(cm, pos); | ||
if (range && range.from.line + 1 < range.to.line) | ||
if (range && range.to.line - range.from.line >= minSize) | ||
mark = marker(opts.indicatorOpen); | ||
@@ -81,0 +83,0 @@ } |
@@ -262,3 +262,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var align = dv.mv.options.connect == "align"; | ||
var align = dv.mv.options.connect == "align", oldScrollEdit, oldScrollOrig; | ||
if (align) { | ||
@@ -268,2 +268,4 @@ if (!dv.orig.curOp) return dv.orig.operation(function() { | ||
}); | ||
oldScrollEdit = dv.edit.getScrollInfo().top; | ||
oldScrollOrig = dv.orig.getScrollInfo().top; | ||
for (var i = 0; i < dv.aligners.length; i++) | ||
@@ -298,2 +300,4 @@ dv.aligners[i].clear(); | ||
dv.aligners.push(padBelow(dv.orig, 0, extraSpaceAbove.orig)); | ||
dv.edit.scrollTo(null, oldScrollEdit); | ||
dv.orig.scrollTo(null, oldScrollOrig); | ||
} | ||
@@ -300,0 +304,0 @@ } |
@@ -119,3 +119,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var rule = curState[i]; | ||
var matches = stream.match(rule.regex); | ||
var matches = (!rule.data.sol || stream.sol()) && stream.match(rule.regex); | ||
if (matches) { | ||
@@ -122,0 +122,0 @@ if (rule.data.next) { |
@@ -30,10 +30,12 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var start = e[axis], startpos = self.pos; | ||
function done() { | ||
CodeMirror.off(document, "mousemove", move); | ||
CodeMirror.off(document, "mouseup", done); | ||
} | ||
function move(e) { | ||
if (e.which != 1) { | ||
CodeMirror.off(document, "mousemove", move); | ||
return; | ||
} | ||
if (e.which != 1) return done(); | ||
self.moveTo(startpos + (e[axis] - start) * (self.total / self.size)); | ||
} | ||
CodeMirror.on(document, "mousemove", move); | ||
CodeMirror.on(document, "mouseup", done); | ||
}); | ||
@@ -40,0 +42,0 @@ |
{ | ||
"name": "codemirror", | ||
"version":"4.11.0", | ||
"version":"4.12.0", | ||
"main": ["lib/codemirror.js", "lib/codemirror.css"], | ||
@@ -5,0 +5,0 @@ "ignore": [ |
@@ -398,2 +398,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
"Ctrl-X Delete": function(cm) { kill(cm, cm.getCursor(), bySentence(cm, cm.getCursor(), 1), true); }, | ||
"Ctrl-X H": "selectAll", | ||
@@ -400,0 +401,0 @@ "Ctrl-Q Tab": repeated("insertTab"), |
@@ -411,3 +411,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
"sampler1D sampler2D sampler3D samplerCube " + | ||
"sampler1DShadow sampler2DShadow" + | ||
"sampler1DShadow sampler2DShadow " + | ||
"const attribute uniform varying " + | ||
@@ -420,3 +420,3 @@ "break continue discard return " + | ||
"pow exp log exp2 sqrt inversesqrt " + | ||
"abs sign floor ceil fract mod min max clamp mix step smootstep " + | ||
"abs sign floor ceil fract mod min max clamp mix step smoothstep " + | ||
"length distance dot cross normalize ftransform faceforward " + | ||
@@ -438,3 +438,3 @@ "reflect refract matrixCompMult " + | ||
"gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 " + | ||
"gl_FogCoord " + | ||
"gl_FogCoord gl_PointCoord " + | ||
"gl_Position gl_PointSize gl_ClipVertex " + | ||
@@ -444,3 +444,3 @@ "gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor " + | ||
"gl_FragCoord gl_FrontFacing " + | ||
"gl_FragColor gl_FragData gl_FragDepth " + | ||
"gl_FragData gl_FragDepth " + | ||
"gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix " + | ||
@@ -447,0 +447,0 @@ "gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse " + |
@@ -528,3 +528,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
"ethiopic-halehame-tig", "ew-resize", "expanded", "extra-condensed", | ||
"extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "footnotes", | ||
"extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "footnotes", | ||
"forwards", "from", "geometricPrecision", "georgian", "graytext", "groove", | ||
@@ -536,3 +536,3 @@ "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew", | ||
"infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", | ||
"inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", | ||
"inline-block", "inline-flex", "inline-table", "inset", "inside", "intrinsic", "invert", | ||
"italic", "justify", "kannada", "katakana", "katakana-iroha", "keep-all", "khmer", | ||
@@ -539,0 +539,0 @@ "landscape", "lao", "large", "larger", "left", "level", "lighter", |
@@ -603,2 +603,8 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
function isContinuedStatement(state, textAfter) { | ||
return state.lastType == "operator" || state.lastType == "," || | ||
isOperatorChar.test(textAfter.charAt(0)) || | ||
/[,.]/.test(textAfter.charAt(0)); | ||
} | ||
// Interface | ||
@@ -655,3 +661,3 @@ | ||
else if (type == "stat") | ||
return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? statementIndent || indentUnit : 0); | ||
return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0); | ||
else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false) | ||
@@ -658,0 +664,0 @@ return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit); |
@@ -16,5 +16,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
{name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]}, | ||
{name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk"}, | ||
{name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i}, | ||
{name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h"]}, | ||
{name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "hpp", "h++"], alias: ["cpp"]}, | ||
{name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]}, | ||
{name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]}, | ||
@@ -25,3 +25,3 @@ {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp"]}, | ||
{name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp", ext: ["cl", "lisp", "el"], alias: ["lisp"]}, | ||
{name: "Cypher", mime: "application/x-cypher-query", mode: "cypher"}, | ||
{name: "Cypher", mime: "application/x-cypher-query", mode: "cypher", ext: ["cyp", "cypher"]}, | ||
{name: "Cython", mime: "text/x-cython", mode: "python", ext: ["pyx", "pxd", "pxi"]}, | ||
@@ -34,3 +34,3 @@ {name: "CSS", mime: "text/css", mode: "css", ext: ["css"]}, | ||
{name: "Django", mime: "text/x-django", mode: "django"}, | ||
{name: "Dockerfile", mime: "text/x-dockerfile", mode: "dockerfile"}, | ||
{name: "Dockerfile", mime: "text/x-dockerfile", mode: "dockerfile", file: /^Dockerfile$/}, | ||
{name: "DTD", mime: "application/xml-dtd", mode: "dtd", ext: ["dtd"]}, | ||
@@ -48,3 +48,3 @@ {name: "Dylan", mime: "text/x-dylan", mode: "dylan", ext: ["dylan", "dyl", "intr"]}, | ||
{name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]}, | ||
{name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm"}, | ||
{name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm", file: /^(readme|contributing|history).md$/i}, | ||
{name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]}, | ||
@@ -66,3 +66,3 @@ {name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy"]}, | ||
{name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]}, | ||
{name: "JSON-LD", mime: "application/ld+json", mode: "javascript", alias: ["jsonld"]}, | ||
{name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]}, | ||
{name: "Jinja2", mime: "null", mode: "jinja2"}, | ||
@@ -80,3 +80,3 @@ {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"]}, | ||
{name: "MySQL", mime: "text/x-mysql", mode: "sql"}, | ||
{name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx"}, | ||
{name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx", file: /nginx.*\.conf$/i}, | ||
{name: "NTriples", mime: "text/n-triples", mode: "ntriples", ext: ["nt"]}, | ||
@@ -87,8 +87,8 @@ {name: "Objective C", mime: "text/x-objectivec", mode: "clike", ext: ["m", "mm"]}, | ||
{name: "Pascal", mime: "text/x-pascal", mode: "pascal", ext: ["p", "pas"]}, | ||
{name: "PEG.js", mime: "null", mode: "pegjs"}, | ||
{name: "PEG.js", mime: "null", mode: "pegjs", ext: ["jsonld"]}, | ||
{name: "Perl", mime: "text/x-perl", mode: "perl", ext: ["pl", "pm"]}, | ||
{name: "PHP", mime: "application/x-httpd-php", mode: "php", ext: ["php", "php3", "php4", "php5", "phtml"]}, | ||
{name: "Pig", mime: "text/x-pig", mode: "pig"}, | ||
{name: "Pig", mime: "text/x-pig", mode: "pig", ext: ["pig"]}, | ||
{name: "Plain Text", mime: "text/plain", mode: "null", ext: ["txt", "text", "conf", "def", "list", "log"]}, | ||
{name: "PLSQL", mime: "text/x-plsql", mode: "sql"}, | ||
{name: "PLSQL", mime: "text/x-plsql", mode: "sql", ext: ["pls"]}, | ||
{name: "Properties files", mime: "text/x-properties", mode: "properties", ext: ["properties", "ini", "in"], alias: ["ini", "properties"]}, | ||
@@ -109,4 +109,4 @@ {name: "Python", mime: "text/x-python", mode: "python", ext: ["py", "pyw"]}, | ||
{name: "Shell", mime: "text/x-sh", mode: "shell", ext: ["sh", "ksh", "bash"], alias: ["bash", "sh", "zsh"]}, | ||
{name: "Sieve", mime: "application/sieve", mode: "sieve"}, | ||
{name: "Slim", mimes: ["text/x-slim", "application/x-slim"], mode: "slim"}, | ||
{name: "Sieve", mime: "application/sieve", mode: "sieve", ext: ["siv", "sieve"]}, | ||
{name: "Slim", mimes: ["text/x-slim", "application/x-slim"], mode: "slim", ext: ["slim"]}, | ||
{name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk", ext: ["st"]}, | ||
@@ -125,6 +125,6 @@ {name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]}, | ||
{name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]}, | ||
{name: "Textile", mime: "text/x-textile", mode: "textile"}, | ||
{name: "Textile", mime: "text/x-textile", mode: "textile", ext: ["textile"]}, | ||
{name: "TiddlyWiki ", mime: "text/x-tiddlywiki", mode: "tiddlywiki"}, | ||
{name: "Tiki wiki", mime: "text/tiki", mode: "tiki"}, | ||
{name: "TOML", mime: "text/x-toml", mode: "toml"}, | ||
{name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]}, | ||
{name: "Tornado", mime: "text/x-tornado", mode: "tornado"}, | ||
@@ -134,3 +134,3 @@ {name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]}, | ||
{name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]}, | ||
{name: "VBScript", mime: "text/vbscript", mode: "vbscript"}, | ||
{name: "VBScript", mime: "text/vbscript", mode: "vbscript", ext: ["vbs"]}, | ||
{name: "Velocity", mime: "text/velocity", mode: "velocity", ext: ["vtl"]}, | ||
@@ -150,2 +150,3 @@ {name: "Verilog", mime: "text/x-verilog", mode: "verilog", ext: ["v"]}, | ||
CodeMirror.findModeByMIME = function(mime) { | ||
mime = mime.toLowerCase(); | ||
for (var i = 0; i < CodeMirror.modeInfo.length; i++) { | ||
@@ -167,2 +168,12 @@ var info = CodeMirror.modeInfo[i]; | ||
CodeMirror.findModeByFileName = function(filename) { | ||
for (var i = 0; i < CodeMirror.modeInfo.length; i++) { | ||
var info = CodeMirror.modeInfo[i]; | ||
if (info.file && info.file.test(filename)) return info; | ||
} | ||
var dot = filename.lastIndexOf("."); | ||
var ext = dot > -1 && filename.substring(dot + 1, filename.length); | ||
if (ext) return CodeMirror.findModeByExtension(ext); | ||
}; | ||
CodeMirror.findModeByName = function(name) { | ||
@@ -169,0 +180,0 @@ name = name.toLowerCase(); |
@@ -783,12 +783,17 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
return{ | ||
startState:function(){ | ||
return{ | ||
tokenize:tokenPerl, | ||
chain:null, | ||
style:null, | ||
tail:null};}, | ||
token:function(stream,state){ | ||
return (state.tokenize||tokenPerl)(stream,state);} | ||
};}); | ||
return { | ||
startState: function() { | ||
return { | ||
tokenize: tokenPerl, | ||
chain: null, | ||
style: null, | ||
tail: null | ||
}; | ||
}, | ||
token: function(stream, state) { | ||
return (state.tokenize || tokenPerl)(stream, state); | ||
}, | ||
lineComment: '#' | ||
}; | ||
}); | ||
@@ -795,0 +800,0 @@ CodeMirror.registerHelper("wordChars", "perl", /[\w$]/); |
@@ -22,6 +22,7 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var operators = ["\\(", "\\)", "=", ">", "<", "==", ">=", "<=", "\\+", "-", "\\!=", "/", "\\*", "%", "and", "or", "not"]; | ||
var operators = ["\\(", "\\)", "=", ">", "<", "==", ">=", "<=", "\\+", "-", | ||
"\\!=", "/", "\\*", "%", "and", "or", "not", ";","\\{","\\}",":"]; | ||
var opRegexp = tokenRegexp(operators); | ||
var pseudoElementsRegexp = /^::?[\w\-]+/; | ||
var pseudoElementsRegexp = /^::?[a-zA-Z_][\w\-]*/; | ||
@@ -60,3 +61,3 @@ function urlTokens(stream, state) { | ||
} else { | ||
stream.next(); | ||
stream.skipToEnd(); | ||
} | ||
@@ -69,3 +70,3 @@ | ||
function buildStringTokenizer(quote, greedy) { | ||
if(greedy == null) { greedy = true; } | ||
if (greedy == null) { greedy = true; } | ||
@@ -141,124 +142,209 @@ function stringTokenizer(stream, state) { | ||
if (ch === ".") { | ||
// Strings | ||
if (ch === '"' || ch === "'") { | ||
stream.next(); | ||
state.tokenizer = buildStringTokenizer(ch); | ||
return "string"; | ||
} | ||
// Match class selectors | ||
if (stream.match(/^[\w-]+/)) { | ||
indent(state); | ||
return "atom"; | ||
} else if (stream.peek() === "#") { | ||
indent(state); | ||
return "atom"; | ||
} else { | ||
return "operator"; | ||
if(!state.cursorHalf){// state.cursorHalf === 0 | ||
// first half i.e. before : for key-value pairs | ||
// including selectors | ||
if (ch === ".") { | ||
stream.next(); | ||
if (stream.match(/^[\w-]+/)) { | ||
indent(state); | ||
return "atom"; | ||
} else if (stream.peek() === "#") { | ||
indent(state); | ||
return "atom"; | ||
} | ||
} | ||
} | ||
if (ch === "#") { | ||
stream.next(); | ||
if (ch === "#") { | ||
stream.next(); | ||
// ID selectors | ||
if (stream.match(/^[\w-]+/)) { | ||
indent(state); | ||
return "atom"; | ||
} | ||
if (stream.peek() === "#") { | ||
indent(state); | ||
return "atom"; | ||
} | ||
} | ||
// Hex numbers | ||
if (stream.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)) | ||
// Variables | ||
if (ch === "$") { | ||
stream.next(); | ||
stream.eatWhile(/[\w-]/); | ||
return "variable-2"; | ||
} | ||
// Numbers | ||
if (stream.match(/^-?[0-9\.]+/)) | ||
return "number"; | ||
// ID selectors | ||
if (stream.match(/^[\w-]+/)) { | ||
indent(state); | ||
// Units | ||
if (stream.match(/^(px|em|in)\b/)) | ||
return "unit"; | ||
if (stream.match(keywordsRegexp)) | ||
return "keyword"; | ||
if (stream.match(/^url/) && stream.peek() === "(") { | ||
state.tokenizer = urlTokens; | ||
return "atom"; | ||
} | ||
if (stream.peek() === "#") { | ||
indent(state); | ||
return "atom"; | ||
if (ch === "=") { | ||
// Match shortcut mixin definition | ||
if (stream.match(/^=[\w-]+/)) { | ||
indent(state); | ||
return "meta"; | ||
} | ||
} | ||
} | ||
// Numbers | ||
if (stream.match(/^-?[0-9\.]+/)) | ||
return "number"; | ||
if (ch === "+") { | ||
// Match shortcut mixin definition | ||
if (stream.match(/^\+[\w-]+/)){ | ||
return "variable-3"; | ||
} | ||
} | ||
// Units | ||
if (stream.match(/^(px|em|in)\b/)) | ||
return "unit"; | ||
if(ch === "@"){ | ||
if(stream.match(/@extend/)){ | ||
if(!stream.match(/\s*[\w]/)) | ||
dedent(state); | ||
} | ||
} | ||
if (stream.match(keywordsRegexp)) | ||
return "keyword"; | ||
if (stream.match(/^url/) && stream.peek() === "(") { | ||
state.tokenizer = urlTokens; | ||
return "atom"; | ||
} | ||
// Indent Directives | ||
if (stream.match(/^@(else if|if|media|else|for|each|while|mixin|function)/)) { | ||
indent(state); | ||
return "meta"; | ||
} | ||
// Variables | ||
if (ch === "$") { | ||
stream.next(); | ||
stream.eatWhile(/[\w-]/); | ||
// Other Directives | ||
if (ch === "@") { | ||
stream.next(); | ||
stream.eatWhile(/[\w-]/); | ||
return "meta"; | ||
} | ||
if (stream.peek() === ":") { | ||
if (stream.eatWhile(/[\w-]/)){ | ||
if(stream.match(/ *: *[\w-\+\$#!\("']/,false)){ | ||
return "propery"; | ||
} | ||
else if(stream.match(/ *:/,false)){ | ||
indent(state); | ||
state.cursorHalf = 1; | ||
return "atom"; | ||
} | ||
else if(stream.match(/ *,/,false)){ | ||
return "atom"; | ||
} | ||
else{ | ||
indent(state); | ||
return "atom"; | ||
} | ||
} | ||
if(ch === ":"){ | ||
if (stream.match(pseudoElementsRegexp)){ // could be a pseudo-element | ||
return "keyword"; | ||
} | ||
stream.next(); | ||
return "variable-2"; | ||
} else { | ||
return "variable-3"; | ||
state.cursorHalf=1; | ||
return "operator"; | ||
} | ||
} | ||
if (ch === "!") { | ||
stream.next(); | ||
return stream.match(/^[\w]+/) ? "keyword": "operator"; | ||
} | ||
} // cursorHalf===0 ends here | ||
else{ | ||
if (ch === "=") { | ||
stream.next(); | ||
if (ch === "#") { | ||
stream.next(); | ||
// Hex numbers | ||
if (stream.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)){ | ||
if(!stream.peek()){ | ||
state.cursorHalf = 0; | ||
} | ||
return "number"; | ||
} | ||
} | ||
// Match shortcut mixin definition | ||
if (stream.match(/^[\w-]+/)) { | ||
indent(state); | ||
return "meta"; | ||
} else { | ||
return "operator"; | ||
// Numbers | ||
if (stream.match(/^-?[0-9\.]+/)){ | ||
if(!stream.peek()){ | ||
state.cursorHalf = 0; | ||
} | ||
return "number"; | ||
} | ||
} | ||
if (ch === "+") { | ||
stream.next(); | ||
// Units | ||
if (stream.match(/^(px|em|in)\b/)){ | ||
if(!stream.peek()){ | ||
state.cursorHalf = 0; | ||
} | ||
return "unit"; | ||
} | ||
// Match shortcut mixin definition | ||
if (stream.match(/^[\w-]+/)) | ||
if (stream.match(keywordsRegexp)){ | ||
if(!stream.peek()){ | ||
state.cursorHalf = 0; | ||
} | ||
return "keyword"; | ||
} | ||
if (stream.match(/^url/) && stream.peek() === "(") { | ||
state.tokenizer = urlTokens; | ||
if(!stream.peek()){ | ||
state.cursorHalf = 0; | ||
} | ||
return "atom"; | ||
} | ||
// Variables | ||
if (ch === "$") { | ||
stream.next(); | ||
stream.eatWhile(/[\w-]/); | ||
if(!stream.peek()){ | ||
state.cursorHalf = 0; | ||
} | ||
return "variable-3"; | ||
else | ||
return "operator"; | ||
} | ||
} | ||
// Indent Directives | ||
if (stream.match(/^@(else if|if|media|else|for|each|while|mixin|function)/)) { | ||
indent(state); | ||
return "meta"; | ||
} | ||
// bang character for !important, !default, etc. | ||
if (ch === "!") { | ||
stream.next(); | ||
if(!stream.peek()){ | ||
state.cursorHalf = 0; | ||
} | ||
return stream.match(/^[\w]+/) ? "keyword": "operator"; | ||
} | ||
// Other Directives | ||
if (ch === "@") { | ||
stream.next(); | ||
stream.eatWhile(/[\w-]/); | ||
return "meta"; | ||
} | ||
if (stream.match(opRegexp)){ | ||
if(!stream.peek()){ | ||
state.cursorHalf = 0; | ||
} | ||
return "operator"; | ||
} | ||
// Strings | ||
if (ch === '"' || ch === "'") { | ||
stream.next(); | ||
state.tokenizer = buildStringTokenizer(ch); | ||
return "string"; | ||
} | ||
// attributes | ||
if (stream.eatWhile(/[\w-]/)) { | ||
if(!stream.peek()){ | ||
state.cursorHalf = 0; | ||
} | ||
return "attribute"; | ||
} | ||
// Pseudo element selectors | ||
if (ch == ":" && stream.match(pseudoElementsRegexp)) | ||
return "keyword"; | ||
//stream.eatSpace(); | ||
if(!stream.peek()){ | ||
state.cursorHalf = 0; | ||
return null; | ||
} | ||
// atoms | ||
if (stream.eatWhile(/[\w-&]/)) { | ||
// matches a property definition | ||
if (stream.peek() === ":" && !stream.match(pseudoElementsRegexp, false)) | ||
return "property"; | ||
else | ||
return "atom"; | ||
} | ||
} // else ends here | ||
@@ -279,10 +365,9 @@ if (stream.match(opRegexp)) | ||
if (current === "@return") | ||
if (current === "@return" || current === "}"){ | ||
dedent(state); | ||
} | ||
if (style === "atom") | ||
indent(state); | ||
if (style !== null) { | ||
var startOfToken = stream.pos - current.length; | ||
var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount); | ||
@@ -312,2 +397,4 @@ | ||
indentCount: 0, | ||
cursorHalf: 0, // cursor half tells us if cursor lies after (1) | ||
// or before (0) colon (well... more or less) | ||
definedVars: [], | ||
@@ -314,0 +401,0 @@ definedMixins: [] |
{ | ||
"name": "codemirror", | ||
"version":"4.11.0", | ||
"version":"4.12.0", | ||
"main": "lib/codemirror.js", | ||
@@ -11,3 +11,4 @@ "description": "In-browser code editing made bearable", | ||
"devDependencies": {"node-static": "0.6.0", | ||
"phantomjs": "1.9.2-5"}, | ||
"phantomjs": "1.9.2-5", | ||
"blint": ">=0.1.1"}, | ||
"bugs": "http://github.com/codemirror/CodeMirror/issues", | ||
@@ -14,0 +15,0 @@ "keywords": ["JavaScript", "CodeMirror", "Editor"], |
#!/usr/bin/env node | ||
var lint = require("./lint/lint"); | ||
var ok = require("./lint").ok; | ||
lint.checkDir("mode"); | ||
lint.checkDir("lib"); | ||
lint.checkDir("addon"); | ||
lint.checkDir("keymap"); | ||
var ok = lint.success(); | ||
var files = new (require('node-static').Server)(); | ||
@@ -13,0 +6,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
9
3009594
3
398
52229