mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
Change Document 'change' event to send an array of change records rather than a linked list, matching v4 'changes' event
This commit is contained in:
1 parent
9abbbaeb4c
commit
87d7bb9e9f
9 files changed
+137
-113
No files matched your search
@@ -1321,29 +1321,32 @@ define(function (require, exports, module) {
|
||||
* Track the update area of the current document so we can tell if we can send
|
||||
* partial updates to tern or not.
|
||||
*
|
||||
* @param {{from: {line:number, ch: number}, to: {line:number, ch: number},
|
||||
* text: Array<string>}} changeList - the document changes (since last change or cumlative?)
|
||||
* @param {Array.<{from: {line:number, ch: number}, to: {line:number, ch: number},
|
||||
* text: Array<string>}>} changeList - the document changes (since last change event)
|
||||
*/
|
||||
function trackChange(changeList) {
|
||||
var changed = documentChanges;
|
||||
var changed = documentChanges, i;
|
||||
if (changed === null) {
|
||||
documentChanges = changed = {from: changeList.from.line, to: changeList.from.line};
|
||||
documentChanges = changed = {from: changeList[0].from.line, to: changeList[0].from.line};
|
||||
if (config.debug) {
|
||||
console.debug("ScopeManager: document has changed");
|
||||
}
|
||||
}
|
||||
|
||||
var end = changeList.from.line + (changeList.text.length - 1);
|
||||
if (changeList.from.line < changed.to) {
|
||||
changed.to = changed.to - (changeList.to.line - end);
|
||||
}
|
||||
for (i = 0; i < changeList.length; i++) {
|
||||
var thisChange = changeList[i],
|
||||
end = thisChange.from.line + (thisChange.text.length - 1);
|
||||
if (thisChange.from.line < changed.to) {
|
||||
changed.to = changed.to - (thisChange.to.line - end);
|
||||
}
|
||||
|
||||
if (end >= changed.to) {
|
||||
changed.to = end + 1;
|
||||
}
|
||||
if (end >= changed.to) {
|
||||
changed.to = end + 1;
|
||||
}
|
||||
|
||||
if (changed.from > changeList.from.line) {
|
||||
changed.from = changeList.from.line;
|
||||
if (changed.from > thisChange.from.line) {
|
||||
changed.from = thisChange.from.line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -453,7 +453,7 @@ define(function (require, exports, module) {
|
||||
// type has changed since the last hint computation
|
||||
if (this.needNewHints(session)) {
|
||||
if (key) {
|
||||
ScopeManager.handleFileChange({from: cursor, to: cursor, text: [key]});
|
||||
ScopeManager.handleFileChange([{from: cursor, to: cursor, text: [key]}]);
|
||||
ignoreChange = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user