Skip to content

Commit e352470

Browse files
committed
docs: update for NewFileContentManager.js
1 parent 8eb1280 commit e352470

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

docs/generatedApiDocs/features/NewFileContentManager-API.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Extensions can register to provide content with `NewFileContentManager.registerC
77

88
## Usage
99

10-
Let's say whenever a user creates a new js file, we have to prefill the contents to "console.log("hello")"
10+
Let's say whenever a user creates a new js file, we have to prefill the contents to "sample content"
1111

1212
```js
1313
const NewFileContentManager = brackets.getModule("features/NewFileContentManager");
@@ -17,7 +17,7 @@ NewFileContentManager.registerContentProvider(exports, ["js"], 1);
1717

1818
// provide a helpful name for the ContentProvider. This will be useful if you have to debug.
1919
exports.CONTENT_PROVIDER_NAME = "extension.someName";
20-
// now implement the getContent function that will be invoked when ever creates a new empty file.
20+
// now implement the getContent function that will be invoked when ever user creates a new empty file.
2121
exports.getContent = function(fullPath) {
2222
return new Promise((resolve, reject)=>{
2323
resolve("sample content");
@@ -96,10 +96,18 @@ all the content providers. If no text is returned by any providers, it will retu
9696

9797
### Parameters
9898

99-
* `fullPath`
99+
* `fullPath` **[string][1]**
100100

101-
Returns **[Promise][1]<[string][2]>** The text contents
101+
### Examples
102102

103-
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
103+
To get the default content given a path
104104

105-
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
105+
```javascript
106+
NewFileContentManager.getInitialContentForFile("/path/to/file.jsx");
107+
```
108+
109+
Returns **[Promise][2]<[string][1]>** The text contents
110+
111+
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
112+
113+
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise

src/features/NewFileContentManager.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* Extensions can register to provide content with `NewFileContentManager.registerContentProvider` API.
2828
*
2929
* ## Usage
30-
* Let's say whenever a user creates a new js file, we have to prefill the contents to "console.log("hello")"
30+
* Let's say whenever a user creates a new js file, we have to prefill the contents to "sample content"
3131
* ```js
3232
* const NewFileContentManager = brackets.getModule("features/NewFileContentManager");
3333
* // replace `js` with language ID(Eg. javascript) if you want to restrict the preview to js files only. use `all` for
@@ -36,7 +36,7 @@
3636
*
3737
* // provide a helpful name for the ContentProvider. This will be useful if you have to debug.
3838
* exports.CONTENT_PROVIDER_NAME = "extension.someName";
39-
* // now implement the getContent function that will be invoked when ever creates a new empty file.
39+
* // now implement the getContent function that will be invoked when ever user creates a new empty file.
4040
* exports.getContent = function(fullPath) {
4141
* return new Promise((resolve, reject)=>{
4242
* resolve("sample content");
@@ -127,7 +127,9 @@ define(function (require, exports, module) {
127127
/**
128128
* Returns a promise that resolves to the default text content of the given file after querying
129129
* all the content providers. If no text is returned by any providers, it will return an empty string "".
130-
* @param fullPath
130+
* @example <caption>To get the default content given a path</caption>
131+
* NewFileContentManager.getInitialContentForFile("/path/to/file.jsx");
132+
* @param {string} fullPath
131133
* @returns {Promise<string>} The text contents
132134
*/
133135
async function getInitialContentForFile(fullPath) {

0 commit comments

Comments
 (0)