Skip to content

Commit 2211dbf

Browse files
devvaannshabose
authored andcommitted
docs: refine API docs for files in Search dir
1 parent 16e2eae commit 2211dbf

20 files changed

+397
-845
lines changed

docs/API-Reference/search/FileFilters.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,38 @@
33
const FileFilters = brackets.getModule("search/FileFilters")
44
```
55

6-
<a name="_picker"></a>
7-
8-
## \_picker : [<code>DropdownButton</code>](#DropdownButton)
9-
**Kind**: global variable
10-
<a name="$filterContainer"></a>
11-
12-
## $filterContainer : <code>jQuery</code>
13-
**Kind**: global variable
146
<a name="DropdownButton"></a>
157

168
## DropdownButton
17-
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.
9+
Utilities for managing file-set filters, as used in Find in Files.
10+
Includes both UI for selecting/editing filters, as well as the actual file-filtering implementation.
11+
12+
**Kind**: global constant
13+
<a name="FILTER_TYPE_EXCLUDE"></a>
14+
15+
## FILTER\_TYPE\_EXCLUDE : <code>string</code>
16+
**Kind**: global constant
17+
<a name="FILTER_TYPE_INCLUDE"></a>
18+
19+
## FILTER\_TYPE\_INCLUDE : <code>string</code>
20+
**Kind**: global constant
21+
<a name="FILTER_TYPE_NO_FILTER"></a>
1822

23+
## FILTER\_TYPE\_NO\_FILTER : <code>string</code>
1924
**Kind**: global constant
2025
<a name="getActiveFilter"></a>
2126

2227
## getActiveFilter() ⇒ <code>Object</code>
23-
A search filter is an array of one or more glob strings. The filter must be 'compiled' via compile()before passing to filterPath()/filterFileList().
28+
A search filter is an array of one or more glob strings. The filter must be 'compiled' via compile()
29+
before passing to filterPath()/filterFileList().
2430

2531
**Kind**: global function
2632
**Returns**: <code>Object</code> - a globeFilter filter that can be passed to filterPath()/filterFileList().
2733
<a name="setActiveFilter"></a>
2834

2935
## setActiveFilter(filter, [filterType])
30-
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.
36+
Sets and save the index of the active filter. Automatically set when editFilter() is completed.
37+
If no filter is passed in, then clear the last active filter index by setting it to -1.
3138

3239
**Kind**: global function
3340

@@ -39,7 +46,8 @@ Sets and save the index of the active filter. Automatically set when editFilter(
3946
<a name="compile"></a>
4047

4148
## compile(userFilterString) ⇒ <code>Object</code>
42-
Converts a user-specified filter object (as chosen in picker or retrieved from getFilters()) to a 'compiled' formthat can be used with filterPath()/filterFileList().
49+
Converts a user-specified filter object (as chosen in picker or retrieved from getFilters()) to a 'compiled' form
50+
that can be used with filterPath()/filterFileList().
4351

4452
**Kind**: global function
4553
**Returns**: <code>Object</code> - a globeFilter filter that can be passed to filterPath()/filterFileList().
@@ -51,7 +59,9 @@ Converts a user-specified filter object (as chosen in picker or retrieved from g
5159
<a name="filterPath"></a>
5260

5361
## filterPath(compiledFilter, fullPath) ⇒ <code>boolean</code>
54-
Returns false if the given path matches any of the exclusion globs in the given filter. Returns trueif the path does not match any of the globs. If filtering many paths at once, use filterFileList()for much better performance.
62+
Returns false if the given path matches any of the exclusion globs in the given filter. Returns true
63+
if the path does not match any of the globs. If filtering many paths at once, use filterFileList()
64+
for much better performance.
5565

5666
**Kind**: global function
5767

@@ -87,7 +97,10 @@ Returns a copy of 'file path' strings that match any of the exclusion globs in t
8797
<a name="createFilterPicker"></a>
8898

8999
## createFilterPicker() ⇒ <code>jQueryObject</code>
90-
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.
100+
Creates a UI element for selecting a filter. The picker is populated with a list of recently used filters,
101+
an option to edit the selected filter, and another option to create a new filter. The client should call
102+
`commitDropdown()` when the UI containing the filter picker is confirmed, which updates the Most Recently
103+
Used (MRU) order, and then use the returned filter object as needed.
91104

92105
**Kind**: global function
93106
**Returns**: <code>jQueryObject</code> - The Picker UI as a jQuery object.

docs/API-Reference/search/FindBar.md

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,42 @@ const FindBar = brackets.getModule("search/FindBar")
1010

1111
* [FindBar](#FindBar)
1212
* [new FindBar([scopeLabel])](#new_FindBar_new)
13-
* _instance_
14-
* [.open()](#FindBar+open)
15-
* [.close(suppressAnimation)](#FindBar+close)
16-
* [.isClosed()](#FindBar+isClosed) ⇒ <code>boolean</code>
17-
* [.getOptions()](#FindBar+getOptions) ⇒ <code>Object</code>
18-
* [.getQueryInfo()](#FindBar+getQueryInfo) ⇒ <code>Object</code>
19-
* [.showError(error, [isHTML], [isFilterError])](#FindBar+showError)
20-
* [.showFindCount(count)](#FindBar+showFindCount)
21-
* [.showNoResults(showIndicator, showMessage)](#FindBar+showNoResults)
22-
* [.getReplaceText()](#FindBar+getReplaceText) ⇒ <code>string</code>
23-
* [.enable(enable)](#FindBar+enable)
24-
* [.isEnabled()](#FindBar+isEnabled) ⇒ <code>boolean</code>
25-
* [.isReplaceEnabled()](#FindBar+isReplaceEnabled) ⇒ <code>boolean</code>
26-
* [.enableNavigation(enable)](#FindBar+enableNavigation)
27-
* [.enableReplace(enable)](#FindBar+enableReplace)
28-
* [.focusQuery()](#FindBar+focusQuery)
29-
* [.focusReplace()](#FindBar+focusReplace)
30-
* [.showIndexingSpinner()](#FindBar+showIndexingSpinner)
31-
* [.redoInstantSearch()](#FindBar+redoInstantSearch)
32-
* _static_
33-
* [.getInitialQuery(currentFindBar, activeEditor)](#FindBar.getInitialQuery) ⇒ <code>Object</code>
13+
* [.open()](#FindBar+open)
14+
* [.close(suppressAnimation)](#FindBar+close)
15+
* [.isClosed()](#FindBar+isClosed) ⇒ <code>boolean</code>
16+
* [.getOptions()](#FindBar+getOptions) ⇒ <code>Object</code>
17+
* [.getQueryInfo()](#FindBar+getQueryInfo) ⇒ <code>Object</code>
18+
* [.showError(error, [isHTML], [isFilterError])](#FindBar+showError)
19+
* [.showFindCount(count)](#FindBar+showFindCount)
20+
* [.showNoResults(showIndicator, showMessage)](#FindBar+showNoResults)
21+
* [.getReplaceText()](#FindBar+getReplaceText) ⇒ <code>string</code>
22+
* [.enable(enable)](#FindBar+enable)
23+
* [.isEnabled()](#FindBar+isEnabled) ⇒ <code>boolean</code>
24+
* [.isReplaceEnabled()](#FindBar+isReplaceEnabled) ⇒ <code>boolean</code>
25+
* [.enableNavigation(enable)](#FindBar+enableNavigation)
26+
* [.enableReplace(enable)](#FindBar+enableReplace)
27+
* [.focusQuery()](#FindBar+focusQuery)
28+
* [.focusReplace()](#FindBar+focusReplace)
29+
* [.showIndexingSpinner()](#FindBar+showIndexingSpinner)
30+
* [.redoInstantSearch()](#FindBar+redoInstantSearch)
3431

3532
<a name="new_FindBar_new"></a>
3633

3734
### new FindBar([scopeLabel])
38-
Find Bar UI component, used for both single- and multi-file find/replace. This doesn't actuallycreate and add the FindBar to the DOM - for that, call open().Dispatches these events:- queryChange - when the user types in the input field or sets a query option. Use getQueryInfo() to get the current query state.- doFind - when the user chooses to do a Find Previous or Find Next. Parameters are: shiftKey - boolean, false for Find Next, true for Find Previous- doReplace - when the user chooses to do a single replace. Use getReplaceText() to get the current replacement text.- doReplaceBatch - when the user chooses to initiate a Replace All. Use getReplaceText() to get the current replacement text.- doReplaceAll - when the user chooses to perform a Replace All. Use getReplaceText() to get the current replacement text.- close - when the find bar is closed
35+
Find Bar UI component, used for both single- and multi-file find/replace. This doesn't actually
36+
create and add the FindBar to the DOM - for that, call open().
37+
38+
Dispatches these events:
39+
40+
- queryChange - when the user types in the input field or sets a query option. Use getQueryInfo()
41+
to get the current query state.
42+
- doFind - when the user chooses to do a Find Previous or Find Next.
43+
Parameters are:
44+
shiftKey - boolean, false for Find Next, true for Find Previous
45+
- doReplace - when the user chooses to do a single replace. Use getReplaceText() to get the current replacement text.
46+
- doReplaceBatch - when the user chooses to initiate a Replace All. Use getReplaceText() to get the current replacement text.
47+
- doReplaceAll - when the user chooses to perform a Replace All. Use getReplaceText() to get the current replacement text.
48+
- close - when the find bar is closed
3949

4050

4151
| Param | Type | Description |
@@ -106,7 +116,8 @@ Set the find count.
106116
<a name="FindBar+showNoResults"></a>
107117

108118
### findBar.showNoResults(showIndicator, showMessage)
109-
Show or hide the no-results indicator and optional message. This is also used toindicate regular expression errors.
119+
Show or hide the no-results indicator and optional message. This is also used to
120+
indicate regular expression errors.
110121

111122
**Kind**: instance method of [<code>FindBar</code>](#FindBar)
112123

@@ -124,7 +135,9 @@ Returns the current replace text.
124135
<a name="FindBar+enable"></a>
125136

126137
### findBar.enable(enable)
127-
Enables or disables the controls in the Find bar. Note that if enable is true, *all* controls will bere-enabled, even if some were previously disabled using enableNavigation() or enableReplace(), so youwill need to refresh their enable state after calling this.
138+
Enables or disables the controls in the Find bar. Note that if enable is true, *all* controls will be
139+
re-enabled, even if some were previously disabled using enableNavigation() or enableReplace(), so you
140+
will need to refresh their enable state after calling this.
128141

129142
**Kind**: instance method of [<code>FindBar</code>](#FindBar)
130143

@@ -145,7 +158,8 @@ Enables or disables the controls in the Find bar. Note that if enable is true, *
145158
<a name="FindBar+enableNavigation"></a>
146159

147160
### findBar.enableNavigation(enable)
148-
Enable or disable the navigation controls if present. Note that if the Find bar is currently disabled(i.e. isEnabled() returns false), this will have no effect.
161+
Enable or disable the navigation controls if present. Note that if the Find bar is currently disabled
162+
(i.e. isEnabled() returns false), this will have no effect.
149163

150164
**Kind**: instance method of [<code>FindBar</code>](#FindBar)
151165

@@ -156,7 +170,8 @@ Enable or disable the navigation controls if present. Note that if the Find bar
156170
<a name="FindBar+enableReplace"></a>
157171

158172
### findBar.enableReplace(enable)
159-
Enable or disable the replace controls if present. Note that if the Find bar is currently disabled(i.e. isEnabled() returns false), this will have no effect.
173+
Enable or disable the replace controls if present. Note that if the Find bar is currently disabled
174+
(i.e. isEnabled() returns false), this will have no effect.
160175

161176
**Kind**: instance method of [<code>FindBar</code>](#FindBar)
162177

@@ -188,16 +203,3 @@ The indexing spinner is usually shown when node is indexing files
188203
Force a search again
189204

190205
**Kind**: instance method of [<code>FindBar</code>](#FindBar)
191-
<a name="FindBar.getInitialQuery"></a>
192-
193-
### FindBar.getInitialQuery(currentFindBar, activeEditor) ⇒ <code>Object</code>
194-
Retrieves the appropriate query and replacement text to prepopulate the Find Bar.
195-
196-
**Kind**: static method of [<code>FindBar</code>](#FindBar)
197-
**Returns**: <code>Object</code> - An object containing the query and replacement text to prepopulate the Find Bar.
198-
199-
| Param | Type | Description |
200-
| --- | --- | --- |
201-
| currentFindBar | [<code>FindBar</code>](#FindBar) | The currently open Find Bar, if any. |
202-
| activeEditor | <code>Editor</code> | The active editor, if any. |
203-

docs/API-Reference/search/FindInFiles.md

Lines changed: 14 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -8,77 +8,18 @@ const FindInFiles = brackets.getModule("search/FindInFiles")
88
## searchModel : <code>SearchModel</code>
99
The search query and results model.
1010

11-
**Kind**: global variable
12-
<a name="_cachedFileSystemEvents"></a>
13-
14-
## \_cachedFileSystemEvents
15-
This stores file system events emitted by watchers that were not yet processed
16-
17-
**Kind**: global variable
18-
<a name="_processCachedFileSystemEvents"></a>
19-
20-
## \_processCachedFileSystemEvents
21-
Debounced function to process emitted file system eventsfor cases when there's a lot of fs events emitted in a very short period of time
22-
2311
**Kind**: global variable
2412
<a name="@type"></a>
2513

2614
## @type : <code>Object</code>
2715
Token used to indicate a specific reason for zero search results
2816

2917
**Kind**: global constant
30-
<a name="MAX_DISPLAY_LENGTH"></a>
31-
32-
## MAX\_DISPLAY\_LENGTH
33-
Maximum length of text displayed in search results panel
34-
35-
**Kind**: global constant
36-
<a name="FILE_SYSTEM_EVENT_DEBOUNCE_TIME"></a>
37-
38-
## FILE\_SYSTEM\_EVENT\_DEBOUNCE\_TIME
39-
Waits for FS changes to stack up until processing them(scripts like npm install can do a lot of movements on the disk)
40-
41-
**Kind**: global constant
42-
<a name="_removeListeners"></a>
43-
44-
## \_removeListeners()
45-
Remove the listeners that were tracking potential search result changes
46-
47-
**Kind**: global function
48-
<a name="_addListeners"></a>
49-
50-
## \_addListeners()
51-
Add listeners to track events that might change the search result set
52-
53-
**Kind**: global function
54-
<a name="_subtreeFilter"></a>
55-
56-
## \_subtreeFilter(file, scope) ⇒ <code>boolean</code>
57-
Checks that the file matches the given subtree scope. To fully check whether the fileshould be in the search set, use _inSearchScope() instead - a supserset of this.
58-
59-
**Kind**: global function
60-
61-
| Param | Type | Description |
62-
| --- | --- | --- |
63-
| file | <code>File</code> | |
64-
| scope | <code>FileSystemEntry</code> | Search scope, or null if whole project |
65-
66-
<a name="_isReadableFileType"></a>
67-
68-
## \_isReadableFileType(fullPath) ⇒ <code>boolean</code>
69-
Filters out files that are known binary types.
70-
71-
**Kind**: global function
72-
**Returns**: <code>boolean</code> - True if the file's contents can be read as text
73-
74-
| Param | Type |
75-
| --- | --- |
76-
| fullPath | <code>string</code> |
77-
7818
<a name="getCandidateFiles"></a>
7919

8020
## getCandidateFiles(scope) ⇒ <code>$.Promise</code>
81-
Finds all candidate files to search in the given scope's subtree that are not binary content. Does NOT applythe current filter yet.
21+
Finds all candidate files to search in the given scope's subtree that are not binary content. Does NOT apply
22+
the current filter yet.
8223

8324
**Kind**: global function
8425
**Returns**: <code>$.Promise</code> - A promise that will be resolved with the list of files in the scope. Never rejected.
@@ -87,21 +28,12 @@ Finds all candidate files to search in the given scope's subtree that are not bi
8728
| --- | --- | --- |
8829
| scope | <code>FileSystemEntry</code> | Search scope, or null if whole project |
8930

90-
<a name="_inSearchScope"></a>
91-
92-
## \_inSearchScope(file) ⇒ <code>boolean</code>
93-
Checks that the file is eligible for inclusion in the search (matches the user's subtree scope andfile exclusion filters, and isn't binary). Used when updating results incrementally - during theinitial search, these checks are done in bulk via getCandidateFiles() and the filterFileList() callafter it.
94-
95-
**Kind**: global function
96-
97-
| Param | Type |
98-
| --- | --- |
99-
| file | <code>File</code> |
100-
10131
<a name="doSearchInScope"></a>
10232

10333
## doSearchInScope(queryInfo, scope, filter, replaceText, candidateFilesPromise) ⇒ <code>$.Promise</code>
104-
Does a search in the given scope with the given filter. Used when you want to start a searchprogrammatically. 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.
34+
Does a search in the given scope with the given filter. Used when you want to start a search
35+
programmatically. Make sure that project indexing is complete by calling isProjectIndexingComplete()
36+
Else, an empty result will be returned if search is invoked before any files are indexed.
10537

10638
**Kind**: global function
10739
**Returns**: <code>$.Promise</code> - A promise that's resolved with the search results or rejected when the find competes.
@@ -120,7 +52,8 @@ Does a search in the given scope with the given filter. Used when you want to st
12052
Replaces a set of search results with the specified `replaceText`, either on disk or in memory.
12153

12254
**Kind**: global function
123-
**Returns**: <code>$.Promise</code> - 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:
55+
**Returns**: <code>$.Promise</code> - A promise that resolves when the replacement is finished or is rejected with an array of errors if any occur.
56+
Each item in the array will be an object containing:
12457

12558
| Param | Type | Description |
12659
| --- | --- | --- |
@@ -132,50 +65,17 @@ Replaces a set of search results with the specified `replaceText`, either on dis
13265
| item | <code>string</code> | The full path to the file that could not be updated. |
13366
| error | <code>string</code> | Either a FileSystem error or one of the `FindInFiles.ERROR_*` constants. |
13467

135-
<a name="_searchcollapseResults"></a>
136-
137-
## \_searchcollapseResults()
138-
Notify worker that the results should be collapsed
139-
140-
**Kind**: global function
141-
<a name="filesChanged"></a>
142-
143-
## filesChanged(fileList)
144-
Inform worker that the list of files has changed.
145-
146-
**Kind**: global function
147-
148-
| Param | Type | Description |
149-
| --- | --- | --- |
150-
| fileList | <code>array</code> | The list of files that changed. |
151-
152-
<a name="filesRemoved"></a>
153-
154-
## filesRemoved(fileList)
155-
Inform worker that the list of files have been removed.
156-
157-
**Kind**: global function
158-
159-
| Param | Type | Description |
160-
| --- | --- | --- |
161-
| fileList | <code>array</code> | The list of files that was removed. |
162-
163-
<a name="_debouncedFileSystemChangeHandler"></a>
164-
165-
## \_debouncedFileSystemChangeHandler()
166-
Wrapper function for _fileSystemChangeHandler which handles all incoming fs eventsputting them to cache and executing a debounced function
167-
168-
**Kind**: global function
169-
<a name="_initCache"></a>
170-
171-
## \_initCache()
172-
On project change, inform worker about the new list of files that needs to be crawled.Instant search is also disabled for the time being till the crawl is complete in worker.This should never be called directly and only called via _scheduleCacheInit() belowto not affect project load performance.
173-
174-
**Kind**: global function
17568
<a name="getNextPageofSearchResults"></a>
17669

17770
## getNextPageofSearchResults() ⇒ <code>object</code>
17871
Gets the next page of search results to append to the result set.
17972

18073
**Kind**: global function
18174
**Returns**: <code>object</code> - A promise that's resolved with the search results or rejected when the find competes.
75+
<a name="getAllSearchResults"></a>
76+
77+
## getAllSearchResults() ⇒ <code>object</code>
78+
Get all the search results.
79+
80+
**Kind**: global function
81+
**Returns**: <code>object</code> - A promise that's resolved with the search results or rejected when the find competes.

0 commit comments

Comments
 (0)