src/search/FindInFiles.js
function doReplace(results, replaceText, options) {
        return FindUtils.performReplacements(results, replaceText, options).always(function () {
            // For UI integration testing only
            exports._replaceDone = true;
        });
    }
function doReplace(results, replaceText, options) {
        return FindUtils.performReplacements(results, replaceText, options).always(function () {
            // For UI integration testing only
            exports._replaceDone = true;
        });
    }
function doReplace ( results , replaceText , options ) { return FindUtils . performReplacements ( results , replaceText , options ) . always ( function ( ) { // For UI integration testing only exports . _replaceDone = true ; } ) ; }
Given a set of search results, replaces them with the given replaceText, either on disk or in memory.
@param {Object.<fullPath: string, {matches: Array.<{start: {line:number,ch:number}, end: {line:number,ch:number}, startOffset: number, endOffset: number, line: string}>, collapsed: boolean}>} results
The list of results to replace, as returned from _doSearch..
@param {string} replaceText The text to replace each result with.
@param {?Object} options An options object:
forceFilesOpen: boolean - Whether to open all files in editors and do replacements there rather than doing the
replacements on disk. Note that even if this is false, files that are already open in editors will have replacements
done in memory.
isRegexp: boolean - Whether the original query was a regexp. If true, $-substitution is performed on the replaceText.
@return {$.Promise} A promise that's resolved when the replacement is finished or rejected with an array of errors
if there were one or more errors. Each individual item in the array will be a {item: string, error: string} object,
where item is the full path to the file that could not be updated, and error is either a FileSystem error or one
of the `FindInFiles.ERROR_*` constants.
Given a set of search results replaces them with the given replaceText either on disk or in memory .