MCPcopy Create free account
hub / github.com/TruthHun/BookStack / applyChanges

Function applyChanges

static/editor.md/lib/codemirror/addon/tern/tern.js:480–496  ·  view source on GitHub ↗
(ts, changes)

Source from the content-addressed store, hash-verified

478
479 var nextChangeOrig = 0;
480 function applyChanges(ts, changes) {
481 var perFile = Object.create(null);
482 for (var i = 0; i < changes.length; ++i) {
483 var ch = changes[i];
484 (perFile[ch.file] || (perFile[ch.file] = [])).push(ch);
485 }
486 for (var file in perFile) {
487 var known = ts.docs[file], chs = perFile[file];;
488 if (!known) continue;
489 chs.sort(function(a, b) { return cmpPos(b.start, a.start); });
490 var origin = "*rename" + (++nextChangeOrig);
491 for (var i = 0; i < chs.length; ++i) {
492 var ch = chs[i];
493 known.doc.replaceRange(ch.text, ch.start, ch.end, origin);
494 }
495 }
496 }
497
498 // Generic request-building helper
499

Callers 1

renameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected