Skip to content

Latest commit

 

History

History
81 lines (60 loc) · 3.99 KB

File metadata and controls

81 lines (60 loc) · 3.99 KB

Import :

const FindInFiles = brackets.getModule("search/FindInFiles")

searchModel : SearchModel

The search query and results model.

Kind: global variable

@type : Object

Token used to indicate a specific reason for zero search results

Kind: global constant

getCandidateFiles(scope) ⇒ $.Promise

Finds all candidate files to search in the given scope's subtree that are not binary content. Does NOT apply the current filter yet.

Kind: global function
Returns: $.Promise - A promise that will be resolved with the list of files in the scope. Never rejected.

Param Type Description
scope FileSystemEntry Search scope, or null if whole project

doSearchInScope(queryInfo, scope, filter, replaceText, candidateFilesPromise) ⇒ $.Promise

Does a search in the given scope with the given filter. Used when you want to start a search programmatically. Make sure that project indexing is complete by calling isProjectIndexingComplete() Else, an empty result will be returned if search is invoked before any files are indexed.

Kind: global function
Returns: $.Promise - A promise that's resolved with the search results or rejected when the find competes.

Param Type Description
queryInfo Object Query info object
scope Entry Project file/subfolder to search within; else searches whole project.
filter string A "compiled" filter as returned by FileFilters.compile(), or null for no filter
replaceText string If this is a replacement, the text to replace matches with. This is just stored in the model for later use - the replacement is not actually performed right now.
candidateFilesPromise $.Promise If specified, a promise that should resolve with the same set of files that getCandidateFiles(scope) would return.

doReplace(results, replaceText, options, item, error) ⇒ $.Promise

Replaces a set of search results with the specified replaceText, either on disk or in memory.

Kind: global function
Returns: $.Promise - A promise that resolves when the replacement is finished or is rejected with an array of errors if any occur. Each item in the array will be an object containing:

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 perform replacements there instead of on disk. Note that even if this is false, replacements will still occur in memory for files already open in editors.
options.isRegexp boolean Indicates if the original query was a regular expression. If true, $-substitution is applied to the replaceText.
item string The full path to the file that could not be updated.
error string Either a FileSystem error or one of the FindInFiles.ERROR_* constants.

getNextPageofSearchResults() ⇒ object

Gets the next page of search results to append to the result set.

Kind: global function
Returns: object - A promise that's resolved with the search results or rejected when the find competes.

getAllSearchResults() ⇒ object

Get all the search results.

Kind: global function
Returns: object - A promise that's resolved with the search results or rejected when the find competes.