Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Take an unsorted, potentially overlapping set of ranges, and build a selection out of it. 'Consumes' ranges array (modifying it).
function normalizeSelection(cm, ranges, primIndex) { var mayTouch = cm && cm.options.selectionsMayTouch; var prim = ranges[primIndex]; ranges.sort(function (a, b) { return cmp(a.from(), b.from()); }); primIndex = indexOf(ranges, prim); for (var i = 1; i < ranges.length; i++) { var cur = ranges...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static _mergeRanges(ranges, newRange) {\n let inRange = false;\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n if (!inRange) {\n if (newRange[1] <= range[0]) {\n // Case 1: New range is before the search range\n ...
[ "0.70186657", "0.6829976", "0.6789967", "0.6774615", "0.6716162", "0.66930807", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.6687457", "0.66794205", "0.66419154", "0.6637528", "0.6637528", "0.6637528", "0.6637528", "0.6637528",...
0.6089187
51
Compute the position of the end of a change (its 'to' property refers to the prechange end).
function changeEnd(change) { if (!change.text) { return change.to } return Pos(change.from.line + change.text.length - 1, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeEnd(change) {\n if (!change.text) {\n return change.to;\n }\n\n return Pos(change.from.line + change.text.length - 1, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0));\n } // Adjust a position to refer to the post-change position of the", "function changeEnd...
[ "0.8138161", "0.7955729", "0.78994995", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.78986555", "0.67363167", "0.6730652", "0.6653417", "0.6602539", "...
0.7955896
14
Adjust a position to refer to the postchange position of the same text, or the end of the change if the change covers it.
function adjustForChange(pos, change) { if (cmp(pos, change.from) < 0) { return pos } if (cmp(pos, change.to) <= 0) { return changeEnd(change) } var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch; if (pos.line == change.to.line) { ch += changeEnd(change).ch ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function adjustForChange(pos, change) {\n\t\t if (cmp(pos, change.from) < 0) return pos;\n\t\t if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\t\t\n\t\t var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n\t\t if (pos.line == change.to.line) ch +=...
[ "0.7517868", "0.7517113", "0.7476506", "0.74503416", "0.74503416", "0.7446208", "0.74452215", "0.7421781", "0.7421781", "0.7421781", "0.7421781", "0.7421781", "0.7421781", "0.7421781", "0.7409264", "0.73805326", "0.73805326", "0.7374713", "0.7374713", "0.7374713", "0.7374713"...
0.74197316
26
Used by replaceSelections to allow moving the selection to the start or around the replaced test. Hint may be "start" or "around".
function computeReplacedSel(doc, changes, hint) { var out = []; var oldPrev = Pos(doc.first, 0), newPrev = oldPrev; for (var i = 0; i < changes.length; i++) { var change = changes[i]; var from = offsetPos(change.from, oldPrev, newPrev); var to = offsetPos(changeEnd(change), oldPrev, newPre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "replaceBeforeCursor(start, text) {\n this.insertBetween(start, this.el.selectionStart, text);\n }", "function moveSelection(event) {\n event.preventDefault();\n event.stopPropagation();\n console.log('Calling moveSelection');\n \n optimalApp.selectionPosition[0] = event.pageX - optimalApp.selectionOffse...
[ "0.66458386", "0.6270682", "0.6186922", "0.6150116", "0.6106729", "0.60771316", "0.60734135", "0.600438", "0.6004206", "0.5984542", "0.5984542", "0.5984542", "0.59713507", "0.59500116", "0.59500116", "0.59500116", "0.5949384", "0.593691", "0.58875495", "0.58433455", "0.583540...
0.56655955
65
Used to get the editor into a consistent state again when options change.
function loadMode(cm) { cm.doc.mode = getMode(cm.options, cm.doc.modeOption); resetModeState(cm); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateEditor() {\n\t\ttextToEditor();\n\t\tpositionEditorCaret();\n\t}", "optionsUpdateHook() { }", "function _onEditorChanged() {\n\t\t_close();\n\t\tcurrentEditor = EditorManager.getCurrentFullEditor();\n\n\t\tcurrentEditor.$textNode = $(currentEditor.getRootElement()).find(\".CodeMirror-lines\");\n...
[ "0.65174145", "0.6448267", "0.6407012", "0.6382705", "0.63655174", "0.63512903", "0.6341789", "0.6240036", "0.62384015", "0.62281793", "0.6186693", "0.61820716", "0.614012", "0.6127556", "0.61134076", "0.61133647", "0.6105441", "0.6083987", "0.6079587", "0.60270965", "0.60219...
0.0
-1
DOCUMENT DATA STRUCTURE By default, updates that start and end at the beginning of a line are treated specially, in order to make the association of line widgets and marker elements with the text behave more intuitive.
function isWholeLineUpdate(doc, change) { return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" && (!doc.cm || doc.cm.options.wholeLineUpdateBefore) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update(text, start, end) {\n this.lineOffsets = undefined;\n const content = this.getText();\n this.setText(content.slice(0, start) + text + content.slice(end));\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n\t\t function spansFor(n) {return markedSpans ? marke...
[ "0.621044", "0.5764168", "0.5717833", "0.5717603", "0.5717603", "0.5697177", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56847143", "0.56391287", "0.56391287", "0.56391287", "0....
0.0
-1
Perform a change on the document data structure.
function updateDoc(doc, change, markedSpans, estimateHeight$$1) { function spansFor(n) {return markedSpans ? markedSpans[n] : null} function update(line, text, spans) { updateLine(line, text, spans, estimateHeight$$1); signalLater(line, "change", line, change); } function linesFor(start, end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "change(docId, doc) {\n const cleanedDoc = this._getCleanedObject(doc);\n let storedDoc = this.store[docId];\n deepExtend(storedDoc, cleanedDoc);\n\n let changedData = {};\n _.each(cleanedDoc, (value, key) => {\n changedData[key] = storedDoc[key];\n });\n\n ...
[ "0.70639664", "0.65255326", "0.60612947", "0.5983165", "0.57900375", "0.5765763", "0.57389504", "0.5728134", "0.56999445", "0.5689289", "0.568801", "0.5685086", "0.5677597", "0.5652581", "0.5643472", "0.563531", "0.563531", "0.563531", "0.56288433", "0.55978465", "0.5595986",...
0.0
-1
Call f for all linked documents.
function linkedDocs(doc, f, sharedHistOnly) { function propagate(doc, skip, sharedHist) { if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) { var rel = doc.linked[i]; if (rel.doc == skip) { continue } var shared = sharedHist && rel.sharedHist; if (sharedHistOnly && ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function linkedDocs(doc, f, sharedHistOnly) {\r\n function propagate(doc, skip, sharedHist) {\r\n if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\r\n var rel = doc.linked[i];\r\n if (rel.doc == skip) continue;\r\n var shared = sharedHist && rel.sharedHist;\r\n if (...
[ "0.7287167", "0.7266578", "0.7266578", "0.7266578", "0.7266578", "0.7266578", "0.7266578", "0.7266578", "0.7241715", "0.7241715", "0.7241715", "0.72227263", "0.7220414", "0.7196992", "0.7166822", "0.7166822", "0.7166822", "0.7166822", "0.7166822", "0.7166822", "0.7166822", ...
0.7237167
22
Attach a document to an editor.
function attachDoc(cm, doc) { if (doc.cm) { throw new Error("This document is already in use.") } cm.doc = doc; doc.cm = cm; estimateLineHeights(cm); loadMode(cm); setDirectionClass(cm); if (!cm.options.lineWrapping) { findMaxLine(cm); } cm.options.mode = doc.modeOption; regChange(cm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attachDoc(cm, doc) {\n\t\t if (doc.cm) throw new Error(\"This document is already in use.\");\n\t\t cm.doc = doc;\n\t\t doc.cm = cm;\n\t\t estimateLineHeights(cm);\n\t\t loadMode(cm);\n\t\t if (!cm.options.lineWrapping) findMaxLine(cm);\n\t\t cm.options.mode = doc.modeOption;\n\t\t ...
[ "0.6626215", "0.6624217", "0.6578821", "0.6578821", "0.6578821", "0.65262896", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.6516365", "0.64938515", "0.64938515", "0.64938515", "0.6477321", "0.6477321", "0.6477321", "0.6477321", "0.6477321",...
0.64563096
36
Create a history change event from an updateDocstyle change object.
function historyChangeFromChange(doc, change) { var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}; attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function historyChangeFromChange(doc, change) {\n\t\t var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n\t\t attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n\t\t linkedDocs(doc, function(doc) {attachLocalSpans(do...
[ "0.6958748", "0.69447005", "0.69312567", "0.69312567", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.69231826", "0.6918998", "0.6918998", "0.6918998", "0.6907962", "0.6907962", "0...
0.6886383
37
Pop all selection events off the end of a history array. Stop at a change event.
function clearSelectionEvents(array) { while (array.length) { var last = lst(array); if (last.ranges) { array.pop(); } else { break } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearSelectionEvents(array) {\n\t\t while (array.length) {\n\t\t var last = lst(array);\n\t\t if (last.ranges) array.pop();\n\t\t else break;\n\t\t }\n\t\t }", "function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) ...
[ "0.71146864", "0.71049196", "0.71049196", "0.71049196", "0.71049196", "0.71049196", "0.71049196", "0.71049196", "0.7104582", "0.7101796", "0.7101796", "0.7101796", "0.7078037", "0.69913226", "0.69913226", "0.69913226", "0.69913226", "0.69913226", "0.69913226", "0.69913226", "...
0.7082584
26
Find the top change event in the history. Pop off selection events that are in the way.
function lastChangeEvent(hist, force) { if (force) { clearSelectionEvents(hist.done); return lst(hist.done) } else if (hist.done.length && !lst(hist.done).ranges) { return lst(hist.done) } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) { hist.done.pop(); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist....
[ "0.6684377", "0.63812923", "0.63594687", "0.6341587", "0.6341587", "0.6341587", "0.6277825", "0.6277825", "0.6277825", "0.6277825", "0.6277825", "0.6277825", "0.6277825", "0.6248254", "0.6231327", "0.6231327", "0.6214123", "0.6214123", "0.6214123", "0.6214123", "0.6214123", ...
0.6287047
20
Register a change in the history. Merges changes that are within a single operation, or are close together with an origin that allows merging (starting with "+") into a single event.
function addChangeToHistory(doc, change, selAfter, opId) { var hist = doc.history; hist.undone.length = 0; var time = +new Date, cur; var last; if ((hist.lastOp == opId || hist.lastOrigin == change.origin && change.origin && ((change.origin.charAt(0) == "+" && hist.lastModTime > t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastM...
[ "0.6184258", "0.6176788", "0.6174049", "0.6174049", "0.6174049", "0.6174049", "0.6174049", "0.6174049", "0.6159121", "0.6155636", "0.6155636", "0.61505264", "0.6144719", "0.61193234", "0.611699", "0.611699", "0.6108021", "0.6108021", "0.6108021", "0.6108021", "0.6108021", "...
0.6182238
14
Called whenever the selection changes, sets the new selection as the pending selection in the history, and pushes the old pending selection into the 'done' array when it was significantly different (in number of selected ranges, emptiness, or time).
function addSelectionToHistory(doc, sel, opId, options) { var hist = doc.history, origin = options && options.origin; // A new event is started when the previous origin does not match // the current, or the origins don't allow matching. Origins // starting with * are always merged, those starting with ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_gcSelections () {\n for (let i = 0; i < this._selections.length; ++i) {\n const s = this._selections[i]\n const oldOffset = s.offset\n\n // check for newly downloaded pieces in selection\n while (this.bitfield.get(s.from + s.offset) && s.from + s.offset < s.to) {\n s.offset += 1\n ...
[ "0.66129965", "0.66129965", "0.66129965", "0.6407596", "0.63369757", "0.62601", "0.62601", "0.62601", "0.61667717", "0.61398435", "0.6102082", "0.6090417", "0.6090417", "0.6082805", "0.60528", "0.6051035", "0.6049311", "0.6049311", "0.6045188", "0.6044834", "0.60216063", "0...
0.60189223
41
Used to store marked span information in the history.
function attachLocalSpans(doc, change, from, to) { var existing = change["spans_" + doc.id], n = 0; doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) { if (line.markedSpans) { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMarkedSpan(line, span) {\n\t\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t\t span.marker.attachLine(line);\n\t\t }", "function addMarkedSpan(line, span) {\n\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t span....
[ "0.6327484", "0.6285503", "0.6285503", "0.6285503", "0.62029684", "0.61554384", "0.6131782", "0.6125477", "0.6125477", "0.6085742", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.60608774", "0.6...
0.54982615
81
When un/redoing restores text containing marked spans, those that have been explicitly cleared should not be restored.
function removeClearedSpans(spans) { if (!spans) { return null } var out; for (var i = 0; i < spans.length; ++i) { if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } } else if (out) { out.push(spans[i]); } } return !out ? spans : out.length ? out : null }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function remark() {\n for (var i = 0; i < vm.game.marked.length; i++) {\n var element = angular.element(document.getElementById('text-' + i));\n var marked = vm.game.marked[i];\n element.removeClass('last');\n element.removeClass('first');\n ...
[ "0.6540399", "0.65239275", "0.64625597", "0.6355469", "0.6310737", "0.6300743", "0.6291497", "0.62827456", "0.6254119", "0.6254119", "0.6254119", "0.623765", "0.62102455", "0.62023807", "0.6201539", "0.62006426", "0.61960566", "0.61960566", "0.61960566", "0.61960566", "0.6196...
0.0
-1
Retrieve and filter the old marked spans stored in a change event.
function getOldSpans(doc, change) { var found = change["spans_" + doc.id]; if (!found) { return null } var nw = []; for (var i = 0; i < change.text.length; ++i) { nw.push(removeClearedSpans(found[i])); } return nw }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOldSpans(doc, change) {\n\t\t var found = change[\"spans_\" + doc.id];\n\t\t if (!found) { return null }\n\t\t var nw = [];\n\t\t for (var i = 0; i < change.text.length; ++i)\n\t\t { nw.push(removeClearedSpans(found[i])); }\n\t\t return nw\n\t\t }", "function getOldSpans(doc, cha...
[ "0.7795729", "0.7775589", "0.7745061", "0.7745061", "0.7745061", "0.76677495", "0.76677495", "0.76677495", "0.76677495", "0.76677495", "0.76677495", "0.76677495", "0.76551306", "0.7651843", "0.7651843", "0.7651643", "0.76475054", "0.76475054", "0.76475054", "0.76475054", "0.7...
0.77104664
19
Used for un/redoing changes from the history. Combines the result of computing the existing spans with the set of spans that existed in the history (so that deleting around a span and then undoing brings back the span).
function mergeOldSpans(doc, change) { var old = getOldSpans(doc, change); var stretched = stretchSpansOverChange(doc, change); if (!old) { return stretched } if (!stretched) { return old } for (var i = 0; i < old.length; ++i) { var oldCur = old[i], stretchCur = stretched[i]; if (oldCur ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOldSpans(doc, change) {\n\t\t var found = change[\"spans_\" + doc.id];\n\t\t if (!found) return null;\n\t\t for (var i = 0, nw = []; i < change.text.length; ++i)\n\t\t nw.push(removeClearedSpans(found[i]));\n\t\t return nw;\n\t\t }", "function getOldSpans(doc, change) {\n\t\t var...
[ "0.6204699", "0.61835754", "0.61484516", "0.61484516", "0.61484516", "0.60746247", "0.60746247", "0.60746247", "0.60746247", "0.60746247", "0.60746247", "0.60746247", "0.6069308", "0.6057101", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.6032919", "0.60...
0.0
-1
Used both to provide a JSONsafe object in .getHistory, and, when detaching a document, to split the history in two
function copyHistoryArray(events, newGroup, instantiateSel) { var copy = []; for (var i = 0; i < events.length; ++i) { var event = events[i]; if (event.ranges) { copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event); continue } var changes = event.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "serializeHistory(state) {\r\n if (!state)\r\n return null;\r\n // Ensure sure that all entries have url\r\n var entries = state.entries.filter(e => e.url);\r\n if (!entries.length)\r\n return null;\r\n // Ensure the index is in bounds.\r\n var index = (state.index || entries.length) - 1...
[ "0.6126061", "0.5970489", "0.5749906", "0.56571066", "0.56460977", "0.5573177", "0.5573177", "0.5573177", "0.55647707", "0.55647707", "0.55647707", "0.55647707", "0.55647707", "0.55647707", "0.55647707", "0.5560216", "0.5555117", "0.5555117", "0.5555117", "0.5555117", "0.5555...
0.0
-1
The 'scroll' parameter given to many of these indicated whether the new cursor position should be scrolled into view after modifying the selection. If shift is held or the extend flag is set, extends a range to include a given position (and optionally a second position). Otherwise, simply returns the range between the ...
function extendRange(range, head, other, extend) { if (extend) { var anchor = range.anchor; if (other) { var posBefore = cmp(head, anchor) < 0; if (posBefore != (cmp(other, anchor) < 0)) { anchor = head; head = other; } else if (posBefore != (cmp(head, other) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function extendRange(doc, range, head, other) {\n\t\t if (doc.cm && doc.cm.display.shift || doc.extend) {\n\t\t var anchor = range.anchor;\n\t\t if (other) {\n\t\t var posBefore = cmp(head, anchor) < 0;\n\t\t if (posBefore != (cmp(other, anchor) < 0)) {\n\t\t anchor = head;\n\t\...
[ "0.64116293", "0.6395189", "0.6395189", "0.6395189", "0.6305622", "0.62692595", "0.62692595", "0.62692595", "0.62692595", "0.62692595", "0.62692595", "0.62692595", "0.62692595", "0.62262756", "0.62262756", "0.6141464", "0.59685487", "0.5950896", "0.5858771", "0.5840827", "0.5...
0.5831049
43
Extend the primary selection range, discard the rest.
function extendSelection(doc, head, other, options, extend) { if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); } setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n\n if (posBefore != cmp(other, anchor) < 0) {\n anchor = head;\n head = other;\n } else if (posBefore != cmp...
[ "0.7361317", "0.72121984", "0.71236956", "0.71236956", "0.71236956", "0.7040623", "0.7038878", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.7036874", "0.70040554", "0.70040554", "0.67941666", "0.6732129", "0.6732129", "0.673212...
0.6841599
30
Extend all selections (pos is an array of selections with length equal the number of selections)
function extendSelections(doc, heads, options) { var out = []; var extend = doc.cm && (doc.cm.display.shift || doc.extend); for (var i = 0; i < doc.sel.ranges.length; i++) { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); } var newSel = normalizeSelection(doc.cm, out, doc.sel.prim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function extendSelections(doc, heads, options) {\n\t\t for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n\t\t out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n\t\t var newSel = normalizeSelection(out, doc.sel.primIndex);\n\t\t setSelection(doc, newSel, options);\n\t\t }", "f...
[ "0.67245656", "0.6698209", "0.6698209", "0.6698209", "0.66711736", "0.66366756", "0.6630632", "0.6630632", "0.6630632", "0.6630632", "0.6630632", "0.6630632", "0.6630632", "0.6630632", "0.6622489", "0.65663224", "0.65663224", "0.65525466", "0.65525466", "0.65525466", "0.65331...
0.63706243
41
Updates a single range in the selection.
function replaceOneSelection(doc, i, range, options) { var ranges = doc.sel.ranges.slice(0); ranges[i] = range; setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateInRange(editor, range, offset = 0, updateFunc) {\n const baseRange = editor.getSelectedRange();\n editor.setSelectedRange(range);\n updateFunc();\n editor.setSelectedRange([baseRange[0] + offset, baseRange[1] + offset]);\n }", "updateRange(start, end) {\n this.range.start = start\n this....
[ "0.7218381", "0.69966", "0.6366824", "0.6361162", "0.6361162", "0.6361162", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63484067", "0.63363445", "0.63199526", "0.63136816", "0.63136816", "0.6311347", "0.6283103", "0.626...
0.62980735
35
Reset the selection to a single range.
function setSimpleSelection(doc, anchor, head, options) { setSelection(doc, simpleSelection(anchor, head), options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_resetSelection() {\n this.__selectedRangeArr = [];\n this.__anchorSelectionIndex = -1;\n this.__leadSelectionIndex = -1;\n }", "restoreRange() {\n if (this.lastRange) {\n this.lastRange.select();\n this.focus();\n }\n }", "reset() {\n this._selection = -1;\n }", "funct...
[ "0.79797", "0.7659073", "0.7618294", "0.74684507", "0.74392134", "0.7276428", "0.7236947", "0.7173246", "0.6906848", "0.6906848", "0.6906848", "0.688273", "0.687953", "0.687953", "0.687953", "0.687953", "0.687953", "0.687953", "0.687953", "0.687953", "0.6857984", "0.6857239...
0.0
-1
Give beforeSelectionChange handlers a change to influence a selection update.
function filterSelectionChange(doc, sel, options) { var obj = { ranges: sel.ranges, update: function(ranges) { var this$1 = this; this.ranges = []; for (var i = 0; i < ranges.length; i++) { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() { }", "function SelectionChange() { }", "beforeSelectRow(rowid, e){\n }", "selectionChanged(context, onContextChanged) {\n retur...
[ "0.7436134", "0.7436134", "0.7436134", "0.7436134", "0.7315609", "0.7315609", "0.64987767", "0.6486742", "0.64495426", "0.64479816", "0.6396452", "0.6395277", "0.6395277", "0.6395277", "0.6390618", "0.6350694", "0.63113916", "0.6283778", "0.6238949", "0.6238949", "0.61821294"...
0.5919608
60
Set a new selection.
function setSelection(doc, sel, options) { setSelectionNoUndo(doc, sel, options); addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setSelection(doc, sel, options) {\n\t\t setSelectionNoUndo(doc, sel, options);\n\t\t addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n\t\t }", "function setSelection(doc, sel, options) {\n\t\t setSelectionNoUndo(doc, sel, options);\n\t\t addSelectionToHistory(d...
[ "0.7453179", "0.7453179", "0.7395772", "0.7395772", "0.7395772", "0.7356902", "0.72738075", "0.72738075", "0.7272042", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.724487", "0.7192502", "0.6912936...
0.7300484
29
Verify that the selection does not partially select any atomic marked ranges.
function reCheckSelection(doc) { setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get hasSelection() {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[0] !== end[0] || start[1] !== end[1];\n }", "function selectionIsSane() {\n\t\t\tvar minSi...
[ "0.6870172", "0.60677147", "0.6066715", "0.6055218", "0.60424894", "0.5962891", "0.5962891", "0.5962891", "0.5962891", "0.5962891", "0.5962891", "0.5962891", "0.596198", "0.5916995", "0.5891306", "0.5881634", "0.5881634", "0.5879924", "0.5879924", "0.5879924", "0.5879924", ...
0.57861257
68
Return a selection that does not partially select any atomic ranges.
function skipAtomicInSelection(doc, sel, bias, mayClear) { var out; for (var i = 0; i < sel.ranges.length; i++) { var range = sel.ranges[i]; var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]; var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "selection_excluding(cells) {\n const selection = new Set(this.selection);\n for (const cell of cells) {\n selection.delete(cell);\n }\n return selection;\n }", "function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.l...
[ "0.6847842", "0.6637457", "0.6637457", "0.6637457", "0.6637457", "0.6637457", "0.6637457", "0.6637457", "0.6596417", "0.6477013", "0.6475794", "0.6475794", "0.6437837", "0.6437837", "0.6437837", "0.6437837", "0.6437837", "0.6437837", "0.6437837", "0.6437837", "0.6437837", "...
0.6439841
23
Ensure a given position is not inside an atomic range.
function skipAtomic(doc, pos, oldPos, bias, mayClear) { var dir = bias || 1; var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) || (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) || skipAtomicInner(doc, pos, oldPos, -dir, mayClear) || (!mayClear && skipAtomicInner(d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static isInsideRange(position, range) {\n if (range.start.line === range.end.line) {\n return range.start.line === position.line\n && range.start.character <= position.character\n && position.character <= range.end.character;\n }\n else if (range.start....
[ "0.59879375", "0.5966708", "0.59146243", "0.562402", "0.56166", "0.5598513", "0.5584527", "0.5547357", "0.5532226", "0.5531274", "0.5508034", "0.54775023", "0.547714", "0.5409574", "0.54091066", "0.5399065", "0.5388472", "0.5386206", "0.53633547", "0.5344547", "0.5343511", ...
0.0
-1
UPDATING Allow "beforeChange" event handlers to influence a change
function filterChange(doc, change, update) { var obj = { canceled: false, from: change.from, to: change.to, text: change.text, origin: change.origin, cancel: function () { return obj.canceled = true; } }; if (update) { obj.update = function (from, to, text, origin) { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_beforeChange () {\n // nop\n }", "_beforeChange () {\n // nop\n }", "afterValidChange() { }", "internalOnChange(event) {\n const me = this,\n value = me.value,\n oldValue = me._lastValue;\n\n // Don't trigger change if we enter invalid value or if value has not changed (for IE when p...
[ "0.79965526", "0.79965526", "0.73935664", "0.71237224", "0.71210444", "0.69660723", "0.69213545", "0.6910988", "0.6855578", "0.6853958", "0.6851805", "0.68481123", "0.68263054", "0.68100536", "0.6746932", "0.6740989", "0.67285186", "0.67158806", "0.6686307", "0.66838264", "0....
0.0
-1
Apply a change to a document, and add it to the document's history, and propagating it to all linked documents.
function makeChange(doc, change, ignoreReadOnly) { if (doc.cm) { if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) } if (doc.cm.state.suppressEdits) { return } } if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { cha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "apply(doc) {\n if (this.length != doc.length)\n throw new RangeError(\"Applying change set to a document with the wrong length\");\n iterChanges(this, (fromA, toA, fromB, _toB, text) => doc = doc.replace(fromB, fromB + (toA - fromA), text), false);\n return doc;\n }", "function...
[ "0.63618726", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.6286882", "0.62850475", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", "0.6271915", ...
0.0
-1
Revert a change stored in a document's history.
function makeChangeFromHistory(doc, type, allowSelectionOnly) { var suppress = doc.cm && doc.cm.state.suppressEdits; if (suppress && !allowSelectionOnly) { return } var hist = doc.history, event, selAfter = doc.sel; var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.und...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function undo() {\n var doc = app.activeDocument;\n var states = doc.historyStates;\n \n var curr = 0;\n for (var i=0; i<states.length; i++) {\n if (states[i] == doc.activeHistoryState) {\n curr = i;\n }\n }\n \n var prev ...
[ "0.666816", "0.66606236", "0.66574264", "0.6404945", "0.6340584", "0.6331039", "0.627892", "0.627892", "0.62788844", "0.62650436", "0.62059116", "0.6139741", "0.6129738", "0.6100485", "0.60984457", "0.609307", "0.6078671", "0.59942985", "0.59702957", "0.59355396", "0.5929626"...
0.0
-1
Subviews need their line numbers shifted when text is added above or below them in the parent document.
function shiftDoc(doc, distance) { if (distance == 0) { return } doc.first += distance; doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range( Pos(range.anchor.line + distance, range.anchor.ch), Pos(range.head.line + distance, range.head.ch) ); }), doc.sel.primIndex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bn(e,t,a,n){null==t&&(t=e.doc.first),null==a&&(a=e.doc.first+e.doc.size),n||(n=0);var r=e.display;if(n&&a<r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>t)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)// Change after\n Jo&&pe(e.doc,t)<r.viewTo&&vn(e);else if(a<=r.viewFrom)// C...
[ "0.59886837", "0.5932061", "0.5651753", "0.56376565", "0.55780476", "0.55274785", "0.55163205", "0.55099046", "0.5506641", "0.54507947", "0.5449167", "0.5448703", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "0.54459953", "...
0.0
-1
More lowerlevel change function, handling only a single document (not linked ones).
function makeChangeSingleDoc(doc, change, selAfter, spans) { if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) } if (change.to.line < doc.first) { shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line)); return }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "change(docId, doc) {\n const cleanedDoc = this._getCleanedObject(doc);\n let storedDoc = this.store[docId];\n deepExtend(storedDoc, cleanedDoc);\n\n let changedData = {};\n _.each(cleanedDoc, (value, key) => {\n changedData[key] = storedDoc[key];\n });\n\n ...
[ "0.70032144", "0.66065466", "0.6573964", "0.65447193", "0.6487679", "0.6487679", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.6454598", "0.640634", "0.640634", "0.640634", "...
0.6435666
21
Handle the interaction of a change to a document with the editor that this document is part of.
function makeChangeSingleDocInEditor(cm, change, spans) { var doc = cm.doc, display = cm.display, from = change.from, to = change.to; var recomputeMaxLength = false, checkWidthStart = from.line; if (!cm.options.lineWrapping) { checkWidthStart = lineNo(visualLine(getLine(doc, from.line))); doc.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _onCurrentDocumentChange() {\n var doc = DocumentManager.getCurrentDocument(),\n container = _editorHolder.get(0);\n \n var perfTimerName = PerfUtils.markStart(\"EditorManager._onCurrentDocumentChange():\\t\" + (!doc || doc.file.fullPath));\n\n // Remove scroller-sha...
[ "0.6988773", "0.68636054", "0.6660369", "0.659211", "0.65215796", "0.638791", "0.6327432", "0.63088477", "0.62785864", "0.62495303", "0.6163697", "0.6127141", "0.6116209", "0.6116209", "0.6100855", "0.60965884", "0.6076851", "0.6076851", "0.6037296", "0.60166854", "0.60105", ...
0.59418476
58
Rebasing/resetting history to deal with externallysourced changes
function rebaseHistSelSingle(pos, from, to, diff) { if (to < pos.line) { pos.line += diff; } else if (from < pos.line) { pos.line = from; pos.ch = 0; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetHistory() {\n // TODO: clean out localStorage\n ExCommandHistory.resetHistory();\n }", "function clearChangeHistory() {\n changeHistory = [];\n historyPosition = 0;\n }", "function setHistory() {\n // clear undo history\n $('#undoHistoryList')\n .empty()...
[ "0.7397952", "0.7375274", "0.711438", "0.6920561", "0.6904765", "0.687358", "0.686189", "0.680521", "0.67269665", "0.6600654", "0.6581299", "0.65552354", "0.65401167", "0.6529911", "0.6517975", "0.6485189", "0.6480019", "0.64591163", "0.6439742", "0.64371014", "0.64327615", ...
0.0
-1
Tries to rebase an array of history events given a change in the document. If the change touches the same lines as the event, the event, and everything 'behind' it, is discarded. If the change is before the event, the event's positions are updated. Uses a copyonwrite scheme for the positions, to avoid having to realloc...
function rebaseHistArray(array, from, to, diff) { for (var i = 0; i < array.length; ++i) { var sub = array[i], ok = true; if (sub.ranges) { if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; } for (var j = 0; j < sub.ranges.length; j++) { rebaseHistSelSingle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (!sub.copied) { cur.from = copyPos(cur.from); cur.to = copyPos(cur.to); }\n ...
[ "0.6718455", "0.6718455", "0.6718455", "0.6718455", "0.6492295", "0.648774", "0.6472811", "0.6472811", "0.6472811", "0.6472811", "0.6472811", "0.6472811", "0.6472811", "0.64685804", "0.64341486", "0.64341486", "0.6425354", "0.6421519", "0.63940966", "0.63940966", "0.63940966"...
0.64719915
28
Utility for applying a change to a line by handle or number, returning the number and optionally registering the line as changed.
function changeLine(doc, handle, changeType, op) { var no = handle, line = handle; if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); } else { no = lineNo(handle); } if (no == null) { return null } if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); } r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeLine(doc, handle, changeType, op) {\n\t var no = handle, line = handle;\n\t if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n\t else no = lineNo(handle);\n\t if (no == null) return null;\n\t if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType)...
[ "0.7356353", "0.7356353", "0.7356353", "0.73486423", "0.73486423", "0.73486423", "0.73486423", "0.73486423", "0.73486423", "0.73486423", "0.7346209", "0.73159844", "0.7314361", "0.7234829", "0.7234829", "0.7226441", "0.7226441", "0.7226441", "0.7226441", "0.7226441", "0.72264...
0.73417675
24
The document is represented as a BTree consisting of leaves, with chunk of lines in them, and branches, with up to ten leaves or other branch nodes below them. The top node is always a branch node, and is the document object itself (meaning it has additional methods and properties). All nodes have parent links. The tre...
function LeafChunk(lines) { var this$1 = this; this.lines = lines; this.parent = null; var height = 0; for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1; height += lines[i].height; } this.height = height; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BTree(){\n\tthis.root = null;\n\tthis.length = 0;\n}", "function documentFragment(children, height, depth, maxFontSize) {\n this.children = children || [];\n this.height = height || 0;\n this.depth = depth || 0;\n this.maxFontSize = maxFontSize || 0;\n}", "function documentFragment(childre...
[ "0.56859744", "0.54539", "0.54539", "0.53151244", "0.5282311", "0.5281514", "0.5276573", "0.52501154", "0.52340657", "0.5199419", "0.51836556", "0.51800025", "0.5177543", "0.51744926", "0.5172286", "0.5172286", "0.5167587", "0.5155838", "0.5155838", "0.5152973", "0.5139416", ...
0.5045281
49
Create a marker, wire it up to the right lines, and
function markText(doc, from, to, options, type) { // Shared markers (across linked documents) are handled separately // (markTextShared will call out to this again, once per // document). if (options && options.shared) { return markTextShared(doc, from, to, options, type) } // Ensure we are in an op...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawMarker(lineWidth, lineHeightPerc, offset, markerLength, horiz) {\n var start, end;\n var height = em.height();\n if (horiz) {\n start = { x: offset, y: height};\n end = { x: offset, y: height - (markerLength*lineHeightPerc)};\n...
[ "0.706403", "0.6922555", "0.6829682", "0.67605793", "0.6707079", "0.66788775", "0.6592433", "0.6586964", "0.6577096", "0.6535049", "0.645897", "0.6454014", "0.6452927", "0.644539", "0.6428748", "0.64162165", "0.63716215", "0.6367775", "0.63661844", "0.6362076", "0.6345258", ...
0.0
-1
These must be handled carefully, because naively registering a handler for each editor will cause the editors to never be garbage collected.
function forEachCodeMirror(f) { if (!document.getElementsByClassName) { return } var byClass = document.getElementsByClassName("CodeMirror"); for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror; if (cm) { f(cm); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _registerHandlers(editor) {\n $(editor).on(\"keyEvent\", _cursorHandler);\n $(editor.document).one(\"change\", _handler);\n editor.document.addRef();\n }", "getEditorListeners() {\n return {\n focusout: 'onEditorFocusOut',\n focusin: 'onEditorFocusIn',\n start: ...
[ "0.7412128", "0.6621844", "0.6621844", "0.6262634", "0.6257714", "0.607542", "0.6045522", "0.60446435", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", "0.597748", ...
0.0
-1
Called when the window resizes
function onResize(cm) { var d = cm.display; // Might be a text scaling operation, clear size caches. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; d.scrollbarsClipped = false; cm.setSize(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onWindowResize() {\n updateSizes();\n }", "function windowResized() {\n resize();\n redraw();\n}", "onWindowResize() {\n\t\tthis.windowHeight = this.getWindowHeight();\n\t\tthis.updatePosition();\n\t}", "function onWindowResize() {\n\n\t\t\t}", "function windowResized() {\n resizeCanvas...
[ "0.8751041", "0.8488573", "0.84693223", "0.8312482", "0.79967594", "0.79899037", "0.79610854", "0.79416203", "0.7917026", "0.7901147", "0.78813344", "0.78804415", "0.7867091", "0.7867091", "0.78272027", "0.7821096", "0.78160036", "0.7803246", "0.77958447", "0.7787981", "0.778...
0.0
-1
This is a kludge to keep keymaps mostly working as raw objects (backwards compatibility) while at the same time support features like normalization and multistroke key bindings. It compiles a new normalized keymap, and then updates the old object to reflect this.
function normalizeKeyMap(keymap) { var copy = {}; for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) { var value = keymap[keyname]; if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue } if (value == "...") { delete keymap[keyname]; continue } var keys = map(k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalizeKeyMap(keymap) {\n\t\t var copy = {};\n\t\t for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n\t\t var value = keymap[keyname];\n\t\t if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n\t\t if (value == \"...\") { delete keymap[keyname]; co...
[ "0.68504876", "0.6619002", "0.6602381", "0.6602381", "0.6601707", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.65574884", "0.58333474", "0.5548513", "0.5541882", "0.554113", "0.5...
0.66288286
17
Modifier key presses don't count as 'real' key presses for the purpose of keymap fallthrough.
function isModifierKey(value) { var name = typeof value == "string" ? value : keyNames[value.keyCode]; return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function usualKeys(e) {\n\t\t\tview.put(String.fromCharCode(e.which));\n\t\t\treturn false;\n\t\t}", "function bufferModifier(e) { return e.shiftKey*1 + e.ctrlKey*2 + e.altKey*4 }", "function keyName(event, noShift) {\n\t\t if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n\t\t var ...
[ "0.71549004", "0.69038826", "0.684083", "0.6807286", "0.6790032", "0.67511195", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", "0.6713231", ...
0.6497272
61
Look up the name of a key as indicated by an event object.
function keyName(event, noShift) { if (presto && event.keyCode == 34 && event["char"]) { return false } var name = keyNames[event.keyCode]; if (name == null || event.altGraphKey) { return false } // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause, // so we'll use event.code when available (Chrome ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEventName(event_id) {\n for(var i in event_reference) {\n var obj = event_reference[i];\n if(obj.id === event_id)\n return obj.name;\n }\n return undefined;\n}", "function grabKey(obj, key) {\n return obj[key];\n}", "function getKey(object, key) {\n return obje...
[ "0.68437785", "0.66774225", "0.6616543", "0.63617873", "0.6232344", "0.58947927", "0.58873767", "0.582189", "0.5820872", "0.57668227", "0.57626027", "0.5733329", "0.57292217", "0.571779", "0.571779", "0.571779", "0.571779", "0.57143486", "0.57070446", "0.57045966", "0.5690433...
0.0
-1
Helper for deleting text near the selection(s), used to implement backspace, delete, and similar functionality.
function deleteNearSelection(cm, compute) { var ranges = cm.doc.sel.ranges, kill = []; // Build up a set of ranges to kill first, merging overlapping // ranges. for (var i = 0; i < ranges.length; i++) { var toKill = compute(ranges[i]); while (kill.length && cmp(toKill.from, lst(kill).to) <= ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeTextSelections() {\n if (document.selection) document.selection.empty();\n else if (window.getSelection) window.getSelection().removeAllRanges();\n}", "function removeTextSelection() {\n\n if (window.getSelection) {\n\n window.getSelection().removeAllRanges();\n\n } else if (document.se...
[ "0.7447715", "0.7392373", "0.70983833", "0.70505744", "0.69707197", "0.69394445", "0.69200784", "0.6823771", "0.6810343", "0.68008053", "0.6721571", "0.67189825", "0.67189825", "0.67189825", "0.67189825", "0.67189825", "0.67189825", "0.67189825", "0.67189825", "0.67189825", "...
0.577363
91
Run a handler that was bound to a key.
function doHandleBinding(cm, bound, dropShift) { if (typeof bound == "string") { bound = commands[bound]; if (!bound) { return false } } // Ensure previous input has been read, so that the handler sees a // consistent view of the document cm.display.input.ensurePolled(); var prevShif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getBindingHandler (/* key */) {}", "function receive(key, handler) {\n pxsim.board().bus.listen(key, 0x1, handler);\n }", "function bind(key, action) {\r\n bindings[key] = action; \r\n\r\n}", "function listen(key, callback) {\n handlers[key] = callback;\n}", "function handleCb(key, ...
[ "0.66893464", "0.6387576", "0.6263076", "0.6140119", "0.6125587", "0.5889015", "0.5853597", "0.5827518", "0.5789461", "0.5789461", "0.5789461", "0.5789461", "0.5789461", "0.57228875", "0.5662782", "0.5644284", "0.5632373", "0.5600212", "0.5537149", "0.55028874", "0.5479583", ...
0.0
-1
Handle a key from the keydown event.
function handleKeyBinding(cm, e) { var name = keyName(e, true); if (!name) { return false } if (e.shiftKey && !cm.state.keySeq) { // First try to resolve full name (including 'Shift-'). Failing // that, see if there is a cursor-motion command (starting with // 'go') bound to the keyname w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "HandleKeyDown(event) {}", "function keydown_handler(event)\n{\n\tif (event.defaultPrevented) return;\n\tif (game.handle_key(event.code, true)) return;\n\n\t// cancel the default action to avoid it being handled twice\n\tevent.preventDefault();\n}", "function keyDownHandler(event) {\n keyHandler(true, event)...
[ "0.7755275", "0.7531081", "0.72528416", "0.71958774", "0.7193752", "0.71915567", "0.7183363", "0.71574026", "0.712335", "0.71116465", "0.7088707", "0.7052036", "0.7050431", "0.7047419", "0.7047419", "0.70428956", "0.703125", "0.7002367", "0.69746387", "0.6955946", "0.69537616...
0.0
-1
Handle a key from the keypress event
function handleCharBinding(cm, e, ch) { return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "HandleKeyDown(event) {}", "function handleKeyPress({ key }) {\n dispatch(playerTyped(key.toLowerCase()));\n }", "handleInput(keycode) {\n if (keycode !== undefined && player.moves === true) {\n key = keycode;\n }\n }", "handleKeyPress(kEvent) {\n switch (kEvent.keyCod...
[ "0.7767834", "0.765871", "0.758574", "0.74911857", "0.741585", "0.7402115", "0.7374124", "0.737354", "0.73173136", "0.72986954", "0.7289434", "0.7274268", "0.7264864", "0.72491187", "0.72488683", "0.7228675", "0.7217789", "0.7216279", "0.7157265", "0.71438694", "0.71438676", ...
0.0
-1
A mouse down can be a single click, double click, triple click, start of selection drag, start of text drag, new cursor (ctrlclick), rectangle drag (altdrag), or xwin middleclickpaste. Or it might be a click on something we should not interfere with, such as a scrollbar or widget.
function onMouseDown(e) { var cm = this, display = cm.display; if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return } display.input.ensurePolled(); display.shift = e.shiftKey; if (eventInWidget(display, e)) { if (!webkit) { // Briefly turn off dr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefl...
[ "0.7091538", "0.7091538", "0.70911586", "0.70911586", "0.70911586", "0.70911586", "0.70911586", "0.70911586", "0.70911586", "0.70911586", "0.70911586", "0.70908904", "0.7087665", "0.70814776", "0.7055789", "0.7055789", "0.70555824", "0.70399", "0.70170754", "0.6998677", "0.69...
0.70232
32
Start a text drag. When it ends, see if any dragging actually happen, and treat as a click if it didn't.
function leftButtonStartDrag(cm, event, pos, behavior) { var display = cm.display, moved = false; var dragEnd = operation(cm, function (e) { if (webkit) { display.scroller.draggable = false; } cm.state.draggingText = false; off(display.wrapper.ownerDocument, "mouseup", dragEnd); off(disp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startDragText(evt)\r\n{\r\n\r\n if(ActiveElem&&!DraggingObj) //---prevents dragging conflicts on other draggable elements---\r\n {\r\n if(evt.target.parentNode.getAttribute(\"id\")==\"activeText\")\r\n {\r\n if(evt.target.parentNode.parentNode.getAttribute(\"class\")==\"drag...
[ "0.6689381", "0.64861673", "0.6454419", "0.6442164", "0.63774365", "0.62934095", "0.622602", "0.6050684", "0.6036101", "0.6016681", "0.6009714", "0.6001581", "0.59893286", "0.59748036", "0.5961804", "0.5918658", "0.5912148", "0.58981645", "0.58869565", "0.58803177", "0.585968...
0.0
-1
Normal selection, as opposed to text dragging.
function leftButtonSelect(cm, event, start, behavior) { var display = cm.display, doc = cm.doc; e_preventDefault(event); var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges; if (behavior.addNew && !behavior.extend) { ourIndex = doc.sel.contains(start); if (ourIndex > -1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "unselectText_() {\n try {\n this.win.getSelection().removeAllRanges();\n } catch (e) {\n // Selection API not supported.\n }\n }", "clearSelection() {\n this._clearSelection();\n }", "cut() {\n if (this.owner.isReadOnlyMode || this.selection.isEmpty) {\n return;\...
[ "0.74885833", "0.7268716", "0.7257491", "0.72482944", "0.72482944", "0.72482944", "0.7164153", "0.7164153", "0.71332663", "0.7116289", "0.7114912", "0.7097566", "0.7063641", "0.704988", "0.70417166", "0.70114183", "0.7003303", "0.69794875", "0.6955937", "0.6951775", "0.693761...
0.0
-1
Used when mouseselecting to adjust the anchor to the proper side of a bidi jump depending on the visual position of the head.
function bidiSimplify(cm, range$$1) { var anchor = range$$1.anchor; var head = range$$1.head; var anchorLine = getLine(cm.doc, anchor.line); if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range$$1 } var order = getOrder(anchorLine); if (!order) { return range$$1 } var i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setLabelAnchor(d) {\r\n if (d.target.x >= (d.source.x + 20)) return \"start\";\r\n if (d.target.x <= (d.source.x - 20)) return \"end\";\r\n return \"middle\";\r\n }", "function updateAnchorPos() {\n if (!labelSim.selection) return;\n\n labelSim.selection.each(function(d) {\n v...
[ "0.6865997", "0.65352046", "0.63302565", "0.6309565", "0.6135887", "0.6132395", "0.6033308", "0.6033308", "0.6033308", "0.5898258", "0.5860216", "0.5860216", "0.5860216", "0.5844974", "0.5740096", "0.5736967", "0.5736967", "0.5736967", "0.5736967", "0.569803", "0.56956744", ...
0.0
-1
Determines whether an event happened in the gutter, and fires the handlers for the corresponding event.
function gutterEvent(cm, e, type, prevent) { var mX, mY; if (e.touches) { mX = e.touches[0].clientX; mY = e.touches[0].clientY; } else { try { mX = e.clientX; mY = e.clientY; } catch(e) { return false } } if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gutterEvent(cm, e, type, prevent, signalfn) {\n try { var mX = e.clientX, mY = e.clientY; }\n catch(e) { return false; }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n if (prevent) e_preventDefault(e);\n\n var display = cm.display;\n var lineBox...
[ "0.6424223", "0.6424223", "0.6424223", "0.6424223", "0.6424223", "0.6424223", "0.6424223", "0.64166504", "0.63820106", "0.63625795", "0.63530976", "0.63412756", "0.6337135", "0.6337135", "0.6337135", "0.6337135", "0.6337135", "0.6337135", "0.63256717", "0.63256717", "0.632567...
0.6320734
29
CONTEXT MENU HANDLING To make the context menu work, we need to briefly unhide the textarea (making it as unobtrusive as possible) to let the rightclick take effect on it.
function onContextMenu(cm, e) { if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return } if (signalDOMEvent(cm, e, "contextmenu")) { return } if (!captureRightClick) { cm.display.input.onContextMenu(e); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rightClickHandler(ev, textarea, screenElement, selectionService, shouldSelectWord) {\n moveTextAreaUnderMouseCursor(ev, textarea, screenElement);\n if (shouldSelectWord) {\n selectionService.rightClickSelect(ev);\n }\n // Get textarea ready to copy from the context menu\n textarea.va...
[ "0.68555146", "0.6613691", "0.6610034", "0.65589243", "0.65370077", "0.65265536", "0.6479694", "0.64353794", "0.6356764", "0.63425994", "0.63180727", "0.63180727", "0.63047725", "0.62931454", "0.62931454", "0.62903816", "0.6225206", "0.6213413", "0.6207998", "0.61801744", "0....
0.5823754
70
A CodeMirror instance represents an editor. This is the object that user code is usually dealing with.
function CodeMirror(place, options) { var this$1 = this; if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) } this.options = options = options ? copyObj(options) : {}; // Determine effective options based on given values and defaults. copyObj(defaults, options, false); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options || {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);...
[ "0.7637769", "0.7595455", "0.7582652", "0.7582652", "0.75507426", "0.75500923", "0.75465775", "0.7529049", "0.7527881", "0.7526824", "0.7526294", "0.7526294", "0.74995637", "0.74958473", "0.74776506", "0.74776506", "0.74776506", "0.74776506", "0.74776506", "0.74776506", "0.74...
0.7432956
31
Attach the necessary event handlers when initializing the editor
function registerEventHandlers(cm) { var d = cm.display; on(d.scroller, "mousedown", operation(cm, onMouseDown)); // Older IE's will not fire a second mousedown for a double click if (ie && ie_version < 11) { on(d.scroller, "dblclick", operation(cm, function (e) { if (signalDOMEvent(cm, e)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n\n\t\t// Bind the editor elements to variables\n\t\tbindElements();\n\n\t\t// Create event listeners for keyup, mouseup, etc.\n\t\tcreateEventBindings();\n\t}", "initEventListners() {\n this.engine.getSession().selection.on('changeCursor', () => this.updateCursorLabels());\n\n th...
[ "0.80966556", "0.77389115", "0.75494534", "0.72982234", "0.7282955", "0.723292", "0.7122359", "0.71221983", "0.71001315", "0.7071713", "0.7025846", "0.6915193", "0.6894815", "0.68728834", "0.685716", "0.68458426", "0.68189013", "0.6798981", "0.6797055", "0.6743994", "0.672856...
0.0
-1
Indent the given line. The how parameter can be "smart", "add"/null, "subtract", or "prev". When aggressive is false (typically set to true for forced singleline indents), empty lines are not indented, and places where the mode returns Pass are left alone.
function indentLine(cm, n, how, aggressive) { var doc = cm.doc, state; if (how == null) { how = "add"; } if (how == "smart") { // Fall back to "prev" when the mode doesn't have an indentation // method. if (!doc.mode.indent) { how = "prev"; } else { state = getContextBefore(cm, n).st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function indentLine(cm, n, how, aggressive) {\n\t var doc = cm.doc, state;\n\t if (how == null) how = \"add\";\n\t if (how == \"smart\") {\n\t // Fall back to \"prev\" when the mode doesn't have an indentation\n\t // method.\n\t if (!doc.mode.indent) how = \"prev\";\n\t else state = ge...
[ "0.7559429", "0.7559429", "0.75495756", "0.75352246", "0.75240046", "0.7493951", "0.74812", "0.74812", "0.74668497", "0.74473864", "0.74473864", "0.74473864", "0.74473864", "0.74359816", "0.7413695", "0.7406404", "0.7406404", "0.7406404", "0.7406404", "0.7406404", "0.7406404"...
0.7503435
16
The publicly visible API. Note that methodOp(f) means 'wrap f in an operation, performed on its `this` parameter'. This is not the complete set of editor methods. Most of the methods defined on the Doc type are also injected into CodeMirror.prototype, for backwards compatibility and convenience.
function addEditorMethods(CodeMirror) { var optionHandlers = CodeMirror.optionHandlers; var helpers = CodeMirror.helpers = {}; CodeMirror.prototype = { constructor: CodeMirror, focus: function(){window.focus(); this.display.input.focus();}, setOption: function(option, value) { v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, valu...
[ "0.6675193", "0.6675193", "0.6675193", "0.6675193", "0.6675193", "0.66579515", "0.6635314", "0.6635314", "0.66196305", "0.66196305", "0.66196305", "0.66196305", "0.66196305", "0.66196305", "0.66078043", "0.6596803", "0.6596803", "0.61544967", "0.613479", "0.613479", "0.613479...
0.6675193
5
Used for horizontal relative motion. Dir is 1 or 1 (left or right), unit can be "char", "column" (like char, but doesn't cross line boundaries), "word" (across next word), or "group" (to the start of next group of word or nonwordnonwhitespace chars). The visually param controls whether, in righttoleft text, direction 1...
function findPosH(doc, pos, dir, unit, visually) { var oldPos = pos; var origDir = dir; var lineObj = getLine(doc, pos.line); function findNextLine() { var l = pos.line + dir; if (l < doc.first || l >= doc.first + doc.size) { return false } pos = new Pos(l, pos.ch, pos.sticky); r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findPosH(doc, pos, dir, unit, visually) {\r\n var line = pos.line, ch = pos.ch, origDir = dir;\r\n var lineObj = getLine(doc, line);\r\n var possible = true;\r\n function findNextLine() {\r\n var l = line + dir;\r\n if (l < doc.first || l >= doc.first + doc.size) return (possible = f...
[ "0.6130519", "0.6126427", "0.6126427", "0.6126427", "0.6126427", "0.6126427", "0.6126427", "0.6123693", "0.60945994", "0.60565317", "0.6052235", "0.6028111", "0.60225946", "0.60225946", "0.60225946", "0.59996206", "0.59996206", "0.5997345", "0.59868014", "0.5910987", "0.59061...
0.5976428
24
For relative vertical movement. Dir may be 1 or 1. Unit can be "page" or "line". The resulting position will have a hitSide=true property if it reached the end of the document.
function findPosV(cm, pos, dir, unit) { var doc = cm.doc, x = pos.left, y; if (unit == "page") { var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3); y = (dir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n ...
[ "0.69151056", "0.69151056", "0.6821693", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.6810372", "0.68065315", "0.68065315", "0.67795277", "0.67302203", "0.67302203", "0.67302203", "0.67302...
0.6870279
11
Selectall will be greyed out if there's nothing to select, so this adds a zerowidth space so that we can later check whether it got selected.
function prepareSelectAllHack() { if (te.selectionStart != null) { var selected = cm.somethingSelected(); var extval = "\u200b" + (selected ? te.value : ""); te.value = "\u21da"; // Used to catch context-menu undo te.value = extval; input.prevInput = selected ? "" : "\u200b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectAll()\r\n\t\t{\r\n\t\t\tthis.focus();\r\n\t\t\tthis.select();\r\n\t\t}", "function show_select_all(){\r\n var th = getPatternResult(PATTERN['select_all']).snapshotItem(0);\r\n if (th == null) \r\n return;\r\n th.innerHTML = '<input type=\"checkbox\"/>';\r\n th.setAttribute('titl...
[ "0.7962586", "0.68508226", "0.6849682", "0.6849682", "0.6849682", "0.6849682", "0.6849682", "0.6836901", "0.6795213", "0.67752296", "0.676283", "0.676283", "0.676283", "0.67515665", "0.67515665", "0.6742831", "0.6742831", "0.67361194", "0.6732308", "0.67188287", "0.67188287",...
0.67083514
47
Function to create the first processor.
function unified() { var attachers = [] var transformers = trough() var namespace = {} var frozen = false var freezeIndex = -1 /* Data management. */ processor.data = data /* Lock. */ processor.freeze = freeze /* Plug-ins. */ processor.attachers = attachers processor.use = use /* API. */ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function DeviceProcessor() {\n\tvar builder = new processor.Chain();\n\tbuilder.Add(save_flags);\n\tbuilder.Add(strip_syslog_priority);\n\tbuilder.Add(chain1);\n\tbuilder.Add(populate_fields);\n\tbuilder.Add(restore_flags);\n\tvar chain = builder.Build();\n\treturn {\n\t\tprocess: chain.Run,\n\t}\n}", "function ...
[ "0.58117294", "0.58117294", "0.58117294", "0.5587444", "0.5587444", "0.55766463", "0.54808366", "0.54090774", "0.53975576", "0.53039163", "0.52645934", "0.51741904", "0.51741904", "0.51741904", "0.51689416", "0.50885534", "0.5075839", "0.5067456", "0.5064785", "0.5058559", "0...
0.5479166
10
Create a new processor based on the processor in the current scope.
function processor() { var destination = unified() var length = attachers.length var index = -1 while (++index < length) { destination.use.apply(null, attachers[index]) } destination.data(extend(true, {}, namespace)) return destination }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function unified() {\n var attachers = []\n var transformers = trough()\n var namespace = {}\n var freezeIndex = -1\n var frozen\n\n // Data management.\n processor.data = data\n\n // Lock.\n processor.freeze = freeze\n\n // Plugins.\n processor.attachers = attachers\n processor.use = use\n\n // API.\...
[ "0.6117301", "0.6117301", "0.60486126", "0.5904408", "0.5904408", "0.5904408", "0.5904408", "0.5904408", "0.58828163", "0.5800185", "0.5721235", "0.56447303", "0.5328679", "0.52514666", "0.52514666", "0.52514666", "0.5194525", "0.51114035", "0.51101834", "0.51099145", "0.5081...
0.48947236
32
Data management. Getter / setter for processorspecific informtion.
function data(key, value) { if (string(key)) { /* Set `key`. */ if (arguments.length === 2) { assertUnfrozen('data', frozen) namespace[key] = value return processor } /* Get `key`. */ return (own.call(namespace, key) && namespace[key]) || null } /* S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get data() {\n\t\treturn this.__data;\n\t}", "function processedSFData() {\n\t\tthis.moteid = idMote;\n\t\tthis.sensorType = sensorType;\n\t\tthis.lastTimestamp = lastTimeStamp;\n\t\tthis.lastValue = lastValue;\n\t\tthis.arrayValuesDay = valuesDay;\n\t\tthis.populationDay = populationDay;\n\t\tthis.arrayValuesWe...
[ "0.6882254", "0.68435836", "0.6732056", "0.6642908", "0.6597483", "0.65298647", "0.64972115", "0.64913255", "0.64820457", "0.64820457", "0.64820457", "0.6423674", "0.63416713", "0.63211304", "0.63187164", "0.63104314", "0.62410027", "0.6230067", "0.62212604", "0.6212552", "0....
0.0
-1
Plugin management. Pass it: an attacher and options, a preset, a list of presets, attachers, and arguments (list of attachers and options).
function use(value) { var settings assertUnfrozen('use', frozen) if (value === null || value === undefined) { /* Empty */ } else if (typeof value === 'function') { addPlugin.apply(null, arguments) } else if (typeof value === 'object') { if ('length' in value) { addList(va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function registerPresets(newPresets) {\n Object.keys(newPresets).forEach(function (name) {\n return registerPreset(name, newPresets[name]);\n });\n } // All the plugins we should bundle", "function handlePlugins$1(inputs, calendar) {\n calendar.addPluginInputs(inputs); // will ...
[ "0.55727583", "0.55137944", "0.5491354", "0.5477057", "0.5477057", "0.5477057", "0.54474187", "0.5436628", "0.5425356", "0.54101443", "0.54101443", "0.5381722", "0.5378221", "0.53756124", "0.53603595", "0.53582263", "0.53397644", "0.53294885", "0.53237104", "0.5295137", "0.52...
0.5292157
23
Parse a file (in string or VFile representation) into a Unist node using the `Parser` on the processor.
function parse(doc) { var file = vfile(doc) var Parser freeze() Parser = processor.Parser assertParser('parse', Parser) if (newable(Parser)) { return new Parser(String(file), file).parse() } return Parser(String(file), file) // eslint-disable-line new-cap }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Parser(doc, file) {\n this.file = file;\n this.offset = {};\n this.options = xtend(this.options);\n this.setOptions({});\n\n this.inList = false;\n this.inBlock = false;\n this.inLink = false;\n this.atStart = true;\n\n this.toOffset = vfileLocation(file).toOffset;\n this.unescape = unescape(thi...
[ "0.6035281", "0.599663", "0.59361535", "0.5814588", "0.57627934", "0.57627934", "0.57627934", "0.5695019", "0.565769", "0.5630263", "0.5630263", "0.5630263", "0.5630263", "0.5630263", "0.5630263", "0.5603139", "0.5554233", "0.533918", "0.52537864", "0.5195392", "0.5108613", ...
0.57612985
10
Run transforms on a Unist node representation of a file (in string or VFile representation), async.
function run(node, file, cb) { assertNode(node) freeze() if (!cb && typeof file === 'function') { cb = file file = null } if (!cb) { return new Promise(executor) } executor(null, cb) function executor(resolve, reject) { transformers.run(node, vfile(file), done...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(no...
[ "0.65101844", "0.65101844", "0.6500248", "0.6294634", "0.57297754", "0.57229096", "0.5722432", "0.5682045", "0.5500241", "0.5500241", "0.54538906", "0.5404583", "0.53382605", "0.5318412", "0.5295097", "0.529395", "0.52614886", "0.51727426", "0.51727426", "0.51727426", "0.5172...
0.64889526
7
Run transforms on a Unist node representation of a file (in string or VFile representation), sync.
function runSync(node, file) { var complete = false var result run(node, file, done) assertDone('runSync', 'run', complete) return result function done(err, tree) { complete = true bail(err) result = tree } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(no...
[ "0.64591384", "0.64591384", "0.644205", "0.644205", "0.644205", "0.644205", "0.644205", "0.644205", "0.6432624", "0.61897737", "0.60022", "0.60022", "0.5855565", "0.57527465", "0.5723397", "0.5631104", "0.55550617", "0.5509079", "0.5498221", "0.53799146", "0.5358135", "0.53...
0.5191977
30
Stringify a Unist node representation of a file (in string or VFile representation) into a string using the `Compiler` on the processor.
function stringify(node, doc) { var file = vfile(doc) var Compiler freeze() Compiler = processor.Compiler assertCompiler('stringify', Compiler) assertNode(node) if (newable(Compiler)) { return new Compiler(node, file).compile() } return Compiler(node, file) // eslint-disable...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stringify(node, doc) {\n var file = vfile(doc)\n var Compiler\n\n freeze()\n Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler, 'compile')) {\n return new Compiler(node, file).compile()\n }\n\n return Compiler(...
[ "0.5808293", "0.5808293", "0.5808293", "0.58024395", "0.5792998", "0.57217157", "0.55632764", "0.5119388", "0.49445158", "0.49397016", "0.49352276", "0.48916024", "0.4888284", "0.47806638", "0.47707263", "0.47499153", "0.47473553", "0.46570024", "0.4651487", "0.46407887", "0....
0.5798637
7
Parse a file (in string or VFile representation) into a Unist node using the `Parser` on the processor, then run transforms on that node, and compile the resulting node using the `Compiler` on the processor, and store that result on the VFile.
function process(doc, cb) { freeze() assertParser('process', processor.Parser) assertCompiler('process', processor.Compiler) if (!cb) { return new Promise(executor) } executor(null, cb) function executor(resolve, reject) { var file = vfile(doc) pipeline.run(processor, {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function run(node, file, cb) {\n assertNode(node)\n freeze()\n\n if (!cb && typeof file === 'function') {\n cb = file\n file = null\n }\n\n if (!cb) {\n return new Promise(executor)\n }\n\n executor(null, cb)\n\n function executor(resolve, reject) {\n transformers.run(no...
[ "0.5783369", "0.5783369", "0.57678044", "0.57678044", "0.57678044", "0.57678044", "0.57678044", "0.57678044", "0.573477", "0.5524739", "0.5524739", "0.55166644", "0.5511736", "0.54946756", "0.5463103", "0.5417252", "0.5406631", "0.53526235", "0.53465986", "0.5324869", "0.5324...
0.55421233
14
Process the given document (in string or VFile representation), sync.
function processSync(doc) { var complete = false var file freeze() assertParser('processSync', processor.Parser) assertCompiler('processSync', processor.Compiler) file = vfile(doc) process(file, done) assertDone('processSync', 'process', complete) return file function done(e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processSync(doc) {\n var file;\n var complete;\n\n freeze();\n assertParser('processSync', processor.Parser);\n assertCompiler('processSync', processor.Compiler);\n file = vfile(doc);\n\n process(file, done);\n\n assertDone('processSync', 'process', complete);\n\n return file\n\...
[ "0.7181942", "0.7127588", "0.70959693", "0.70959693", "0.65708774", "0.6547708", "0.6525776", "0.6525776", "0.6525776", "0.6525776", "0.6525776", "0.6525776", "0.6501485", "0.6501485", "0.5860337", "0.5381363", "0.5375347", "0.5256774", "0.51226515", "0.5107933", "0.5096684",...
0.7046547
8
Check if `func` is a constructor.
function newable(value) { return typeof value === 'function' && keys(value.prototype) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isConstructor(name, func) {\n return name[0] == name[0].toUpperCase();\n }", "function isCtor(constr) {\n return constr && !!constr.CONSTRUCTOR___;\n }", "function IsConstructor(o) {\n // Hacks for Safari 7 TypedArray XXXConstructor objects\n if (/Constructor/.test(Object.protot...
[ "0.78567946", "0.77828586", "0.72959", "0.7212019", "0.70982814", "0.70852464", "0.705966", "0.70311177", "0.7030553", "0.69598", "0.69360584", "0.6911233", "0.6753676", "0.66875815", "0.66067296", "0.6506227", "0.6431026", "0.6381115", "0.6379887", "0.62503326", "0.6193139",...
0.0
-1
Check if `value` is an object with keys.
function keys(value) { var key for (key in value) { return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object');\n }", "function isKey(value, object) {\n if (Array.isArray(value)) {\n return false;\n }\n const type = typeof value;\n if (\n type === \"number\" ||\n type === \"boolean\" ||\n value ==...
[ "0.7191914", "0.71467626", "0.71403253", "0.71176916", "0.7086549", "0.7021256", "0.6997804", "0.6993788", "0.6949828", "0.6939899", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011", "0.693011...
0.6883021
27
Assert a parser is available.
function assertParser(name, Parser) { if (typeof Parser !== 'function') { throw new Error('Cannot `' + name + '` without `Parser`') } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertParser(name, Parser) {\n if (!func(Parser)) {\n throw new Error('Cannot `' + name + '` without `Parser`');\n }\n}", "async ensureParser() {\n if (!this.parser) {\n this.parser = await ASTParser.importASTParser();\n }\n }", "function _checkParser() {\n eval(Proce...
[ "0.7156712", "0.66241133", "0.62994504", "0.50442", "0.4859782", "0.4845704", "0.48403746", "0.48403746", "0.47225016", "0.47192085", "0.47178409", "0.47056007", "0.47056007", "0.47056007", "0.47056007", "0.47035977", "0.47035977", "0.47035977", "0.47035977", "0.46994075", "0...
0.7231354
6
Assert a compiler is available.
function assertCompiler(name, Compiler) { if (typeof Compiler !== 'function') { throw new Error('Cannot `' + name + '` without `Compiler`') } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertCompiler(name, Compiler) {\n if (!func(Compiler)) {\n throw new Error('Cannot `' + name + '` without `Compiler`');\n }\n}", "function startMyCompiler() {\n throw new Error('You have no compiler!');\n}", "function _isSupported() {\n _state = 1;\n if (typeof chai !== \"undefi...
[ "0.7280039", "0.6609343", "0.5701623", "0.55071414", "0.5359753", "0.5310645", "0.5287135", "0.5255695", "0.5185235", "0.51780653", "0.51780653", "0.510953", "0.50870246", "0.5071456", "0.5061714", "0.50458944", "0.50141674", "0.49524596", "0.49390462", "0.4907709", "0.490542...
0.7297869
6
Assert the processor is not frozen.
function assertUnfrozen(name, frozen) { if (frozen) { throw new Error( [ 'Cannot invoke `' + name + '` on a frozen processor.\nCreate a new ', 'processor first, by invoking it: use `processor()` instead of ', '`processor`.' ].join('') ) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot invoke `' + name + '` on a frozen processor.\\n' +\n 'Create a new processor first, by invoking it: ' +\n 'use `processor()` instead of `processor`.'\n );\n }\n}", "function assertUnfrozen(name, frozen) {\...
[ "0.763147", "0.762365", "0.762365", "0.762365", "0.762365", "0.6224439", "0.6096795", "0.5899092", "0.5878287", "0.570214", "0.570214", "0.570214", "0.570214", "0.570214", "0.570214", "0.5657232", "0.5657232", "0.5657232", "0.5657232", "0.5657232", "0.56491834", "0.56472737...
0.7521065
8
Assert `node` is a Unist node.
function assertNode(node) { if (!node || !string(node.type)) { throw new Error('Expected node, got `' + node + '`') } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertNode(node) {\n if (!node || !string(node.type)) {\n throw new Error('Expected node, got `' + node + '`');\n }\n}", "function assertNode(node) {\n if (!node || typeof node.type !== 'string') {\n throw new Error('Expected node, got `' + node + '`')\n }\n}", "function assertNode(node) {\n...
[ "0.62221384", "0.61372936", "0.61372936", "0.61372936", "0.61372936", "0.5832636", "0.5832636", "0.5619439", "0.5619439", "0.55803466", "0.55803466", "0.55803466", "0.52470446", "0.52253616", "0.5197108", "0.5097337", "0.5097337", "0.5097337", "0.5097337", "0.5046135", "0.504...
0.62289256
3
Assert that `complete` is `true`.
function assertDone(name, asyncName, complete) { if (!complete) { throw new Error( '`' + name + '` finished async. Use `' + asyncName + '` instead' ) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertDone(name, asyncName, complete) {\n if (!complete) {\n throw new Error('`' + name + '` finished async. Use `' + asyncName + '` instead');\n }\n}", "isComplete() {\n return (this.title === this.titleComplete) &&\n (this.labo === this.laboComplete) &&\n (this.univ =...
[ "0.64496076", "0.62851554", "0.61078316", "0.6088317", "0.6086782", "0.6085638", "0.6077784", "0.60390526", "0.6015842", "0.59758866", "0.5937751", "0.58899134", "0.5833281", "0.57518196", "0.57095605", "0.55940217", "0.558774", "0.5580275", "0.55591047", "0.55531603", "0.554...
0.6452487
6
Create a message with `reason` at `position`. When an error is passed in as `reason`, copies the stack.
function message(reason, position, origin) { var filePath = this.path; var message = new VMessage(reason, position, origin); if (filePath) { message.name = filePath + ':' + message.name; message.file = filePath; } message.fatal = false; this.messages.push(message); return message; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function message(reason, position, ruleId) {\n var filePath = this.path;\n var range = stringify(position) || '1:1';\n var location;\n var err;\n\n location = {\n start: {line: null, column: null},\n end: {line: null, column: null}\n };\n\n if (position && position.position) {\n position = position...
[ "0.6381248", "0.5829679", "0.5817722", "0.5817722", "0.5817722", "0.5814672", "0.5766498", "0.5684867", "0.5679618", "0.54449147", "0.5392339", "0.5223852", "0.52174985", "0.50576764", "0.5057408", "0.5057408", "0.5032766", "0.5025934", "0.50057685", "0.4889266", "0.4858025",...
0.56966686
10
Fail. Creates a vmessage, associates it with the file, and throws it.
function fail() { var message = this.message.apply(this, arguments); message.fatal = true; throw message; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fail(message) {\n throw new Error(message);\n }", "function fail(message) {\r\n\t throw new Error(message);\r\n\t}", "createFailureAtNode(node, message) {\n const sourceFile = node.getSourceFile();\n this.failures.push({\n filePath: this.fileSyst...
[ "0.62669474", "0.62532586", "0.6132922", "0.6082876", "0.5987928", "0.5987928", "0.5881269", "0.5881269", "0.5881269", "0.5881269", "0.5850965", "0.57309186", "0.57105887", "0.55708826", "0.55331993", "0.5513839", "0.5513839", "0.5513839", "0.5513839", "0.5513839", "0.5501027...
0.57952315
16
Info. Creates a vmessage, associates it with the file, and marks the fatality as null.
function info() { var message = this.message.apply(this, arguments); message.fatal = null; return message; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function info() {\n var message = this.message.apply(this, arguments)\n\n message.fatal = null\n\n return message\n}", "function info() {\n var message = this.message.apply(this, arguments)\n\n message.fatal = null\n\n return message\n}", "function info() {\n var message = this.message.apply(this, argum...
[ "0.65584934", "0.65584934", "0.65584934", "0.65584934", "0.6528591", "0.6275661", "0.61959714", "0.61930555", "0.61930555", "0.61930555", "0.61930555", "0.61930555", "0.6156254", "0.6156254", "0.6156254", "0.61109775", "0.58577347", "0.5675953", "0.5599736", "0.549691", "0.54...
0.6468086
8
Construct a new file.
function VFile(options) { var prop; var index; var length; if (!options) { options = {}; } else if (typeof options === 'string' || buffer(options)) { options = {contents: options}; } else if ('message' in options && 'messages' in options) { return options; } if (!(this instanceof VFile)) {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createFile() {\n var e = new emitter();\n\n fs.readFile('newdocument.txt', function (err) {\n if (err) throw err;\n e.emit('theProcess');\n });\n\n return e;\n}", "function createNewFile() {\n file = {\n name: 'novo-arquivo.txt',\n content: '',\n saved: ...
[ "0.6732228", "0.65486455", "0.6370457", "0.617571", "0.6127362", "0.6070642", "0.6070063", "0.6053265", "0.6018561", "0.5999493", "0.59618163", "0.5958732", "0.59435254", "0.58879983", "0.588575", "0.58559304", "0.58342546", "0.5803781", "0.5784671", "0.577569", "0.57531786",...
0.0
-1
Get the value of the file.
function toString(encoding) { var value = this.contents || ''; return buffer(value) ? value.toString(encoding) : String(value); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFile(){\n\n\t\treturn this.file;\n\t}", "Get(filename)\n {\n return \"\";\n }", "getText() {\r\n return this.clone(File, \"$value\", false).get(new TextParser(), { headers: { \"binaryStringResponseBody\": \"true\" } });\r\n }", "get file () {\n return this._file\n }", "functi...
[ "0.711178", "0.68999565", "0.6691765", "0.66412055", "0.6439003", "0.64349145", "0.6405714", "0.637939", "0.6368529", "0.6368529", "0.6324943", "0.6303016", "0.6242697", "0.60756075", "0.59203756", "0.58928937", "0.58921486", "0.5867203", "0.5867203", "0.5792994", "0.5783152"...
0.0
-1
Assert that `part` is not a path (i.e., does not contain `path.sep`).
function assertPart(part, name) { if (part.indexOf(path.sep) !== -1) { throw new Error('`' + name + '` cannot be a path: did not expect `' + path.sep + '`'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertPart(part, name) {\n if (part.indexOf(path.sep) !== -1) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + path.sep + '`'\n )\n }\n}", "function assertPart(part, name) {\n if (part.indexOf(path.sep) !== -1) {\n throw new Error(\n '`' + name + '` cann...
[ "0.8634517", "0.86085933", "0.85808706", "0.85808706", "0.85808706", "0.83589625", "0.6666308", "0.6666308", "0.6666308", "0.6666308", "0.6664525", "0.6664525", "0.6664525", "0.6664525", "0.6664525", "0.6664525", "0.6664525", "0.6614382", "0.5684847", "0.56838113", "0.5673563...
0.86380607
4
Assert that `part` is not empty.
function assertNonEmpty(part, name) { if (!part) { throw new Error('`' + name + '` cannot be empty'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}", "function assertNonEmpty(part, name) {\n if (!part) {\n throw new Er...
[ "0.82078385", "0.82078385", "0.82078385", "0.82078385", "0.8098381", "0.6483384", "0.6483384", "0.6483384", "0.6483384", "0.6483384", "0.6483384", "0.64686406", "0.6467794", "0.64403224", "0.6432958", "0.6432958", "0.6432958", "0.62206465", "0.60916746", "0.5781566", "0.57726...
0.82067513
9
For Node v0.10 support. Remove this eventually.
function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _node_p(){\n\tvar ret = false;\n\tif( anchor.environment() == 'Node.js' ){ ret = true; }\n\treturn ret;\n }", "function node_error(err) {\r\n node.error(err, err);\r\n }", "private public function m246() {}", "function NodeFsHandler() {}", "function NodeFsHandler() {}", "static reset(...
[ "0.5863474", "0.5705808", "0.568645", "0.55544066", "0.55544066", "0.5446477", "0.5434516", "0.5381192", "0.5356294", "0.53282356", "0.53189546", "0.52043676", "0.51996946", "0.5156968", "0.51501393", "0.51281303", "0.51281303", "0.51281303", "0.5112595", "0.5100047", "0.5090...
0.0
-1
Run `fns`. Last argument must be a completion handler.
function run() { var index = -1 var input = slice.call(arguments, 0, -1) var done = arguments[arguments.length - 1] if (typeof done !== 'function') { throw new Error('Expected function as last argument, not ' + done) } next.apply(null, [null].concat(input)) /* Run the next `fn`, if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runAll(whenFn, fns, resolveIdx) {\n //var deferred = when.defer();\n return whenFn(fns)\n .then(\n function(results) {\n return results[resolveIdx];\n },\n function(err) {\n return when.reject(err);\n }\n );\n}", "function run() {\n var index = -1;\n var inp...
[ "0.68478644", "0.66488874", "0.65061486", "0.65061486", "0.65061486", "0.65061486", "0.65061486", "0.65061486", "0.6376086", "0.617489", "0.59881306", "0.5942612", "0.5926571", "0.58897847", "0.5781694", "0.57793677", "0.56860965", "0.56757015", "0.5613648", "0.5584616", "0.5...
0.65281355
3
Run the next `fn`, if any.
function next(err) { var fn = fns[++index] var params = slice.call(arguments, 0) var values = params.slice(1) var length = input.length var pos = -1 if (err) { done(err) return } /* Copy non-nully input into values. */ while (++pos < length) { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function run(fn) {\n if (fn)\n fn(next);\n else\n callback(null, results);\n }", "function next(err, result) {\n if (err)\n return callback(err, results);\n results.push(result);\n if (fns.length)\n run(fns.shift());\n else\n callback(null, results);\n }", "function...
[ "0.78941613", "0.7258772", "0.66877997", "0.6568779", "0.6472971", "0.6472971", "0.6464633", "0.6464633", "0.6464633", "0.6464633", "0.6464633", "0.6464633", "0.64020425", "0.6374047", "0.6338008", "0.6277549", "0.62038606", "0.61732835", "0.61340165", "0.61340165", "0.613401...
0.6171807
19
Add `fn` to the list.
function use(fn) { if (typeof fn !== 'function') { throw new Error('Expected `fn` to be a function, not ' + fn) } fns.push(fn) return middleware }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addWithFunction(list, item, hashFunction) {\n if (findWithFunction(list, hashFunction) === -1) {\n list.push(item);\n }\n }", "custom(fn) {\r\n\t\treturn this.push('fn', [...arguments]);\r\n\t}", "function addToQueue(fn) {\n if (working) {\n queue.push(fn);\n }...
[ "0.6937784", "0.6697556", "0.62223893", "0.620402", "0.6063277", "0.60530466", "0.5974585", "0.5911953", "0.58088225", "0.58088225", "0.58088225", "0.58088225", "0.58088225", "0.58088225", "0.58088225", "0.5778424", "0.5762916", "0.5737459", "0.5720332", "0.5718001", "0.56721...
0.5733852
23
Wrap `fn`. Can be sync or async; return a promise, receive a completion handler, return new values and errors.
function wrap(fn, callback) { var invoked return wrapped function wrapped() { var params = slice.call(arguments, 0) var callback = fn.length > params.length var result if (callback) { params.push(done) } try { result = fn.apply(null, params) } catch (err) { /* Wel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wrap_sync (fn) {\n return function (params) {\n var val = fn(params)\n if (val && !isPromise(val)) throw val\n return val\n }\n}", "async function thenify(fn) {\n return await new Promise(function(resolve, reject) {\n function callback(err, res) {\n if (err) return reject(err);\n ...
[ "0.75723845", "0.6946835", "0.6856506", "0.68295383", "0.6647942", "0.65730035", "0.6559632", "0.6465274", "0.6465274", "0.64327705", "0.63656604", "0.6305889", "0.6305889", "0.6305889", "0.6305889", "0.6305889", "0.6305889", "0.62676936", "0.6259724", "0.625207", "0.6248762"...
0.6257096
20
Invoke `next`, only once.
function done() { if (!invoked) { invoked = true callback.apply(null, arguments) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "next () {}", "next() {}", "next() {\n this._next();\n }", "Next() {}", "function next() {\n subject = context.stack.tail.head;\n index = 0;\n test( subject );\n }", "async next() {\n this._executing = false;\n await this._execute();\n }", "function _next() {\n...
[ "0.78337926", "0.7766705", "0.742107", "0.7365195", "0.6899227", "0.6799684", "0.6630355", "0.6603183", "0.65826726", "0.6529928", "0.6470122", "0.6434803", "0.6434803", "0.6420854", "0.6374825", "0.6374825", "0.6349096", "0.63221407", "0.631236", "0.63065857", "0.63003343", ...
0.0
-1
Invoke `done` with one value. Tracks if an error is passed, too.
function then(value) { done(null, value) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function then(value) {\n done(null, value);\n }", "function finish (err) {\n if (!calledDone) {\n calledDone = true;\n done(err);\n }\n }", "function done() {}", "function done ( error ) {\n if (error) {\n that.error = error\n }\n if ( cb ) cb( error )\n }", "done() {}",...
[ "0.6571373", "0.6488745", "0.6473631", "0.6420267", "0.6381803", "0.6373509", "0.63661045", "0.63661045", "0.63661045", "0.63661045", "0.63661045", "0.63661045", "0.63661045", "0.63661045", "0.6287417", "0.6274371", "0.62423915", "0.6176341", "0.6172195", "0.60484797", "0.604...
0.6636376
7
Create a custom constructor which can be modified without affecting the original class.
function unherit(Super) { var result var key var value inherits(Of, Super) inherits(From, Of) /* Clone values. */ result = Of.prototype for (key in result) { value = result[key] if (value && typeof value === 'object') { result[key] = 'concat' in value ? value.concat() : xtend(value) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function temporaryConstructor() {}", "function Constructor() {}", "function Constructor() {}", "function Constructor() {}", "constructor() {\n copy(this, create());\n }", "new() {\n let newInstance = Object.create(this);\n\n newInstance.init(...arguments);\n\n return newInstance;\n }"...
[ "0.7258686", "0.7070626", "0.7070626", "0.7070626", "0.7062644", "0.70268816", "0.69127655", "0.68617797", "0.6758441", "0.6758441", "0.67081964", "0.67081964", "0.67081964", "0.67081964", "0.67081964", "0.67081964", "0.6666097", "0.6631405", "0.6616296", "0.66080546", "0.654...
0.0
-1
Constructor accepting a single argument, which itself is an `arguments` object.
function From(parameters) { return Super.apply(this, parameters) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function C(arg) {\n this.args = arguments;\n}", "constructor(args) {\n super(args);\n }", "constructor(args) {\n super(args);\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x99c1d49d;\n this.SUBCLASS_OF_ID = 0xeb9987b3;\n\n this....
[ "0.6960877", "0.64379203", "0.64379203", "0.63124055", "0.62877387", "0.62737846", "0.6272634", "0.62375265", "0.62284786", "0.62265486", "0.6200758", "0.6163937", "0.6160433", "0.6148898", "0.61483806", "0.6135509", "0.61281246", "0.61076164", "0.60998803", "0.60958815", "0....
0.0
-1
Constructor accepting variadic arguments.
function Of() { if (!(this instanceof Of)) { return new From(arguments) } return Super.apply(this, arguments) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static create(...args /* :Array<*> */) {\n\t\treturn new this(...args)\n\t}", "construct (target, args) {\n return new target(...args)\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x09333afb;\n this.SUBCLASS_OF_ID = 0xf1163490;\n\n thi...
[ "0.7136816", "0.6953033", "0.692598", "0.69021624", "0.69021624", "0.6878798", "0.6776414", "0.67102474", "0.6695473", "0.66910213", "0.6659877", "0.66535336", "0.6645595", "0.6640925", "0.6639501", "0.6638436", "0.66289335", "0.66243696", "0.66028565", "0.6594345", "0.658970...
0.0
-1
Get all keys in `value`.
function keys(value) { var result = []; var key; for (key in value) { result.push(key); } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function keys(value) {\n var result = []\n var key\n\n for (key in value) {\n result.push(key)\n }\n\n return result\n}", "function keys(value) {\n var key\n for (key in value) {\n return true\n }\n return false\n}", "function keys(value) {\n var key\n for (key in value) {\n return true\n ...
[ "0.83654433", "0.6577015", "0.6577015", "0.6577015", "0.6577015", "0.6577015", "0.6546291", "0.65166605", "0.65166605", "0.65166605", "0.6439548", "0.63332194", "0.62305605", "0.61524576", "0.6028577", "0.5955654", "0.57845986", "0.57845986", "0.569534", "0.56586033", "0.5628...
0.8280043
6
Construct a state `toggler`: a function which inverses `property` in context based on its current value. The by `toggler` returned function restores that value.
function factory(key, state, ctx) { return enter function enter() { var context = ctx || this var current = context[key] context[key] = !state return exit function exit() { context[key] = current } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toggleable_factory(prop = 'value', event = 'input') {\n return external_commonjs_vue_commonjs2_vue_root_Vue_default.a.extend({\n name: 'toggleable',\n model: {\n prop,\n event\n },\n props: {\n [prop]: {\n required: false\n }\n },\n\n data() {\n return {\...
[ "0.5624407", "0.5624407", "0.5624407", "0.56162673", "0.52129716", "0.51249146", "0.5085456", "0.50650775", "0.5043587", "0.5028423", "0.49811652", "0.49747854", "0.4938197", "0.49364012", "0.49305844", "0.49178904", "0.4913725", "0.48937052", "0.48874176", "0.4885378", "0.48...
0.0
-1
Factory to get the line and columnbased `position` for `offset` in the bound indices.
function offsetToPositionFactory(indices) { return offsetToPosition /* Get the line and column-based `position` for * `offset` in the bound indices. */ function offsetToPosition(offset) { var index = -1 var length = indices.length if (offset < 0) { return {} } while (++index < leng...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function positionToOffsetFactory(indices) {\n return positionToOffset\n\n // Get the `offset` for a line and column-based `position` in the bound\n // indices.\n function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line)...
[ "0.70763355", "0.70763355", "0.70763355", "0.7004144", "0.7004144", "0.7004144", "0.6975304", "0.6975304", "0.68680584", "0.68680584", "0.68680584", "0.68680584", "0.68680584", "0.6756796", "0.661255", "0.6544451", "0.6493372", "0.64535576", "0.64535576", "0.64453626", "0.644...
0.6980898
7
Get the line and columnbased `position` for `offset` in the bound indices.
function offsetToPosition(offset) { var index = -1 var length = indices.length if (offset < 0) { return {} } while (++index < length) { if (indices[index] > offset) { return { line: index + 1, column: offset - (indices[index - 1] || 0) + 1, offset:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getLineAndColumnFromChunk(offset) {\r\n\t\t\t\tvar column, columnCompensation, compensation, lastLine, lineCount, previousLinesCompensation, ref, string;\r\n\t\t\t\tcompensation = this.getLocationDataCompensation(this.chunkOffset, this.chunkOffset + offset);\r\n\t\t\t\tif (offset === 0) {\r\n\t\t\t\t\treturn [this...
[ "0.66768277", "0.6669494", "0.6658669", "0.6658669", "0.6652049", "0.6435141", "0.6435141", "0.6435141", "0.6418775", "0.63339", "0.6331776", "0.6331776", "0.6272726", "0.6272726", "0.6272726", "0.6272628", "0.6261748", "0.6261748", "0.62456626", "0.6239385", "0.6239385", "...
0.7061033
3