function handleFunctionType(fileInfo, offset) {
    var request = buildRequest(fileInfo, "type", offset),
        error;

    request.query.preferFunction = true;

    var fnType = "";
    try {
        ternServer.request(request, function (ternError, data) {

            if (ternError) {
                _log("Error for Tern request: \n" + JSON.stringify(request) + "\n" + ternError);
                error = ternError.toString();
            } else {
                var file = ternServer.findFile(fileInfo.name);

                // convert query from partial to full offsets
                var newOffset = offset;
                if (fileInfo.type === MessageIds.TERN_FILE_INFO_TYPE_PART) {
                    newOffset = {line: offset.line + fileInfo.offsetLines, ch: offset.ch};
                }

                request = buildRequest(createEmptyUpdate(fileInfo.name), "type", newOffset);

                var expr = Tern.findQueryExpr(file, request.query);
                Infer.resetGuessing();
                var type = Infer.expressionType(expr);
                type = type.getFunctionType() || type.getType();

                if (type) {
                    fnType = getParameters(type);
                } else {
                    ternError = "No parameter type found";
                    _log(ternError);
                }
            }
        });
    } catch (e) {
        _reportError(e, fileInfo.name);
    }

    // Post a message back to the main thread with the completions
    self.postMessage({type: MessageIds.TERN_CALLED_FUNC_TYPE_MSG,
        file: _getNormalizedFilename(fileInfo.name),
        offset: offset,
        fnType: fnType,
        error: error
        });
}
Get the function type for the given offset

@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 offset into the file where we want completions for