src/JSUtils/node/TernNodeDomain.js
function buildRequest(fileInfo, query, offset) {
    query = {type: query};
    query.start = offset;
    query.end = offset;
    query.file = (fileInfo.type === MessageIds.TERN_FILE_INFO_TYPE_PART) ? "#0" : fileInfo.name;
    query.filter = false;
    query.sort = false;
    query.depths = true;
    query.guess = true;
    query.origins = true;
    query.types = true;
    query.expandWordForward = false;
    query.lineCharPositions = true;
    query.docs = true;
    query.urls = true;

    var request = {query: query, files: [], offset: offset, timeout: inferenceTimeout};
    if (fileInfo.type !== MessageIds.TERN_FILE_INFO_TYPE_EMPTY) {
        // Create a copy to mutate ahead
        var fileInfoCopy = JSON.parse(JSON.stringify(fileInfo));
        request.files.push(fileInfoCopy);
    }

    return request;
}
function buildRequest(fileInfo, query, offset) {
    query = {type: query};
    query.start = offset;
    query.end = offset;
    query.file = (fileInfo.type === MessageIds.TERN_FILE_INFO_TYPE_PART) ? "#0" : fileInfo.name;
    query.filter = false;
    query.sort = false;
    query.depths = true;
    query.guess = true;
    query.origins = true;
    query.types = true;
    query.expandWordForward = false;
    query.lineCharPositions = true;
    query.docs = true;
    query.urls = true;

    var request = {query: query, files: [], offset: offset, timeout: inferenceTimeout};
    if (fileInfo.type !== MessageIds.TERN_FILE_INFO_TYPE_EMPTY) {
        // Create a copy to mutate ahead
        var fileInfoCopy = JSON.parse(JSON.stringify(fileInfo));
        request.files.push(fileInfoCopy);
    }

    return request;
}
function buildRequest ( fileInfo , query , offset ) { query = { type : query } ; query . start = offset ; query . end = offset ; query . file = ( fileInfo . type === MessageIds . TERN_FILE_INFO_TYPE_PART ) ? "#0" : fileInfo . name ; query . filter = false ; query . sort = false ; query . depths = true ; query . guess = true ; query . origins = true ; query . types = true ; query . expandWordForward = false ; query . lineCharPositions = true ; query . docs = true ; query . urls = true ; var request = { query : query , files : [ ] , offset : offset , timeout : inferenceTimeout } ; if ( fileInfo . type !== MessageIds . TERN_FILE_INFO_TYPE_EMPTY ) { // Create a copy to mutate ahead var fileInfoCopy = JSON . parse ( JSON . stringify ( fileInfo ) ) ; request . files . push ( fileInfoCopy ) ; } return request ; }
Build an object that can be used as a request to tern.

@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 {string} query - the type of request being made
@param {{line: number, ch: number}} offset -
Build an object that can be used as a request to tern .