Skip to content

Commit 2b6d42f

Browse files
devvaannshabose
authored andcommitted
docs: refine API docs for files in Project dir
1 parent 4a93b23 commit 2b6d42f

18 files changed

+550
-532
lines changed

docs/API-Reference/project/FileSyncManager.md

Lines changed: 4 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -3,107 +3,13 @@
33
const FileSyncManager = brackets.getModule("project/FileSyncManager")
44
```
55

6-
<a name="_alreadyChecking"></a>
7-
8-
## \_alreadyChecking : <code>boolean</code>
9-
Guard to spot re-entrancy while syncOpenDocuments() is still in progress
10-
11-
**Kind**: global variable
12-
<a name="_restartPending"></a>
13-
14-
## \_restartPending : <code>boolean</code>
15-
If true, we should bail from the syncOpenDocuments() process and then re-run it. Seecomments in syncOpenDocuments() for how this works.
16-
17-
**Kind**: global variable
18-
<a name="toReload"></a>
19-
20-
## toReload : <code>Array.&lt;Document&gt;</code>
21-
**Kind**: global variable
22-
<a name="toClose"></a>
23-
24-
## toClose : <code>Array.&lt;Document&gt;</code>
25-
**Kind**: global variable
26-
<a name="editConflicts"></a>
27-
28-
## editConflicts : <code>Object</code>
29-
Array
30-
31-
**Kind**: global variable
32-
<a name="deleteConflicts"></a>
33-
34-
## deleteConflicts : <code>Object</code>
35-
Array
36-
37-
**Kind**: global variable
38-
<a name="findExternalChanges"></a>
39-
40-
## findExternalChanges(docs) ⇒ <code>$.Promise</code>
41-
Scans all the given Documents for changes on disk, and sorts them into four buckets,populating the corresponding arrays: toReload - changed on disk; unchanged within Brackets toClose - deleted on disk; unchanged within Brackets editConflicts - changed on disk; also dirty in Brackets deleteConflicts - deleted on disk; also dirty in Brackets
42-
43-
**Kind**: global function
44-
**Returns**: <code>$.Promise</code> - Resolved when all scanning done, or rejected immediately if there's any error while reading file timestamps. Errors are logged but no UI is shown.
45-
46-
| Param | Type |
47-
| --- | --- |
48-
| docs | <code>Array.&lt;Document&gt;</code> |
49-
50-
<a name="syncUnopenWorkingSet"></a>
51-
52-
## syncUnopenWorkingSet()
53-
Scans all the files in the working set that do not have Documents (and thus were not scannedby findExternalChanges()). If any were deleted on disk, removes them from the working set.
54-
55-
**Kind**: global function
56-
<a name="reloadDoc"></a>
57-
58-
## reloadDoc(doc) ⇒ <code>$.Promise</code>
59-
Reloads the Document's contents from disk, discarding any unsaved changes in the editor.
60-
61-
**Kind**: global function
62-
**Returns**: <code>$.Promise</code> - Resolved after editor has been refreshed; rejected if unable to load the file's new content. Errors are logged but no UI is shown.
63-
64-
| Param | Type |
65-
| --- | --- |
66-
| doc | <code>Document</code> |
67-
68-
<a name="reloadChangedDocs"></a>
69-
70-
## reloadChangedDocs() ⇒ <code>$.Promise</code>
71-
Reloads all the documents in "toReload" silently (no prompts). The operations are all runin parallel.
72-
73-
**Kind**: global function
74-
**Returns**: <code>$.Promise</code> - Resolved/rejected after all reloads done; will be rejected if any one file's reload failed. Errors are logged (by reloadDoc()) but no UI is shown.
75-
<a name="showReloadError"></a>
76-
77-
## showReloadError(error, doc) ⇒ <code>Dialog</code>
78-
**Kind**: global function
79-
80-
| Param | Type |
81-
| --- | --- |
82-
| error | <code>FileError</code> |
83-
| doc | <code>Document</code> |
84-
85-
<a name="closeDeletedDocs"></a>
86-
87-
## closeDeletedDocs()
88-
Closes all the documents in "toClose" silently (no prompts). Completes synchronously.
89-
90-
**Kind**: global function
91-
<a name="presentConflicts"></a>
92-
93-
## presentConflicts(title) ⇒ <code>$.Promise</code>
94-
Walks through all the documents in "editConflicts" & "deleteConflicts" and prompts the userabout each one. Processing is sequential: if the user chooses to reload a document, the nextprompt is not shown until after the reload has completed.
95-
96-
**Kind**: global function
97-
**Returns**: <code>$.Promise</code> - Resolved/rejected after all documents have been prompted and (if applicable) reloaded (and any resulting error UI has been dismissed). Rejected if any one reload failed.
98-
99-
| Param | Type | Description |
100-
| --- | --- | --- |
101-
| title | <code>string</code> | Title of the dialog. |
102-
1036
<a name="syncOpenDocuments"></a>
1047

1058
## syncOpenDocuments(title)
106-
Check to see whether any open files have been modified by an external app since the last timeBrackets synced up with the copy on disk (either by loading or saving the file). For cleanfiles, we silently upate the editor automatically. For files with unsaved changes, we promptthe user.
9+
Check to see whether any open files have been modified by an external app since the last time
10+
Brackets synced up with the copy on disk (either by loading or saving the file). For clean
11+
files, we silently upate the editor automatically. For files with unsaved changes, we prompt
12+
the user.
10713

10814
**Kind**: global function
10915

docs/API-Reference/project/FileTreeView.md

Lines changed: 13 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -6,110 +6,16 @@ const FileTreeView = brackets.getModule("project/FileTreeView")
66
<a name="Preact"></a>
77

88
## Preact
9-
This is the view layer (template) for the file tree in the sidebar. It takes a FileTreeViewModeland renders it to the given element using Preact. User actions are signaled via an ActionCreator(in the Flux sense).
10-
11-
**Kind**: global variable
12-
<a name="pathComputer"></a>
13-
14-
## pathComputer
15-
Mixin that allows a component to compute the full path to its directory entry.
16-
17-
**Kind**: global variable
18-
<a name="pathComputer.myPath"></a>
19-
20-
### pathComputer.myPath()
21-
Computes the full path of the file represented by this input.
22-
23-
**Kind**: static method of [<code>pathComputer</code>](#pathComputer)
24-
<a name="renameBehavior"></a>
25-
26-
## renameBehavior
27-
This is a mixin that provides rename input behavior. It is responsible for taking keyboard inputand invoking the correct action based on that input.
28-
29-
**Kind**: global variable
30-
31-
* [renameBehavior](#renameBehavior)
32-
* [.handleClick()](#renameBehavior.handleClick)
33-
* [.handleKeyDown()](#renameBehavior.handleKeyDown)
34-
* [.handleInput()](#renameBehavior.handleInput)
35-
* [.handleBlur()](#renameBehavior.handleBlur)
36-
37-
<a name="renameBehavior.handleClick"></a>
38-
39-
### renameBehavior.handleClick()
40-
Stop clicks from propagating so that clicking on the rename input doesn'tcause directories to collapse.
41-
42-
**Kind**: static method of [<code>renameBehavior</code>](#renameBehavior)
43-
<a name="renameBehavior.handleKeyDown"></a>
44-
45-
### renameBehavior.handleKeyDown()
46-
If the user presses enter or escape, we either successfully complete or cancel, respectively,the rename or create operation that is underway.
47-
48-
**Kind**: static method of [<code>renameBehavior</code>](#renameBehavior)
49-
<a name="renameBehavior.handleInput"></a>
50-
51-
### renameBehavior.handleInput()
52-
The rename or create operation can be completed or canceled by actions outside ofthis component, so we keep the model up to date by sending every update via an action.
53-
54-
**Kind**: static method of [<code>renameBehavior</code>](#renameBehavior)
55-
<a name="renameBehavior.handleBlur"></a>
56-
57-
### renameBehavior.handleBlur()
58-
If we leave the field for any reason, complete the rename.
59-
60-
**Kind**: static method of [<code>renameBehavior</code>](#renameBehavior)
61-
<a name="dragAndDrop"></a>
62-
63-
## dragAndDrop
64-
This is a mixin that provides drag and drop move function.
65-
66-
**Kind**: global variable
67-
<a name="extendable"></a>
68-
69-
## extendable
70-
Mixin for components that support the "icons" and "addClass" extension points.`fileNode` and `directoryNode` support this.
71-
72-
**Kind**: global variable
73-
74-
* [extendable](#extendable)
75-
* [.getIcons()](#extendable.getIcons) ⇒ <code>Array.&lt;PreactComponent&gt;</code>
76-
* [.getClasses(classes)](#extendable.getClasses) ⇒ <code>string</code>
77-
78-
<a name="extendable.getIcons"></a>
79-
80-
### extendable.getIcons() ⇒ <code>Array.&lt;PreactComponent&gt;</code>
81-
Calls the icon providers to get the collection of icons (most likely just one) forthe current file or directory.
82-
83-
**Kind**: static method of [<code>extendable</code>](#extendable)
84-
**Returns**: <code>Array.&lt;PreactComponent&gt;</code> - icon components to render
85-
<a name="extendable.getClasses"></a>
86-
87-
### extendable.getClasses(classes) ⇒ <code>string</code>
88-
Calls the addClass providers to get the classes (in string form) to add for the currentfile or directory.
89-
90-
**Kind**: static method of [<code>extendable</code>](#extendable)
91-
**Returns**: <code>string</code> - classes for the current node
92-
93-
| Param | Type | Description |
94-
| --- | --- | --- |
95-
| classes | <code>string</code> | Initial classes for this node |
96-
97-
<a name="fileSelectionBox"></a>
98-
99-
## fileSelectionBox
100-
Displays the absolutely positioned box for the selection or context in thefile tree. Its position is determined by passed-in info about the scroller in whichthe tree resides and the top of the selected node (as reported by the node itself).Props:* selectionViewInfo: Immutable.Map with width, scrollTop, scrollLeft and offsetTop for the tree container* visible: should this be visible now* selectedClassName: class name applied to the element that is selected
101-
102-
**Kind**: global variable
103-
<a name="selectionExtension"></a>
104-
105-
## selectionExtension
106-
On Windows and Linux, the selection bar in the tree does not extend over the scroll bar.The selectionExtension sits on top of the scroll bar to make the selection bar appear to span thewhole width of the sidebar.Props:* selectionViewInfo: Immutable.Map with width, scrollTop, scrollLeft and offsetTop for the tree container* visible: should this be visible now* selectedClassName: class name applied to the element that is selected* className: class to be applied to the extension element
9+
This is the view layer (template) for the file tree in the sidebar. It takes a FileTreeViewModel
10+
and renders it to the given element using Preact. User actions are signaled via an ActionCreator
11+
(in the Flux sense).
10712

10813
**Kind**: global variable
10914
<a name="componentDidMount"></a>
11015

11116
## componentDidMount()
112-
When this component is displayed, we scroll it into view and select the portionof the filename that excludes the extension.
17+
When this component is displayed, we scroll it into view and select the portion
18+
of the filename that excludes the extension.
11319

11420
**Kind**: global function
11521
<a name="getInitialState"></a>
@@ -118,43 +24,6 @@ When this component is displayed, we scroll it into view and select the portion
11824
Ensures that we always have a state object.
11925

12026
**Kind**: global function
121-
<a name="shouldComponentUpdate"></a>
122-
123-
## shouldComponentUpdate()
124-
Thanks to immutable objects, we can just do a start object identity check to knowwhether or not we need to re-render.
125-
126-
**Kind**: global function
127-
<a name="componentDidUpdate"></a>
128-
129-
## componentDidUpdate()
130-
If this node is newly selected, scroll it into view. Also, move the selection orcontext boxes as appropriate.
131-
132-
**Kind**: global function
133-
<a name="handleClick"></a>
134-
135-
## handleClick()
136-
When the user clicks on the node, we'll either select it or, if they've clicked twicewith a bit of delay in between, we'll invoke the `startRename` action.
137-
138-
**Kind**: global function
139-
<a name="selectNode"></a>
140-
141-
## selectNode()
142-
select the current node in the file tree on mouse down event on files.This is to increase click responsiveness of file tree.
143-
144-
**Kind**: global function
145-
<a name="handleDoubleClick"></a>
146-
147-
## handleDoubleClick()
148-
When the user double clicks, we will select this file and add it to the workingset (via the `selectInWorkingSet` action.)
149-
150-
**Kind**: global function
151-
<a name="getDataForExtension"></a>
152-
153-
## getDataForExtension() ⇒ <code>Object</code>
154-
Create the data object to pass to extensions.
155-
156-
**Kind**: global function
157-
**Returns**: <code>Object</code> - Data for extensions
15827
<a name="componentDidMount"></a>
15928

16029
## componentDidMount()
@@ -163,45 +32,22 @@ When this component is displayed, we scroll it into view and select the folder n
16332
**Kind**: global function
16433
<a name="shouldComponentUpdate"></a>
16534

166-
## shouldComponentUpdate()
167-
We need to update this component if the sort order changes or our entry objectchanges. Thanks to immutability, if any of the directory contents change, ourentry object will change.
168-
169-
**Kind**: global function
170-
<a name="handleClick"></a>
171-
172-
## handleClick()
173-
If you click on a directory, it will toggle between open and closed.
174-
175-
**Kind**: global function
176-
<a name="selectNode"></a>
177-
178-
## selectNode()
179-
select the current node in the file tree
180-
181-
**Kind**: global function
182-
<a name="getDataForExtension"></a>
183-
184-
## getDataForExtension() ⇒ <code>Object</code>
185-
Create the data object to pass to extensions.
186-
187-
**Kind**: global function
188-
**Returns**: <code>Object</code> - Data for extensions
189-
<a name="shouldComponentUpdate"></a>
190-
19135
## shouldComponentUpdate()
19236
Need to re-render if the sort order or the contents change.
19337

19438
**Kind**: global function
19539
<a name="componentDidUpdate"></a>
19640

19741
## componentDidUpdate()
198-
When the component has updated in the DOM, reposition it to where the currentlyselected node is located now.
42+
When the component has updated in the DOM, reposition it to where the currently
43+
selected node is located now.
19944

20045
**Kind**: global function
20146
<a name="componentDidUpdate"></a>
20247

20348
## componentDidUpdate()
204-
When the component has updated in the DOM, reposition it to where the currentlyselected node is located now.
49+
When the component has updated in the DOM, reposition it to where the currently
50+
selected node is located now.
20551

20652
**Kind**: global function
20753
<a name="shouldComponentUpdate"></a>
@@ -235,7 +81,8 @@ Renders the file tree to the given element.
23581
<a name="addIconProvider"></a>
23682

23783
## addIconProvider(callback, [priority])
238-
Adds an icon provider. The callback is invoked before each working set item is created, and canreturn content to prepend to the item if it supports the icon.
84+
Adds an icon provider. The callback is invoked before each working set item is created, and can
85+
return content to prepend to the item if it supports the icon.
23986

24087
**Kind**: global function
24188

@@ -247,7 +94,8 @@ Adds an icon provider. The callback is invoked before each working set item is c
24794
<a name="addClassesProvider"></a>
24895

24996
## addClassesProvider(callback, [priority])
250-
Adds a CSS class provider, invoked before each working set item is created or updated. When calledto update an existing item, all previously applied classes have been cleared.
97+
Adds a CSS class provider, invoked before each working set item is created or updated. When called
98+
to update an existing item, all previously applied classes have been cleared.
25199

252100
**Kind**: global function
253101

docs/API-Reference/project/FileTreeViewModel.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,32 @@
33
const FileTreeViewModel = brackets.getModule("project/FileTreeViewModel")
44
```
55

6-
<a name="Contains the treeData used to generate the file tree and methods used to update thattreeData.Instances dispatch the following events_- change (FileTreeViewModel.EVENT_CHANGE constant)_ Fired any time theres a change that should be reflected in the view."></a>
6+
<a name="Contains the treeData used to generate the file tree and methods used to update that
7+
treeData.
78

8-
## Contains the treeData used to generate the file tree and methods used to update thattreeData.Instances dispatch the following events:- change (FileTreeViewModel.EVENT\_CHANGE constant): Fired any time theres a change that should be reflected in the view.
9+
Instances dispatch the following events_
10+
- change (FileTreeViewModel.EVENT_CHANGE constant)_ Fired any time theres a change that should be reflected in the view."></a>
11+
12+
## Contains the treeData used to generate the file tree and methods used to update that
13+
treeData.
14+
15+
Instances dispatch the following events:
16+
- change (FileTreeViewModel.EVENT\_CHANGE constant): Fired any time theres a change that should be reflected in the view.
917
**Kind**: global class
1018
<a name="Immutable"></a>
1119

1220
## Immutable
13-
The view model (or a Store in the Flux terminology) used by the file tree.Many of the view model's methods are implemented by pure functions, which can behelpful for composability. Many of the methods commit the new treeData and send achange event when they're done whereas the functions do not do this.
21+
The view model (or a Store in the Flux terminology) used by the file tree.
22+
23+
Many of the view model's methods are implemented by pure functions, which can be
24+
helpful for composability. Many of the methods commit the new treeData and send a
25+
change event when they're done whereas the functions do not do this.
1426

1527
**Kind**: global variable
28+
<a name="EVENT_CHANGE"></a>
29+
30+
## EVENT\_CHANGE : <code>string</code>
31+
**Kind**: global constant
1632
<a name="isFile"></a>
1733

1834
## isFile(entry) ⇒ <code>boolean</code>
@@ -25,15 +41,3 @@ Determine if an entry from the treeData map is a file.
2541
| --- | --- | --- |
2642
| entry | <code>Immutable.Map</code> | entry to test |
2743

28-
<a name="_closeSubtree"></a>
29-
30-
## \_closeSubtree(directory) ⇒ <code>Immutable.Map</code>
31-
Closes a subtree path, given by an object path.
32-
33-
**Kind**: global function
34-
**Returns**: <code>Immutable.Map</code> - new directory
35-
36-
| Param | Type | Description |
37-
| --- | --- | --- |
38-
| directory | <code>Immutable.Map</code> | Current directory |
39-

0 commit comments

Comments
 (0)