Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codemirror

Package Overview
Dependencies
Maintainers
1
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codemirror - npm Package Compare versions

Comparing version 3.22.0 to 3.23.0

mode/dylan/dylan.js

1

addon/hint/show-hint.js

@@ -96,2 +96,3 @@ (function() {

if (!data || !data.list.length) return done();
if (completion.widget) completion.widget.close();
completion.widget = new Widget(completion, data);

@@ -98,0 +99,0 @@ }

40

addon/hint/sql-hint.js

@@ -10,2 +10,3 @@ (function () {

};
var Pos = CodeMirror.Pos;

@@ -40,3 +41,3 @@ function getKeywords(editor) {

var string = token.string.substr(1);
var prevCur = CodeMirror.Pos(cur.line, token.start);
var prevCur = Pos(cur.line, token.start);
var table = editor.getTokenAt(prevCur).string;

@@ -69,3 +70,3 @@ if( !tables.hasOwnProperty( table ) ){

function convertNumberToCur( num ){
return CodeMirror.Pos(Math.floor( num ), +num.toString().split( '.' ).pop());
return Pos(Math.floor( num ), +num.toString().split( '.' ).pop());
}

@@ -81,4 +82,4 @@

var validRange = {
start: CodeMirror.Pos( 0, 0 ),
end: CodeMirror.Pos( editor.lastLine(), editor.getLineHandle( editor.lastLine() ).length )
start: Pos( 0, 0 ),
end: Pos( editor.lastLine(), editor.getLineHandle( editor.lastLine() ).length )
};

@@ -92,4 +93,4 @@

}
separator.unshift( CodeMirror.Pos( 0, 0 ) );
separator.push( CodeMirror.Pos( editor.lastLine(), editor.getLineHandle( editor.lastLine() ).text.length ) );
separator.unshift( Pos( 0, 0 ) );
separator.push( Pos( editor.lastLine(), editor.getLineHandle( editor.lastLine() ).text.length ) );

@@ -130,14 +131,21 @@ //find valieRange

var cur = editor.getCursor();
var token = editor.getTokenAt(cur);
var token = editor.getTokenAt(cur), end = token.end;
var result = [];
var search = token.string.trim();
addMatches(result, search, keywords,
function(w) {return w.toUpperCase();});
addMatches(result, search, tables,
function(w) {return w;});
if(search.lastIndexOf('.') === 0) {
if (search.charAt(0) == ".") {
columnCompletion(result, editor);
if (!result.length) {
while (token.start && search.charAt(0) == ".") {
token = editor.getTokenAt(Pos(cur.line, token.start - 1));
search = token.string + search;
}
addMatches(result, search, tables,
function(w) {return w;});
}
} else {
addMatches(result, search, keywords,
function(w) {return w.toUpperCase();});
addMatches(result, search, tables,
function(w) {return w;});
}

@@ -147,4 +155,4 @@

list: result,
from: CodeMirror.Pos(cur.line, token.start),
to: CodeMirror.Pos(cur.line, token.end)
from: Pos(cur.line, token.start),
to: Pos(cur.line, end)
};

@@ -151,0 +159,0 @@ }

@@ -14,18 +14,26 @@ (function() {

var result = [], replaceToken = false, prefix;
var isTag = token.string.charAt(0) == "<";
if (!inner.state.tagName || isTag) { // Tag completion
if (isTag) {
prefix = token.string.slice(1);
replaceToken = true;
}
var tag = /\btag\b/.test(token.type), tagName = tag && /^\w/.test(token.string), tagStart;
if (tagName) {
var before = cm.getLine(cur.line).slice(Math.max(0, token.start - 2), token.start);
var tagType = /<\/$/.test(before) ? "close" : /<$/.test(before) ? "open" : null;
if (tagType) tagStart = token.start - (tagType == "close" ? 2 : 1);
} else if (tag && token.string == "<") {
tagType = "open";
} else if (tag && token.string == "</") {
tagType = "close";
}
if (!tag && !inner.state.tagName || tagType) {
if (tagName)
prefix = token.string;
replaceToken = tagType;
var cx = inner.state.context, curTag = cx && tags[cx.tagName];
var childList = cx ? curTag && curTag.children : tags["!top"];
if (childList) {
if (childList && tagType != "close") {
for (var i = 0; i < childList.length; ++i) if (!prefix || childList[i].lastIndexOf(prefix, 0) == 0)
result.push("<" + childList[i]);
} else {
} else if (tagType != "close") {
for (var name in tags) if (tags.hasOwnProperty(name) && name != "!top" && (!prefix || name.lastIndexOf(prefix, 0) == 0))
result.push("<" + name);
}
if (cx && (!prefix || ("/" + cx.tagName).lastIndexOf(prefix, 0) == 0))
if (cx && (!prefix || tagType == "close" && cx.tagName.lastIndexOf(prefix, 0) == 0))
result.push("</" + cx.tagName + ">");

@@ -63,3 +71,3 @@ } else {

list: result,
from: replaceToken ? Pos(cur.line, token.start) : cur,
from: replaceToken ? Pos(cur.line, tagStart == null ? token.start : tagStart) : cur,
to: replaceToken ? Pos(cur.line, token.end) : cur

@@ -66,0 +74,0 @@ };

@@ -7,2 +7,3 @@ // Depends on csslint.js from https://github.com/stubbornella/csslint

var found = [];
if (!window.CSSLint) return found;
var results = CSSLint.verify(text), messages = results.messages, message = null;

@@ -9,0 +10,0 @@ for ( var i = 0; i < messages.length; i++) {

@@ -15,2 +15,3 @@ (function() {

function validator(text, options) {
if (!window.JSHINT) return [];
JSHINT(text, options);

@@ -17,0 +18,0 @@ var errors = JSHINT.data().errors, result = [];

@@ -85,2 +85,6 @@ (function() {

dv.orig.on("change", change);
dv.edit.on("markerAdded", set);
dv.edit.on("markerCleared", set);
dv.orig.on("markerAdded", set);
dv.orig.on("markerCleared", set);
dv.edit.on("viewportChange", set);

@@ -353,2 +357,8 @@ dv.orig.on("viewportChange", set);

if (this.left) this.left.setShowDifferences(val);
},
rightChunks: function() {
return this.right && getChunks(this.right.diff);
},
leftChunks: function() {
return this.left && getChunks(this.left.diff);
}

@@ -404,2 +414,11 @@ };

function getChunks(diff) {
var collect = [];
iterateChunks(diff, function(topOrig, botOrig, topEdit, botEdit) {
collect.push({origFrom: topOrig, origTo: botOrig,
editFrom: topEdit, editTo: botEdit});
});
return collect;
}
function endOfLineClean(diff, i) {

@@ -406,0 +425,0 @@ if (i == diff.length - 1) return true;

@@ -19,7 +19,2 @@ // Define search commands. Depends on dialog.js or another

}
if (typeof query == "string") return {token: function(stream) {
if (stream.match(query)) return "searching";
stream.next();
stream.skipTo(query.charAt(0)) || stream.skipToEnd();
}};
return {token: function(stream) {

@@ -29,3 +24,3 @@ if (stream.match(query)) return "searching";

stream.next();
if (startChar)
if (startChar && !caseInsensitive)
stream.skipTo(startChar) || stream.skipToEnd();

@@ -79,3 +74,3 @@ if (stream.match(query, false)) break;

cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query));
state.overlay = searchOverlay(state.query);
state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query));
cm.addOverlay(state.overlay);

@@ -82,0 +77,0 @@ state.posFrom = state.posTo = cm.getCursor();

@@ -200,3 +200,3 @@ (function() {

cm.setCursor(cm.getCursor());
cm.setExtending(true);
cm.setExtending(!cm.getExtending());
cm.on("change", function() { cm.setExtending(false); });

@@ -203,0 +203,0 @@ }

@@ -194,2 +194,26 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {

function cpp11StringHook(stream, state) {
stream.backUp(1);
// Raw strings.
if (stream.match(/(R|u8R|uR|UR|LR)/)) {
var match = stream.match(/"(.{0,16})\(/);
if (!match) {
return false;
}
state.cpp11RawStringDelim = match[1];
state.tokenize = tokenRawString;
return tokenRawString(stream, state);
}
// Unicode strings/chars.
if (stream.match(/(u8|u|U|L)/)) {
if (stream.match(/["']/, /* eat */ false)) {
return "string";
}
return false;
}
// Ignore this hook.
stream.next();
return false;
}
// C#-style strings where "" escapes a quote.

@@ -207,2 +231,15 @@ function tokenAtString(stream, state) {

// C++11 raw string literal is <prefix>"<delim>( anything )<delim>", where
// <delim> can be a string up to 16 characters long.
function tokenRawString(stream, state) {
var closingSequence = new RegExp(".*?\\)" + state.cpp11RawStringDelim + '"');
var match = stream.match(closingSequence);
if (match) {
state.tokenize = null;
} else {
stream.skipToEnd();
}
return "string";
}
function def(mimes, mode) {

@@ -240,6 +277,13 @@ var words = [];

"this using const_cast inline public throw virtual delete mutable protected " +
"wchar_t"),
"wchar_t alignas alignof constexpr decltype nullptr noexcept thread_local final " +
"static_assert override"),
blockKeywords: words("catch class do else finally for if struct switch try while"),
atoms: words("true false null"),
hooks: {"#": cppHook},
hooks: {
"#": cppHook,
"u": cpp11StringHook,
"U": cpp11StringHook,
"L": cpp11StringHook,
"R": cpp11StringHook
},
modeProps: {fold: ["brace", "include"]}

@@ -246,0 +290,0 @@ });

@@ -11,2 +11,3 @@ CodeMirror.defineMode("css", function(config, parserConfig) {

propertyKeywords = parserConfig.propertyKeywords || {},
nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},
colorKeywords = parserConfig.colorKeywords || {},

@@ -166,5 +167,9 @@ valueKeywords = parserConfig.valueKeywords || {},

if (type == "word") {
if (propertyKeywords.hasOwnProperty(stream.current().toLowerCase())) {
var word = stream.current().toLowerCase();
if (propertyKeywords.hasOwnProperty(word)) {
override = "property";
return "maybeprop";
} else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {
override = "string-2";
return "maybeprop";
} else if (allowNested) {

@@ -442,3 +447,3 @@ override = stream.match(/^\s*:/, false) ? "property" : "tag";

"voice-volume", "volume", "white-space", "widows", "width", "word-break",
"word-spacing", "word-wrap", "z-index", "zoom",
"word-spacing", "word-wrap", "z-index",
// SVG-specific

@@ -456,2 +461,10 @@ "clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",

var nonStandardPropertyKeywords = [
"scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color",
"scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color",
"scrollbar-3d-light-color", "scrollbar-track-color", "shape-inside",
"searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
"searchfield-results-decoration", "zoom"
], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords);
var colorKeywords_ = [

@@ -576,3 +589,4 @@ "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",

var allWords = mediaTypes_.concat(mediaFeatures_).concat(propertyKeywords_).concat(colorKeywords_).concat(valueKeywords_);
var allWords = mediaTypes_.concat(mediaFeatures_).concat(propertyKeywords_)
.concat(nonStandardPropertyKeywords).concat(colorKeywords_).concat(valueKeywords_);
CodeMirror.registerHelper("hintWords", "css", allWords);

@@ -606,2 +620,3 @@

propertyKeywords: propertyKeywords,
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
colorKeywords: colorKeywords,

@@ -629,2 +644,3 @@ valueKeywords: valueKeywords,

propertyKeywords: propertyKeywords,
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
colorKeywords: colorKeywords,

@@ -670,2 +686,3 @@ valueKeywords: valueKeywords,

propertyKeywords: propertyKeywords,
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
colorKeywords: colorKeywords,

@@ -672,0 +689,0 @@ valueKeywords: valueKeywords,

@@ -31,3 +31,3 @@ (function() {

MT("htmlCode",
"[tag <h1>]Title[tag </h1>]");
"[tag&bracket <][tag h1][tag&bracket >]Title[tag&bracket </][tag h1][tag&bracket >]");

@@ -34,0 +34,0 @@ MT("rubyBlock",

@@ -348,3 +348,3 @@ // TODO actually recognize syntax of TypeScript constructs

if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
if (type == "function") return cont(functiondef);
if (type == "function") return cont(functiondef, maybeop);
if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression);

@@ -575,3 +575,4 @@ if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop);

};
if (parserConfig.globalVars) state.globalVars = parserConfig.globalVars;
if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
state.globalVars = parserConfig.globalVars;
return state;

@@ -578,0 +579,0 @@ },

@@ -17,2 +17,3 @@ CodeMirror.modeInfo = [

{name: 'DTD', mime: 'application/xml-dtd', mode: 'dtd'},
{name: 'Dylan', mime: 'text/x-dylan', mode: 'dylan'},
{name: 'ECL', mime: 'text/x-ecl', mode: 'ecl'},

@@ -19,0 +20,0 @@ {name: 'Eiffel', mime: 'text/x-eiffel', mode: 'eiffel'},

@@ -171,2 +171,4 @@ /*

});
CodeMirror.registerHelper("hintWords", "pig", (pBuiltins + pTypes + pKeywords).split(" "));
}());

@@ -335,2 +335,13 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {

});
// Created to support specific hive keywords
CodeMirror.defineMIME("text/x-hive", {
name: "sql",
keywords: set("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),
builtin: set("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),
atoms: set("false true null unknown"),
operatorChars: /^[*+\-%<>!=]/,
dateSQL: set("date timestamp"),
support: set("ODBCdotTable doubleQuote binaryNumber hexNumber")
});
}());

@@ -337,0 +348,0 @@

@@ -41,2 +41,4 @@ CodeMirror.defineMode("toml", function () {

stream.next();//skip closing ]
// array of objects has an extra open & close []
if (stream.peek() === ']') stream.next();
return "atom";

@@ -43,0 +45,0 @@ } else if (stream.peek() === "#") {

@@ -37,3 +37,4 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {

allowUnquoted: true,
allowMissing: true
allowMissing: true,
caseFold: true
} : {

@@ -45,3 +46,4 @@ autoSelfClosers: {},

allowUnquoted: false,
allowMissing: false
allowMissing: false,
caseFold: false
};

@@ -51,3 +53,3 @@ var alignCDATA = parserConfig.alignCDATA;

// Return variables for tokenizers
var tagName, type, setStyle;
var type, setStyle;

@@ -79,10 +81,5 @@ function inText(stream, state) {

} else {
var isClose = stream.eat("/");
tagName = "";
var c;
while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
if (!tagName) return "tag error";
type = isClose ? "closeTag" : "openTag";
type = stream.eat("/") ? "closeTag" : "openTag";
state.tokenize = inTag;
return "tag";
return "tag bracket";
}

@@ -112,3 +109,3 @@ } else if (ch == "&") {

type = ch == ">" ? "endTag" : "selfcloseTag";
return "tag";
return "tag bracket";
} else if (ch == "=") {

@@ -128,3 +125,3 @@ type = "equals";

} else {
stream.eatWhile(/[^\s\u00a0=<>\"\']/);
stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
return "word";

@@ -198,3 +195,3 @@ }

}
parentTagName = state.context.tagName.toLowerCase();
parentTagName = state.context.tagName;
if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) ||

@@ -210,20 +207,36 @@ !Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {

if (type == "openTag") {
state.tagName = tagName;
state.tagStart = stream.column();
return tagNameState;
} else if (type == "closeTag") {
return closeTagNameState;
} else {
return baseState;
}
}
function tagNameState(type, stream, state) {
if (type == "word") {
state.tagName = stream.current();
setStyle = "tag";
return attrState;
} else if (type == "closeTag") {
var err = false;
if (state.context) {
if (state.context.tagName != tagName) {
if (Kludges.implicitlyClosed.hasOwnProperty(state.context.tagName.toLowerCase()))
popContext(state);
err = !state.context || state.context.tagName != tagName;
}
} else {
setStyle = "error";
return tagNameState;
}
}
function closeTagNameState(type, stream, state) {
if (type == "word") {
var tagName = stream.current();
if (state.context && state.context.tagName != tagName &&
Kludges.implicitlyClosed.hasOwnProperty(state.context.tagName))
popContext(state);
if (state.context && state.context.tagName == tagName) {
setStyle = "tag";
return closeState;
} else {
err = true;
setStyle = "tag error";
return closeStateErr;
}
if (err) setStyle = "error";
return err ? closeStateErr : closeState;
} else {
return baseState;
setStyle = "error";
return closeStateErr;
}

@@ -252,6 +265,6 @@ }

if (type == "selfcloseTag" ||
Kludges.autoSelfClosers.hasOwnProperty(tagName.toLowerCase())) {
maybePopContext(state, tagName.toLowerCase());
Kludges.autoSelfClosers.hasOwnProperty(tagName)) {
maybePopContext(state, tagName);
} else {
maybePopContext(state, tagName.toLowerCase());
maybePopContext(state, tagName);
state.context = new Context(state, tagName, tagStart == state.indented);

@@ -294,3 +307,3 @@ }

if (stream.eatSpace()) return null;
tagName = type = null;
type = null;
var style = state.tokenize(stream, state);

@@ -323,4 +336,23 @@ if ((style || type) && style != "comment") {

if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
if (context && /^<\//.test(textAfter))
context = context.prev;
var tagAfter = textAfter && /^<(\/)?(\w*)/.exec(textAfter);
if (tagAfter && tagAfter[1]) { // Closing tag spotted
while (context) {
if (context.tagName == tagAfter[2]) {
context = context.prev;
break;
} else if (Kludges.implicitlyClosed.hasOwnProperty(context.tagName)) {
context = context.prev;
} else {
break;
}
}
} else if (tagAfter) { // Opening tag spotted
while (context) {
var grabbers = Kludges.contextGrabbers[context.tagName];
if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
context = context.prev;
else
break;
}
}
while (context && !context.startOfLine)

@@ -327,0 +359,0 @@ context = context.prev;

{
"name": "codemirror",
"version":"3.22.0",
"version":"3.23.0",
"main": "lib/codemirror.js",

@@ -5,0 +5,0 @@ "description": "In-browser code editing made bearable",

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 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 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 not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc