src/JSUtils/ScopeManager.js
function requestGuesses(session, document) {
        var $deferred = $.Deferred(),
            fileInfo = getFileInfo(session),
            offset = getOffset(session, fileInfo);

        postMessage({
            type: MessageIds.TERN_GET_GUESSES_MSG,
            fileInfo: fileInfo,
            offset: offset
        });

        var promise = addPendingRequest(fileInfo.name, offset, MessageIds.TERN_GET_GUESSES_MSG);
        promise.done(function (guesses) {
            session.setGuesses(guesses);
            $deferred.resolve();
        }).fail(function () {
            $deferred.reject();
        });

        return $deferred.promise();
    }
function requestGuesses(session, document) {
        var $deferred = $.Deferred(),
            fileInfo = getFileInfo(session),
            offset = getOffset(session, fileInfo);

        postMessage({
            type: MessageIds.TERN_GET_GUESSES_MSG,
            fileInfo: fileInfo,
            offset: offset
        });

        var promise = addPendingRequest(fileInfo.name, offset, MessageIds.TERN_GET_GUESSES_MSG);
        promise.done(function (guesses) {
            session.setGuesses(guesses);
            $deferred.resolve();
        }).fail(function () {
            $deferred.reject();
        });

        return $deferred.promise();
    }
function requestGuesses ( session , document ) { var $deferred = $ . Deferred ( ) , fileInfo = getFileInfo ( session ) , offset = getOffset ( session , fileInfo ) ; postMessage ( { type : MessageIds . TERN_GET_GUESSES_MSG , fileInfo : fileInfo , offset : offset } ) ; var promise = addPendingRequest ( fileInfo . name , offset , MessageIds . TERN_GET_GUESSES_MSG ) ; promise . done ( function ( guesses ) { session . setGuesses ( guesses ) ; $deferred . resolve ( ) ; } ) . fail ( function ( ) { $deferred . reject ( ) ; } ) ; return $deferred . promise ( ) ; }
Get a Promise for all of the known properties from TernJS, for the directory and file.
The properties will be used as guesses in tern.
@param {Session} session - the active hinting session
@param {Document} document - the document for which scope info is
desired
@return {jQuery.Promise} - The promise will not complete until the tern
request has completed.
Get a Promise for all of the known properties from TernJS for the directory and file . The properties will be used as guesses in tern .