codemirror
Advanced tools
Comparing version 4.3.0 to 4.4.0
@@ -156,2 +156,13 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
// Avoid killing block comments completely outside the selection. | ||
// Positions of the last startString before the start of the selection, and the first endString after it. | ||
var lastStart = startLine.lastIndexOf(startString, from.ch); | ||
var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length); | ||
if (lastStart != -1 && firstEnd != -1) return false; | ||
// Positions of the first endString after the end of the selection, and the last startString before it. | ||
firstEnd = endLine.indexOf(endString, to.ch); | ||
var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch); | ||
lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart; | ||
if (firstEnd != -1 && lastStart != -1) return false; | ||
self.operation(function() { | ||
@@ -158,0 +169,0 @@ self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)), |
@@ -39,2 +39,18 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
// 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)) 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 buildKeymap(pairs) { | ||
@@ -65,4 +81,2 @@ var map = { | ||
var range = ranges[i], cur = range.head, curType; | ||
if (left == "'" && cm.getTokenTypeAt(cur) == "comment") | ||
return CodeMirror.Pass; | ||
var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1)); | ||
@@ -80,5 +94,6 @@ if (!range.empty()) | ||
curType = "addFour"; | ||
else if (left == right && CodeMirror.isWordChar(next)) | ||
return CodeMirror.Pass; | ||
else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.indexOf(next) >= 0 || SPACE_CHAR_REGEX.test(next)) | ||
else if (left == '"' || left == "'") { | ||
if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, left)) curType = "both"; | ||
else return CodeMirror.Pass; | ||
} else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.indexOf(next) >= 0 || SPACE_CHAR_REGEX.test(next)) | ||
curType = "both"; | ||
@@ -85,0 +100,0 @@ else |
@@ -231,5 +231,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
if (overlapY > 0) { | ||
var height = box.bottom - box.top, curTop = box.top - (pos.bottom - pos.top); | ||
var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top); | ||
if (curTop - height > 0) { // Fits above cursor | ||
hints.style.top = (top = curTop - height) + "px"; | ||
hints.style.top = (top = pos.top - height) + "px"; | ||
below = false; | ||
@@ -236,0 +236,0 @@ } else if (height > winH) { |
@@ -14,3 +14,2 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var GUTTER_ID = "CodeMirror-lint-markers"; | ||
var SEVERITIES = /^(?:error|warning)$/; | ||
@@ -114,3 +113,3 @@ function showTooltip(e, content) { | ||
var severity = ann.severity; | ||
if (!SEVERITIES.test(severity)) severity = "error"; | ||
if (!severity) severity = "error"; | ||
var tip = document.createElement("div"); | ||
@@ -146,3 +145,3 @@ tip.className = "CodeMirror-lint-message-" + severity; | ||
var severity = ann.severity; | ||
if (!SEVERITIES.test(severity)) severity = "error"; | ||
if (!severity) severity = "error"; | ||
maxSeverity = getMaxSeverity(maxSeverity, severity); | ||
@@ -149,0 +148,0 @@ |
@@ -113,2 +113,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
function replace(cm, all) { | ||
if (cm.getOption("readOnly")) return; | ||
dialog(cm, replaceQueryDialog, "Replace:", cm.getSelection(), function(query) { | ||
@@ -115,0 +116,0 @@ if (!query) return; |
@@ -110,3 +110,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
if (target[i] != fold(doc.getLine(ln))) return; | ||
if (doc.getLine(ln).slice(0, origTarget[last].length) != target[last]) return; | ||
if (fold(doc.getLine(ln).slice(0, origTarget[last].length)) != target[last]) return; | ||
return {from: from, to: Pos(ln, origTarget[last].length)}; | ||
@@ -113,0 +113,0 @@ } |
{ | ||
"name": "CodeMirror", | ||
"version":"4.3.0", | ||
"name": "codemirror", | ||
"version":"4.4.0", | ||
"main": ["lib/codemirror.js", "lib/codemirror.css"], | ||
@@ -5,0 +5,0 @@ "ignore": [ |
@@ -73,1 +73,5 @@ # How to contribute | ||
with an underscore to muffle it. | ||
- CodeMirror does *not* follow JSHint or JSLint prescribed style. | ||
Patches that try to 'fix' code to pass one of these linters will be | ||
unceremoniously discarded. |
@@ -484,3 +484,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
function findAndGoTo(cm, forward) { | ||
function getTarget(cm) { | ||
var from = cm.getCursor("from"), to = cm.getCursor("to"); | ||
@@ -493,5 +493,10 @@ if (CodeMirror.cmpPos(from, to) == 0) { | ||
} | ||
return {from: from, to: to, query: cm.getRange(from, to), word: word}; | ||
} | ||
var query = cm.getRange(from, to); | ||
var cur = cm.getSearchCursor(query, forward ? to : from); | ||
function findAndGoTo(cm, forward) { | ||
var target = getTarget(cm); | ||
if (!target) return; | ||
var query = target.query; | ||
var cur = cm.getSearchCursor(query, forward ? target.to : target.from); | ||
@@ -505,4 +510,4 @@ if (forward ? cur.findNext() : cur.findPrevious()) { | ||
cm.setSelection(cur.from(), cur.to()); | ||
else if (word) | ||
cm.setSelection(from, to); | ||
else if (target.word) | ||
cm.setSelection(target.from, target.to); | ||
} | ||
@@ -512,2 +517,15 @@ }; | ||
cmds[map["Shift-" + ctrl + "F3"] = "findUnderPrevious"] = function(cm) { findAndGoTo(cm,false); }; | ||
cmds[map["Alt-F3"] = "findAllUnder"] = function(cm) { | ||
var target = getTarget(cm); | ||
if (!target) return; | ||
var cur = cm.getSearchCursor(target.query); | ||
var matches = []; | ||
var primaryIndex = -1; | ||
while (cur.findNext()) { | ||
matches.push({anchor: cur.from(), head: cur.to()}); | ||
if (cur.from().line <= target.from.line && cur.from().ch <= target.from.ch) | ||
primaryIndex++; | ||
} | ||
cm.setSelections(matches, primaryIndex); | ||
}; | ||
@@ -514,0 +532,0 @@ map["Shift-" + ctrl + "["] = "fold"; |
@@ -372,2 +372,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
), | ||
multiLineStrings: true, | ||
blockKeywords: words("catch class do else finally for forSome if match switch try while"), | ||
@@ -374,0 +375,0 @@ atoms: words("true false null"), |
@@ -464,3 +464,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var nonStandardPropertyKeywords = [ | ||
var nonStandardPropertyKeywords_ = [ | ||
"scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color", | ||
@@ -471,3 +471,3 @@ "scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color", | ||
"searchfield-results-decoration", "zoom" | ||
], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords); | ||
], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_); | ||
@@ -594,3 +594,3 @@ var colorKeywords_ = [ | ||
var allWords = mediaTypes_.concat(mediaFeatures_).concat(propertyKeywords_) | ||
.concat(nonStandardPropertyKeywords).concat(colorKeywords_).concat(valueKeywords_); | ||
.concat(nonStandardPropertyKeywords_).concat(colorKeywords_).concat(valueKeywords_); | ||
CodeMirror.registerHelper("hintWords", "css", allWords); | ||
@@ -597,0 +597,0 @@ |
@@ -301,2 +301,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
if (state.lexical.type == "stat") indent = state.lexical.indented; | ||
else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev) | ||
indent = outer.indented; | ||
state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info); | ||
@@ -303,0 +305,0 @@ }; |
@@ -131,2 +131,8 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
MT("indent_funarg", | ||
"[variable foo]([number 10000],", | ||
" [keyword function]([def a]) {", | ||
" [keyword debugger];", | ||
"};"); | ||
MT("indent_below_if", | ||
@@ -133,0 +139,0 @@ "[keyword for] (;;)", |
192
mode/meta.js
@@ -15,99 +15,101 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
CodeMirror.modeInfo = [ | ||
{name: 'APL', mime: 'text/apl', mode: 'apl'}, | ||
{name: 'Asterisk', mime: 'text/x-asterisk', mode: 'asterisk'}, | ||
{name: 'C', mime: 'text/x-csrc', mode: 'clike'}, | ||
{name: 'C++', mime: 'text/x-c++src', mode: 'clike'}, | ||
{name: 'Cobol', mime: 'text/x-cobol', mode: 'cobol'}, | ||
{name: 'Java', mime: 'text/x-java', mode: 'clike'}, | ||
{name: 'C#', mime: 'text/x-csharp', mode: 'clike'}, | ||
{name: 'Scala', mime: 'text/x-scala', mode: 'clike'}, | ||
{name: 'Clojure', mime: 'text/x-clojure', mode: 'clojure'}, | ||
{name: 'CoffeeScript', mime: 'text/x-coffeescript', mode: 'coffeescript'}, | ||
{name: 'Common Lisp', mime: 'text/x-common-lisp', mode: 'commonlisp'}, | ||
{name: 'Cypher', mime: 'application/x-cypher-query', mode: 'cypher'}, | ||
{name: 'CSS', mime: 'text/css', mode: 'css'}, | ||
{name: 'D', mime: 'text/x-d', mode: 'd'}, | ||
{name: 'diff', mime: 'text/x-diff', mode: 'diff'}, | ||
{name: 'DTD', mime: 'application/xml-dtd', mode: 'dtd'}, | ||
{name: 'Dylan', mime: 'text/x-dylan', mode: 'dylan'}, | ||
{name: 'ECL', mime: 'text/x-ecl', mode: 'ecl'}, | ||
{name: 'Eiffel', mime: 'text/x-eiffel', mode: 'eiffel'}, | ||
{name: 'Erlang', mime: 'text/x-erlang', mode: 'erlang'}, | ||
{name: 'Fortran', mime: 'text/x-fortran', mode: 'fortran'}, | ||
{name: 'F#', mime: 'text/x-fsharp', mode: 'mllike'}, | ||
{name: 'Gas', mime: 'text/x-gas', mode: 'gas'}, | ||
{name: 'Gherkin', mime: 'text/x-feature', mode: 'gherkin'}, | ||
{name: 'GitHub Flavored Markdown', mime: 'text/x-gfm', mode: 'gfm'}, | ||
{name: 'Go', mime: 'text/x-go', mode: 'go'}, | ||
{name: 'Groovy', mime: 'text/x-groovy', mode: 'groovy'}, | ||
{name: 'HAML', mime: 'text/x-haml', mode: 'haml'}, | ||
{name: 'Haskell', mime: 'text/x-haskell', mode: 'haskell'}, | ||
{name: 'Haxe', mime: 'text/x-haxe', mode: 'haxe'}, | ||
{name: 'ASP.NET', mime: 'application/x-aspx', mode: 'htmlembedded'}, | ||
{name: 'Embedded Javascript', mime: 'application/x-ejs', mode: 'htmlembedded'}, | ||
{name: 'JavaServer Pages', mime: 'application/x-jsp', mode: 'htmlembedded'}, | ||
{name: 'HTML', mime: 'text/html', mode: 'htmlmixed'}, | ||
{name: 'HTTP', mime: 'message/http', mode: 'http'}, | ||
{name: 'Jade', mime: 'text/x-jade', mode: 'jade'}, | ||
{name: 'JavaScript', mime: 'text/javascript', mode: 'javascript'}, | ||
{name: 'JSON', mime: 'application/x-json', mode: 'javascript'}, | ||
{name: 'JSON', mime: 'application/json', mode: 'javascript'}, | ||
{name: 'JSON-LD', mime: 'application/ld+json', mode: 'javascript'}, | ||
{name: 'TypeScript', mime: 'application/typescript', mode: 'javascript'}, | ||
{name: 'Jinja2', mime: null, mode: 'jinja2'}, | ||
{name: 'Julia', mime: 'text/x-julia', mode: 'julia'}, | ||
{name: 'LESS', mime: 'text/x-less', mode: 'css'}, | ||
{name: 'LiveScript', mime: 'text/x-livescript', mode: 'livescript'}, | ||
{name: 'Lua', mime: 'text/x-lua', mode: 'lua'}, | ||
{name: 'Markdown (GitHub-flavour)', mime: 'text/x-markdown', mode: 'markdown'}, | ||
{name: 'mIRC', mime: 'text/mirc', mode: 'mirc'}, | ||
{name: 'Nginx', mime: 'text/x-nginx-conf', mode: 'nginx'}, | ||
{name: 'NTriples', mime: 'text/n-triples', mode: 'ntriples'}, | ||
{name: 'OCaml', mime: 'text/x-ocaml', mode: 'mllike'}, | ||
{name: 'Octave', mime: 'text/x-octave', mode: 'octave'}, | ||
{name: 'Pascal', mime: 'text/x-pascal', mode: 'pascal'}, | ||
{name: 'PEG.js', mime: null, mode: 'pegjs'}, | ||
{name: 'Perl', mime: 'text/x-perl', mode: 'perl'}, | ||
{name: 'PHP', mime: 'text/x-php', mode: 'php'}, | ||
{name: 'PHP(HTML)', mime: 'application/x-httpd-php', mode: 'php'}, | ||
{name: 'Pig', mime: 'text/x-pig', mode: 'pig'}, | ||
{name: 'Plain Text', mime: 'text/plain', mode: 'null'}, | ||
{name: 'Properties files', mime: 'text/x-properties', mode: 'properties'}, | ||
{name: 'Python', mime: 'text/x-python', mode: 'python'}, | ||
{name: 'Puppet', mime: 'text/x-puppet', mode: 'puppet'}, | ||
{name: 'Cython', mime: 'text/x-cython', mode: 'python'}, | ||
{name: 'R', mime: 'text/x-rsrc', mode: 'r'}, | ||
{name: 'reStructuredText', mime: 'text/x-rst', mode: 'rst'}, | ||
{name: 'Ruby', mime: 'text/x-ruby', mode: 'ruby'}, | ||
{name: 'Rust', mime: 'text/x-rustsrc', mode: 'rust'}, | ||
{name: 'Sass', mime: 'text/x-sass', mode: 'sass'}, | ||
{name: 'Scheme', mime: 'text/x-scheme', mode: 'scheme'}, | ||
{name: 'SCSS', mime: 'text/x-scss', mode: 'css'}, | ||
{name: 'Shell', mime: 'text/x-sh', mode: 'shell'}, | ||
{name: 'Sieve', mime: 'application/sieve', mode: 'sieve'}, | ||
{name: 'Smalltalk', mime: 'text/x-stsrc', mode: 'smalltalk'}, | ||
{name: 'Smarty', mime: 'text/x-smarty', mode: 'smarty'}, | ||
{name: 'SmartyMixed', mime: 'text/x-smarty', mode: 'smartymixed'}, | ||
{name: 'Solr', mime: 'text/x-solr', mode: 'solr'}, | ||
{name: 'SPARQL', mime: 'application/x-sparql-query', mode: 'sparql'}, | ||
{name: 'SQL', mime: 'text/x-sql', mode: 'sql'}, | ||
{name: 'MariaDB', mime: 'text/x-mariadb', mode: 'sql'}, | ||
{name: 'sTeX', mime: 'text/x-stex', mode: 'stex'}, | ||
{name: 'LaTeX', mime: 'text/x-latex', mode: 'stex'}, | ||
{name: 'SystemVerilog', mime: 'text/x-systemverilog', mode: 'verilog'}, | ||
{name: 'Tcl', mime: 'text/x-tcl', mode: 'tcl'}, | ||
{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: 'Turtle', mime: 'text/turtle', mode: 'turtle'}, | ||
{name: 'VB.NET', mime: 'text/x-vb', mode: 'vb'}, | ||
{name: 'VBScript', mime: 'text/vbscript', mode: 'vbscript'}, | ||
{name: 'Velocity', mime: 'text/velocity', mode: 'velocity'}, | ||
{name: 'Verilog', mime: 'text/x-verilog', mode: 'verilog'}, | ||
{name: 'XML', mime: 'application/xml', mode: 'xml'}, | ||
{name: 'XQuery', mime: 'application/xquery', mode: 'xquery'}, | ||
{name: 'YAML', mime: 'text/x-yaml', mode: 'yaml'}, | ||
{name: 'Z80', mime: 'text/x-z80', mode: 'z80'} | ||
{name: "APL", mime: "text/apl", mode: "apl"}, | ||
{name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk"}, | ||
{name: "C", mime: "text/x-csrc", mode: "clike"}, | ||
{name: "C++", mime: "text/x-c++src", mode: "clike"}, | ||
{name: "Cobol", mime: "text/x-cobol", mode: "cobol"}, | ||
{name: "Java", mime: "text/x-java", mode: "clike"}, | ||
{name: "C#", mime: "text/x-csharp", mode: "clike"}, | ||
{name: "Scala", mime: "text/x-scala", mode: "clike"}, | ||
{name: "Clojure", mime: "text/x-clojure", mode: "clojure"}, | ||
{name: "CoffeeScript", mime: "text/x-coffeescript", mode: "coffeescript"}, | ||
{name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp"}, | ||
{name: "Cypher", mime: "application/x-cypher-query", mode: "cypher"}, | ||
{name: "CSS", mime: "text/css", mode: "css"}, | ||
{name: "D", mime: "text/x-d", mode: "d"}, | ||
{name: "diff", mime: "text/x-diff", mode: "diff"}, | ||
{name: "DTD", mime: "application/xml-dtd", mode: "dtd"}, | ||
{name: "Dylan", mime: "text/x-dylan", mode: "dylan"}, | ||
{name: "ECL", mime: "text/x-ecl", mode: "ecl"}, | ||
{name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel"}, | ||
{name: "Erlang", mime: "text/x-erlang", mode: "erlang"}, | ||
{name: "Fortran", mime: "text/x-fortran", mode: "fortran"}, | ||
{name: "F#", mime: "text/x-fsharp", mode: "mllike"}, | ||
{name: "Gas", mime: "text/x-gas", mode: "gas"}, | ||
{name: "Gherkin", mime: "text/x-feature", mode: "gherkin"}, | ||
{name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm"}, | ||
{name: "Go", mime: "text/x-go", mode: "go"}, | ||
{name: "Groovy", mime: "text/x-groovy", mode: "groovy"}, | ||
{name: "HAML", mime: "text/x-haml", mode: "haml"}, | ||
{name: "Haskell", mime: "text/x-haskell", mode: "haskell"}, | ||
{name: "Haxe", mime: "text/x-haxe", mode: "haxe"}, | ||
{name: "ASP.NET", mime: "application/x-aspx", mode: "htmlembedded"}, | ||
{name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded"}, | ||
{name: "JavaServer Pages", mime: "application/x-jsp", mode: "htmlembedded"}, | ||
{name: "HTML", mime: "text/html", mode: "htmlmixed"}, | ||
{name: "HTTP", mime: "message/http", mode: "http"}, | ||
{name: "Jade", mime: "text/x-jade", mode: "jade"}, | ||
{name: "JavaScript", mime: "text/javascript", mode: "javascript"}, | ||
{name: "JavaScript", mime: "application/javascript", mode: "javascript"}, | ||
{name: "JSON", mime: "application/x-json", mode: "javascript"}, | ||
{name: "JSON", mime: "application/json", mode: "javascript"}, | ||
{name: "JSON-LD", mime: "application/ld+json", mode: "javascript"}, | ||
{name: "TypeScript", mime: "application/typescript", mode: "javascript"}, | ||
{name: "Jinja2", mime: null, mode: "jinja2"}, | ||
{name: "Julia", mime: "text/x-julia", mode: "julia"}, | ||
{name: "Kotlin", mime: "text/x-kotlin", mode: "kotlin"}, | ||
{name: "LESS", mime: "text/x-less", mode: "css"}, | ||
{name: "LiveScript", mime: "text/x-livescript", mode: "livescript"}, | ||
{name: "Lua", mime: "text/x-lua", mode: "lua"}, | ||
{name: "Markdown (GitHub-flavour)", mime: "text/x-markdown", mode: "markdown"}, | ||
{name: "mIRC", mime: "text/mirc", mode: "mirc"}, | ||
{name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx"}, | ||
{name: "NTriples", mime: "text/n-triples", mode: "ntriples"}, | ||
{name: "OCaml", mime: "text/x-ocaml", mode: "mllike"}, | ||
{name: "Octave", mime: "text/x-octave", mode: "octave"}, | ||
{name: "Pascal", mime: "text/x-pascal", mode: "pascal"}, | ||
{name: "PEG.js", mime: null, mode: "pegjs"}, | ||
{name: "Perl", mime: "text/x-perl", mode: "perl"}, | ||
{name: "PHP", mime: "text/x-php", mode: "php"}, | ||
{name: "PHP(HTML)", mime: "application/x-httpd-php", mode: "php"}, | ||
{name: "Pig", mime: "text/x-pig", mode: "pig"}, | ||
{name: "Plain Text", mime: "text/plain", mode: "null"}, | ||
{name: "Properties files", mime: "text/x-properties", mode: "properties"}, | ||
{name: "Python", mime: "text/x-python", mode: "python"}, | ||
{name: "Puppet", mime: "text/x-puppet", mode: "puppet"}, | ||
{name: "Cython", mime: "text/x-cython", mode: "python"}, | ||
{name: "R", mime: "text/x-rsrc", mode: "r"}, | ||
{name: "reStructuredText", mime: "text/x-rst", mode: "rst"}, | ||
{name: "Ruby", mime: "text/x-ruby", mode: "ruby"}, | ||
{name: "Rust", mime: "text/x-rustsrc", mode: "rust"}, | ||
{name: "Sass", mime: "text/x-sass", mode: "sass"}, | ||
{name: "Scheme", mime: "text/x-scheme", mode: "scheme"}, | ||
{name: "SCSS", mime: "text/x-scss", mode: "css"}, | ||
{name: "Shell", mime: "text/x-sh", mode: "shell"}, | ||
{name: "Sieve", mime: "application/sieve", mode: "sieve"}, | ||
{name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk"}, | ||
{name: "Smarty", mime: "text/x-smarty", mode: "smarty"}, | ||
{name: "SmartyMixed", mime: "text/x-smarty", mode: "smartymixed"}, | ||
{name: "Solr", mime: "text/x-solr", mode: "solr"}, | ||
{name: "SPARQL", mime: "application/x-sparql-query", mode: "sparql"}, | ||
{name: "SQL", mime: "text/x-sql", mode: "sql"}, | ||
{name: "MariaDB", mime: "text/x-mariadb", mode: "sql"}, | ||
{name: "sTeX", mime: "text/x-stex", mode: "stex"}, | ||
{name: "LaTeX", mime: "text/x-latex", mode: "stex"}, | ||
{name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog"}, | ||
{name: "Tcl", mime: "text/x-tcl", mode: "tcl"}, | ||
{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: "Turtle", mime: "text/turtle", mode: "turtle"}, | ||
{name: "VB.NET", mime: "text/x-vb", mode: "vb"}, | ||
{name: "VBScript", mime: "text/vbscript", mode: "vbscript"}, | ||
{name: "Velocity", mime: "text/velocity", mode: "velocity"}, | ||
{name: "Verilog", mime: "text/x-verilog", mode: "verilog"}, | ||
{name: "XML", mime: "application/xml", mode: "xml"}, | ||
{name: "XQuery", mime: "application/xquery", mode: "xquery"}, | ||
{name: "YAML", mime: "text/x-yaml", mode: "yaml"}, | ||
{name: "Z80", mime: "text/x-z80", mode: "z80"} | ||
]; | ||
}); |
@@ -179,3 +179,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
if (ch == '/') { | ||
stream.match(/.*\//); | ||
stream.match(/.*?\//); | ||
return 'variable-3'; | ||
@@ -182,0 +182,0 @@ } |
@@ -49,5 +49,19 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state); | ||
} else if (ch == "/" && !stream.eol() && stream.peek() != " ") { | ||
if (stream.eat("=")) return "operator"; | ||
return chain(readQuoted(ch, "string-2", true), stream, state); | ||
} else if (ch == "/") { | ||
var currentIndex = stream.current().length; | ||
if (stream.skipTo("/")) { | ||
var search_till = stream.current().length; | ||
stream.backUp(stream.current().length - currentIndex); | ||
var balance = 0; // balance brackets | ||
while (stream.current().length < search_till) { | ||
var chchr = stream.next(); | ||
if (chchr == "(") balance += 1; | ||
else if (chchr == ")") balance -= 1; | ||
if (balance < 0) break; | ||
} | ||
stream.backUp(stream.current().length - currentIndex); | ||
if (balance == 0) | ||
return chain(readQuoted(ch, "string-2", true), stream, state); | ||
} | ||
return "operator"; | ||
} else if (ch == "%") { | ||
@@ -59,3 +73,3 @@ var style = "string", embed = true; | ||
else if (stream.eat(/[wxq]/)) { style = "string"; embed = false; } | ||
var delim = stream.eat(/[^\w\s]/); | ||
var delim = stream.eat(/[^\w\s=]/); | ||
if (!delim) return "operator"; | ||
@@ -62,0 +76,0 @@ if (matching.propertyIsEnumerable(delim)) delim = matching[delim]; |
@@ -12,2 +12,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
// Warning: Don't base other modes on this one. This here is a | ||
// terrible way to write a mixed mode. | ||
(function(mod) { | ||
@@ -24,7 +27,6 @@ if (typeof exports == "object" && typeof module == "object") // CommonJS | ||
CodeMirror.defineMode("smartymixed", function(config) { | ||
var settings, regs, helpers, parsers, | ||
htmlMixedMode = CodeMirror.getMode(config, "htmlmixed"), | ||
smartyMode = CodeMirror.getMode(config, "smarty"), | ||
var htmlMixedMode = CodeMirror.getMode(config, "htmlmixed"); | ||
var smartyMode = CodeMirror.getMode(config, "smarty"); | ||
settings = { | ||
var settings = { | ||
rightDelimiter: '}', | ||
@@ -41,11 +43,14 @@ leftDelimiter: '{' | ||
regs = { | ||
smartyComment: new RegExp("^" + settings.leftDelimiter + "\\*"), | ||
literalOpen: new RegExp(settings.leftDelimiter + "literal" + settings.rightDelimiter), | ||
literalClose: new RegExp(settings.leftDelimiter + "\/literal" + settings.rightDelimiter), | ||
hasLeftDelimeter: new RegExp(".*" + settings.leftDelimiter), | ||
htmlHasLeftDelimeter: new RegExp("[^<>]*" + settings.leftDelimiter) | ||
function reEsc(str) { return str.replace(/[^\s\w]/g, "\\$&"); } | ||
var reLeft = reEsc(settings.leftDelimiter), reRight = reEsc(settings.rightDelimiter); | ||
var regs = { | ||
smartyComment: new RegExp("^" + reRight + "\\*"), | ||
literalOpen: new RegExp(reLeft + "literal" + reRight), | ||
literalClose: new RegExp(reLeft + "\/literal" + reRight), | ||
hasLeftDelimeter: new RegExp(".*" + reLeft), | ||
htmlHasLeftDelimeter: new RegExp("[^<>]*" + reLeft) | ||
}; | ||
helpers = { | ||
var helpers = { | ||
chain: function(stream, state, parser) { | ||
@@ -76,3 +81,3 @@ state.tokenize = parser; | ||
parsers = { | ||
var parsers = { | ||
html: function(stream, state) { | ||
@@ -79,0 +84,0 @@ if (!state.inLiteral && stream.match(regs.htmlHasLeftDelimeter, false) && state.htmlMixedState.htmlState.tagName === null) { |
@@ -294,3 +294,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
current = stream.current(); | ||
if (style.substr(0, 8) === 'variable' || style==='builtin' || style==='keyword'){//|| knownWords.indexOf(current.substring(1)) > -1) { | ||
if (style && (style.substr(0, 8) === 'variable' || style==='builtin' || style==='keyword')){//|| knownWords.indexOf(current.substring(1)) > -1) { | ||
if (style === 'builtin' || style === 'keyword') style='variable'; | ||
@@ -297,0 +297,0 @@ if (knownWords.indexOf(current.substr(1)) > -1) style='variable-2'; |
@@ -83,3 +83,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
/* pairs (associative arrays) -> key */ | ||
if (!state.pair && stream.match(/^\s*\S+(?=\s*:($|\s))/i)) { | ||
if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)) { | ||
state.pair = true; | ||
@@ -86,0 +86,0 @@ state.keyCol = stream.indentation(); |
{ | ||
"name": "codemirror", | ||
"version":"4.3.0", | ||
"version":"4.4.0", | ||
"main": "lib/codemirror.js", | ||
@@ -5,0 +5,0 @@ "description": "In-browser code editing made bearable", |
@@ -12,2 +12,5 @@ namespace = "comment_"; | ||
var simpleProg = "function foo() {\n return bar;\n}"; | ||
var inlineBlock = "foo(/* bar */ true);"; | ||
var inlineBlocks = "foo(/* bar */ true, /* baz */ false);"; | ||
var multiLineInlineBlock = ["above();", "foo(/* bar */ true);", "below();"]; | ||
@@ -23,2 +26,13 @@ test("block", "javascript", function(cm) { | ||
test("blockToggle2", "javascript", function(cm) { | ||
cm.setCursor({line: 0, ch: 7 /* inside the block comment */}); | ||
cm.execCommand("toggleComment"); | ||
}, inlineBlock, "foo(bar true);"); | ||
// This test should work but currently fails. | ||
// test("blockToggle3", "javascript", function(cm) { | ||
// cm.setCursor({line: 0, ch: 7 /* inside the first block comment */}); | ||
// cm.execCommand("toggleComment"); | ||
// }, inlineBlocks, "foo(bar true, /* baz */ false);"); | ||
test("line", "javascript", function(cm) { | ||
@@ -41,2 +55,25 @@ cm.lineComment(Pos(1, 1), Pos(1, 1)); | ||
test("ignoreExternalBlockComments", "javascript", function(cm) { | ||
cm.execCommand("toggleComment"); | ||
}, inlineBlocks, "// " + inlineBlocks); | ||
test("ignoreExternalBlockComments2", "javascript", function(cm) { | ||
cm.setCursor({line: 0, ch: null /* eol */}); | ||
cm.execCommand("toggleComment"); | ||
}, inlineBlocks, "// " + inlineBlocks); | ||
test("ignoreExternalBlockCommentsMultiLineAbove", "javascript", function(cm) { | ||
cm.setSelection({line: 0, ch: 0}, {line: 1, ch: 1}); | ||
cm.execCommand("toggleComment"); | ||
}, multiLineInlineBlock.join("\n"), ["// " + multiLineInlineBlock[0], | ||
"// " + multiLineInlineBlock[1], | ||
multiLineInlineBlock[2]].join("\n")); | ||
test("ignoreExternalBlockCommentsMultiLineBelow", "javascript", function(cm) { | ||
cm.setSelection({line: 1, ch: 13 /* after end of block comment */}, {line: 2, ch: 1}); | ||
cm.execCommand("toggleComment"); | ||
}, multiLineInlineBlock.join("\n"), [multiLineInlineBlock[0], | ||
"// " + multiLineInlineBlock[1], | ||
"// " + multiLineInlineBlock[2]].join("\n")); | ||
test("commentRange", "javascript", function(cm) { | ||
@@ -43,0 +80,0 @@ cm.blockComment(Pos(1, 2), Pos(1, 13), {fullLines: false}); |
@@ -22,3 +22,3 @@ /* | ||
"window document navigator prompt alert confirm console " + | ||
"FileReader Worker postMessage importScripts " + | ||
"screen FileReader Worker postMessage importScripts " + | ||
"setInterval clearInterval setTimeout clearTimeout " + | ||
@@ -25,0 +25,0 @@ "CodeMirror " + |
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 too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2832997
362
49571