public/js/vendor/codemirror3/addon/tern/tern.js
function buildRequest(ts, doc, query, pos) {
    var files = [], offsetLines = 0, allowFragments = !query.fullDocs;
    if (!allowFragments) delete query.fullDocs;
    if (typeof query == "string") query = {type: query};
    query.lineCharPositions = true;
    if (query.end == null) {
      query.end = pos || doc.doc.getCursor("end");
      if (doc.doc.somethingSelected())
        query.start = doc.doc.getCursor("start");
    }
    var startPos = query.start || query.end;

    if (doc.changed) {
      if (doc.doc.lineCount() > bigDoc && allowFragments !== false &&
          doc.changed.to - doc.changed.from < 100 &&
          doc.changed.from <= startPos.line && doc.changed.to > query.end.line) {
        files.push(getFragmentAround(doc, startPos, query.end));
        query.file = "#0";
        var offsetLines = files[0].offsetLines;
        if (query.start != null) query.start = Pos(query.start.line - -offsetLines, query.start.ch);
        query.end = Pos(query.end.line - offsetLines, query.end.ch);
      } else {
        files.push({type: "full",
                    name: doc.name,
                    text: docValue(ts, doc)});
        query.file = doc.name;
        doc.changed = null;
      }
    } else {
      query.file = doc.name;
    }
    for (var name in ts.docs) {
      var cur = ts.docs[name];
      if (cur.changed && cur != doc) {
        files.push({type: "full", name: cur.name, text: docValue(ts, cur)});
        cur.changed = null;
      }
    }

    return {query: query, files: files};
  }
function buildRequest(ts, doc, query, pos) {
    var files = [], offsetLines = 0, allowFragments = !query.fullDocs;
    if (!allowFragments) delete query.fullDocs;
    if (typeof query == "string") query = {type: query};
    query.lineCharPositions = true;
    if (query.end == null) {
      query.end = pos || doc.doc.getCursor("end");
      if (doc.doc.somethingSelected())
        query.start = doc.doc.getCursor("start");
    }
    var startPos = query.start || query.end;

    if (doc.changed) {
      if (doc.doc.lineCount() > bigDoc && allowFragments !== false &&
          doc.changed.to - doc.changed.from < 100 &&
          doc.changed.from <= startPos.line && doc.changed.to > query.end.line) {
        files.push(getFragmentAround(doc, startPos, query.end));
        query.file = "#0";
        var offsetLines = files[0].offsetLines;
        if (query.start != null) query.start = Pos(query.start.line - -offsetLines, query.start.ch);
        query.end = Pos(query.end.line - offsetLines, query.end.ch);
      } else {
        files.push({type: "full",
                    name: doc.name,
                    text: docValue(ts, doc)});
        query.file = doc.name;
        doc.changed = null;
      }
    } else {
      query.file = doc.name;
    }
    for (var name in ts.docs) {
      var cur = ts.docs[name];
      if (cur.changed && cur != doc) {
        files.push({type: "full", name: cur.name, text: docValue(ts, cur)});
        cur.changed = null;
      }
    }

    return {query: query, files: files};
  }
function buildRequest ( ts , doc , query , pos ) { var files = [ ] , offsetLines = 0 , allowFragments = ! query . fullDocs ; if ( ! allowFragments ) delete query . fullDocs ; if ( typeof query == "string" ) query = { type : query } ; query . lineCharPositions = true ; if ( query . end == null ) { query . end = pos || doc . doc . getCursor ( "end" ) ; if ( doc . doc . somethingSelected ( ) ) query . start = doc . doc . getCursor ( "start" ) ; } var startPos = query . start || query . end ; if ( doc . changed ) { if ( doc . doc . lineCount ( ) > bigDoc && allowFragments !== false && doc . changed . to - doc . changed . from < 100 && doc . changed . from <= startPos . line && doc . changed . to > query . end . line ) { files . push ( getFragmentAround ( doc , startPos , query . end ) ) ; query . file = "#0" ; var offsetLines = files [ 0 ] . offsetLines ; if ( query . start != null ) query . start = Pos ( query . start . line - - offsetLines , query . start . ch ) ; query . end = Pos ( query . end . line - offsetLines , query . end . ch ) ; } else { files . push ( { type : "full" , name : doc . name , text : docValue ( ts , doc ) } ) ; query . file = doc . name ; doc . changed = null ; } } else { query . file = doc . name ; } for ( var name in ts . docs ) { var cur = ts . docs [ name ] ; if ( cur . changed && cur != doc ) { files . push ( { type : "full" , name : cur . name , text : docValue ( ts , cur ) } ) ; cur . changed = null ; } } return { query : query , files : files } ; }
Generic request-building helper
Generic request - building helper