prevent entering doEditorChange while it is waiting to complete

This commit is contained in:
dloverin committed 2013-05-13 16:45:00 -04:00
1 parent 589dcb0719
commit 7288348147
1 file changed
+19 -3
@@ -716,14 +716,13 @@ define(function (require, exports, module) {
}
/**
* Called each time a new editor becomes active. Refreshes the outer scopes
* of the given file as well as of the other files in the given directory.
* Do the work to initialize a code hinting session.
*
* @param {Session} session - the active hinting session
* @param {Document} document - the document of the editor that has changed
* @param {boolean} shouldPrimePump - true if the pump should be primed.
*/
function handleEditorChange(session, document, shouldPrimePump) {
function doEditorChange(session, document, shouldPrimePump) {
var path = document.file.fullPath,
split = HintUtils.splitPath(path),
dir = split.dir,
@@ -785,6 +784,23 @@ define(function (require, exports, module) {
});
}
/**
* Called each time a new editor becomes active.
*
* @param {Session} session - the active hinting session
* @param {Document} document - the document of the editor that has changed
* @param {boolean} shouldPrimePump - true if the pump should be primed.
*/
function handleEditorChange(session, document, shouldPrimePump) {
if (addFilesPromise === null) {
doEditorChange(session, document, shouldPrimePump);
} else {
addFilesPromise.done(function () {
doEditorChange(session, document, shouldPrimePump);
});
}
}
/*
* Called each time the file associated with the active editor changes.
* Marks the file as being dirty and refresh its outer scope.