src/extensions/default/JavaScriptRefactoring/RefactoringUtils.js
function getScopeData(session, offset) {
        var path = session.path,
            fileInfo = {
                type: MessageIds.TERN_FILE_INFO_TYPE_FULL,
                name: path,
                offsetLines: 0,
                text: ScopeManager.filterText(session.getJavascriptText())
            };

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

        var ternPromise = ScopeManager.addPendingRequest(fileInfo.name, offset, MessageIds.TERN_SCOPEDATA_MSG);

        var result = new $.Deferred();

        ternPromise.done(function (response) {
            result.resolveWith(null, [response.scope]);
        }).fail(function () {
            result.reject();
        });

        return result;
    }
function getScopeData(session, offset) {
        var path = session.path,
            fileInfo = {
                type: MessageIds.TERN_FILE_INFO_TYPE_FULL,
                name: path,
                offsetLines: 0,
                text: ScopeManager.filterText(session.getJavascriptText())
            };

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

        var ternPromise = ScopeManager.addPendingRequest(fileInfo.name, offset, MessageIds.TERN_SCOPEDATA_MSG);

        var result = new $.Deferred();

        ternPromise.done(function (response) {
            result.resolveWith(null, [response.scope]);
        }).fail(function () {
            result.reject();
        });

        return result;
    }
function getScopeData ( session , offset ) { var path = session . path , fileInfo = { type : MessageIds . TERN_FILE_INFO_TYPE_FULL , name : path , offsetLines : 0 , text : ScopeManager . filterText ( session . getJavascriptText ( ) ) } ; ScopeManager . postMessage ( { type : MessageIds . TERN_SCOPEDATA_MSG , fileInfo : fileInfo , offset : offset } ) ; var ternPromise = ScopeManager . addPendingRequest ( fileInfo . name , offset , MessageIds . TERN_SCOPEDATA_MSG ) ; var result = new $ . Deferred ( ) ; ternPromise . done ( function ( response ) { result . resolveWith ( null , [ response . scope ] ) ; } ) . fail ( function ( ) { result . reject ( ) ; } ) ; return result ; }
Requests scope data from tern
@param {!Session} session
@param {!{line: number, ch: number}} offset
@return {!$.Promise} a jQuery promise that will be resolved with the scope data
Requests scope data from tern