src/JSUtils/ScopeManager.js
function getOffset(session, fileInfo, offset) {
        var newOffset;

        if (offset) {
            newOffset = {line: offset.line, ch: offset.ch};
        } else {
            newOffset = session.getCursor();
        }

        if (fileInfo.type === MessageIds.TERN_FILE_INFO_TYPE_PART) {
            newOffset.line = Math.max(0, newOffset.line - fileInfo.offsetLines);
        }

        return newOffset;
    }
function getOffset(session, fileInfo, offset) {
        var newOffset;

        if (offset) {
            newOffset = {line: offset.line, ch: offset.ch};
        } else {
            newOffset = session.getCursor();
        }

        if (fileInfo.type === MessageIds.TERN_FILE_INFO_TYPE_PART) {
            newOffset.line = Math.max(0, newOffset.line - fileInfo.offsetLines);
        }

        return newOffset;
    }
function getOffset ( session , fileInfo , offset ) { var newOffset ; if ( offset ) { newOffset = { line : offset . line , ch : offset . ch } ; } else { newOffset = session . getCursor ( ) ; } if ( fileInfo . type === MessageIds . TERN_FILE_INFO_TYPE_PART ) { newOffset . line = Math . max ( 0 , newOffset . line - fileInfo . offsetLines ) ; } return newOffset ; }
Get the current offset. The offset is adjusted for "part" updates.

@param {!Session} session - the current session
@param {{type: string, name: string, offsetLines: number, text: string}} fileInfo
- type of update, name of file, and the text of the update.
For "full" updates, the whole text of the file is present. For "part" updates,
the changed portion of the text. For "empty" updates, the file has not been modified
and the text is empty.
@param {{line: number, ch: number}=} offset - the default offset (optional). Will
use the cursor if not provided.
@return {{line: number, ch: number}}
Get the current offset . The offset is adjusted for part updates .