src/JSUtils/ScopeManager.js
function requestHints(session, document) {
        var $deferredHints = $.Deferred(),
            hintPromise,
            sessionType = session.getType(),
            fileInfo = getFileInfo(session),
            offset = getOffset(session, fileInfo, null);

        _maybeReset(session, document);

        hintPromise = getTernHints(fileInfo, offset, sessionType.property);

        $.when(hintPromise).done(
            function (completions, fnType) {
                if (completions.completions) {
                    session.setTernHints(completions.completions);
                    session.setGuesses(null);
                } else {
                    session.setTernHints([]);
                    session.setGuesses(completions.properties);
                }

                $deferredHints.resolveWith(null);
            }
        ).fail(function () {
            $deferredHints.reject();
        });

        return $deferredHints.promise();
    }
function requestHints(session, document) {
        var $deferredHints = $.Deferred(),
            hintPromise,
            sessionType = session.getType(),
            fileInfo = getFileInfo(session),
            offset = getOffset(session, fileInfo, null);

        _maybeReset(session, document);

        hintPromise = getTernHints(fileInfo, offset, sessionType.property);

        $.when(hintPromise).done(
            function (completions, fnType) {
                if (completions.completions) {
                    session.setTernHints(completions.completions);
                    session.setGuesses(null);
                } else {
                    session.setTernHints([]);
                    session.setGuesses(completions.properties);
                }

                $deferredHints.resolveWith(null);
            }
        ).fail(function () {
            $deferredHints.reject();
        });

        return $deferredHints.promise();
    }
function requestHints ( session , document ) { var $deferredHints = $ . Deferred ( ) , hintPromise , sessionType = session . getType ( ) , fileInfo = getFileInfo ( session ) , offset = getOffset ( session , fileInfo , null ) ; _maybeReset ( session , document ) ; hintPromise = getTernHints ( fileInfo , offset , sessionType . property ) ; $ . when ( hintPromise ) . done ( function ( completions , fnType ) { if ( completions . completions ) { session . setTernHints ( completions . completions ) ; session . setGuesses ( null ) ; } else { session . setTernHints ( [ ] ) ; session . setGuesses ( completions . properties ) ; } $deferredHints . resolveWith ( null ) ; } ) . fail ( function ( ) { $deferredHints . reject ( ) ; } ) ; return $deferredHints . promise ( ) ; }
Request hints from Tern.

Note that successive calls to getScope may return the same objects, so
clients that wish to modify those objects (e.g., by annotating them based
on some temporary context) should copy them first. See, e.g.,
Session.getHints().

@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
hints have completed.
Request hints from Tern .