FileFilters
Import :
const FileFilters = brackets.getModule("search/FileFilters")
DropdownButton
Utilities for managing file-set filters, as used in Find in Files. Includes both UI for selecting/editing filters, as well as the actual file-filtering implementation.
Kind: global constant
FILTER_TYPE_EXCLUDE : string
Kind: global constant
FILTER_TYPE_INCLUDE : string
Kind: global constant
FILTER_TYPE_NO_FILTER : string
Kind: global constant
getActiveFilter() ⇒ Object
A search filter is an array of one or more glob strings. The filter must be 'compiled' via compile() before passing to filterPath()/filterFileList().
Kind: global function
Returns: Object
- a globeFilter filter that can be passed to filterPath()/filterFileList().
setActiveFilter(filter, [filterType])
Sets and save the index of the active filter. Automatically set when editFilter() is completed. If no filter is passed in, then clear the last active filter index by setting it to -1.
Kind: global function
Param | Type | Description |
---|---|---|
filter | Object | string | a globeFilter filter that can be passed to filterPath()/filterFileList(). |
[filterType] | string | optional, one of FileFilters.FILTER_TYPE_*. |
compile(userFilterString) ⇒ Object
Converts a user-specified filter object (as chosen in picker or retrieved from getFilters()) to a 'compiled' form that can be used with filterPath()/filterFileList().
Kind: global function
Returns: Object
- a globeFilter filter that can be passed to filterPath()/filterFileList().
Param | Type |
---|---|
userFilterString | string |
filterPath(compiledFilter, fullPath) ⇒ boolean
Returns false if the given path matches any of the exclusion globs in the given filter. Returns true if the path does not match any of the globs. If filtering many paths at once, use filterFileList() for much better performance.
Kind: global function
Param | Type | Description |
---|---|---|
compiledFilter | object | 'Compiled' filter object as returned by compile(), or null to no-op |
fullPath | string |
filterFileList(compiledFilter, files) ⇒ Array.<File>
Returns a copy of 'files' filtered to just those that don't match any of the exclusion globs in the filter.
Kind: global function
Param | Type | Description |
---|---|---|
compiledFilter | object | 'Compiled' filter object as returned by compile(), or null to no-op |
files | Array.<File> |
getPathsMatchingFilter(compiledFilter, An) ⇒ Array.<string>
Returns a copy of 'file path' strings that match any of the exclusion globs in the filter.
Kind: global function
Param | Type | Description |
---|---|---|
compiledFilter | object | 'Compiled' filter object as returned by compile(), or null to no-op |
An | Array.<string> | array with a list of full file paths that matches atleast one of the filter. |
createFilterPicker() ⇒ jQueryObject
Creates a UI element for selecting a filter. The picker is populated with a list of recently used filters,
an option to edit the selected filter, and another option to create a new filter. The client should call
commitDropdown()
when the UI containing the filter picker is confirmed, which updates the Most Recently
Used (MRU) order, and then use the returned filter object as needed.
Kind: global function
Returns: jQueryObject
- The Picker UI as a jQuery object.
showDropdown()
Allows unit tests to open the file filter dropdown list.
Kind: global function
closeDropdown()
Allows unit tests to close the file filter dropdown list.
Kind: global function