const FindUtils = brackets.getModule("search/FindUtils")Given a replace string that contains $-expressions, replace them with data from the given regexp match info. NOTE: we can't just use the ordinary replace() function here because the string has been extracted from the original text and so might be missing some context that the regexp matched.
Kind: global function
Returns: string - The replace text with the $-expressions substituted.
| Param | Type | Description |
|---|---|---|
| replaceWith | string |
The string containing the $-expressions. |
| match | Object |
The match data from the regexp. |
Given a set of search results, replaces them with the given replaceText, either on disk or in memory.
Checks timestamps to ensure replacements are not performed in files that have changed on disk since
the original search results were generated. However, does not check whether edits have been performed
in in-memory documents since the search; it's up to the caller to guarantee this hasn't happened.
(When called from the standard Find in Files UI, SearchResultsView guarantees this. If called headlessly,
the caller needs to track changes.)
Replacements in documents that are already open in memory at the start of the replacement are guaranteed to
happen synchronously; replacements in files on disk will return an error if the on-disk file changes between
the time performReplacements() is called and the time the replacement actually happens.
Kind: global function
Returns: $.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 FindUtils.ERROR_* constants.
| Param | Type | Description |
|---|---|---|
| results | Object |
The list of results to replace, as returned from _doSearch. |
| replaceText | string |
The text to replace each result with. |
| options | Object |
An options object: |
| [options.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. |
| [options.isRegexp] | boolean |
Whether the original query was a regexp. If true, $-substitution is performed on the replaceText. |
Returns label text to indicate the search scope. Already HTML-escaped.
Kind: global function
| Param | Type |
|---|---|
| scope | Entry |
Parses the given query into a regexp, and returns whether it was valid or not.
Kind: global function
Returns: Object - queryExpr - the regexp representing the query
valid - set to true if query is a nonempty string or a valid regexp.
empty - set to true if query was empty.
error - set to an error string if valid is false and query is nonempty.
| Param | Type |
|---|---|
| queryInfo | Object |
Prioritizes the open file and then the working set files to the starting of the list of files
Kind: global function
| Param | Type | Description |
|---|---|---|
| files | Array.<*> |
An array of file paths or file objects to sort |
| firstFile | string |
If specified, the path to the file that should be sorted to the top. |
Returns the path of the currently open file or null if there isn't one open
enable/disable instant search
Kind: global function
| Param | Type | Description |
|---|---|---|
| disable | boolean |
true to disable web worker based search |
if instant search is disabled, this will return true we can only do instant search through worker
Set whether indexing has been suspended due to cache size limit
Kind: global function
| Param | Type | Description |
|---|---|---|
| suspended | boolean |
true if indexing was suspended |
Check if indexing was suspended due to cache size limit. When true, Find in Files should not perform searches.
check if a search is progressing in worker
Kind: global function
Returns: Boolean - true if search is processing in worker
Raises an event when the file filters applied to a search changes
Raises an event when the search scope changes[say search in a subdirectory in the project]
Notifies that a worker search has started so that we FindUtils can figure out if any outstanding worker search requests are pending
Notifies that a worker search has finished so that we FindUtils can figure out if any outstanding worker search requests are pending
Notifies that a worker has started indexing the files
Notifies that a worker has started indexing the files
Notifies that a worker has finished indexing the files
Return true if indexing is in progress in worker
Kind: global function
Returns: boolean - true if files are being indexed in worker
Set if we need to collapse all results in the results pane
Kind: global function
| Param | Type | Description |
|---|---|---|
| collapse | boolean |
true to collapse |
check if results should be collapsed
Kind: global function
Returns: boolean - true if results should be collapsed