Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: docusaurus build fail issue #1968

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
25 changes: 18 additions & 7 deletions docs/API-Reference/editor/CodeHintManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@ __CodeHintProvider Overview:__

A code hint provider should implement the following three functions:

```js
- `CodeHintProvider.hasHints(editor, implicitChar)`
- `CodeHintProvider.getHints(implicitChar)`
- `CodeHintProvider.insertHint(hint)`
```

The behavior of these three functions is described in detail below.

```js
__CodeHintProvider.hasHints(editor, implicitChar)__
```

The method by which a provider indicates intent to provide hints for a
given editor. The manager calls this method both when hints are
Expand Down Expand Up @@ -83,21 +87,25 @@ may wish to prepare to cache data suitable for the current session. In
particular, it should keep a reference to the editor object so that it
can access the editor in future calls to getHints and insertHints.

```js
param {Editor} editor
```
A non-null editor object for the active window.

param {string} implicitChar
param {String} implicitChar
Either null, if the hinting request was explicit, or a single character
that represents the last insertion and that indicates an implicit
hinting request.

return {boolean}
return {Boolean}
Determines whether the current provider is able to provide hints for
the given editor context and, in case implicitChar is non- null,
whether it is appropriate to do so.


```js
__CodeHintProvider.getHints(implicitChar)__
```

The method by which a provider provides hints for the editor context
associated with the current session. The getHints method is called only
Expand Down Expand Up @@ -152,15 +160,17 @@ once for each such editor change. Consequently, the provider may also
assume that the document will not be changed outside of the editor
during a session.

param {string} implicitChar
param {String} implicitChar
Either null, if the request to update the hint list was a result of
navigation, or a single character that represents the last insertion.

```js
return {jQuery.Deferred|{
hints: Array.<string|jQueryObject>,
match: string,
selectInitial: boolean,
handleWideResults: boolean}}
```

Null if the provider wishes to end the hinting session. Otherwise, a
response object, possibly deferred, that provides 1. a sorted array
Expand All @@ -180,8 +190,9 @@ choose to let the manager handle emphasis for the simple and common case
of prefix matching, or can provide its own emphasis if it wishes to use
a more sophisticated matching algorithm.


```js
__CodeHintProvider.insertHint(hint)__
```

The method by which a provider inserts a hint into the editor context
associated with the current session. The provider may assume that the
Expand All @@ -193,17 +204,17 @@ or not the end of the session should be immediately followed by a new
explicit hinting request, which may result in a new hinting session
being opened with some provider, but not necessarily the current one.

param {string} hint
param {String} hint
The hint to be inserted into the editor context for the current session.

return {boolean}
return {Boolean}
Indicates whether the manager should follow hint insertion with an
explicit hint request.


__CodeHintProvider.insertHintOnTab__

type {?boolean} insertHintOnTab
type {Boolean} insertHintOnTab
Indicates whether the CodeHintManager should request that the provider of
the current session insert the currently selected hint on tab key events,
or if instead a tab character should be inserted into the editor. If omitted,
Expand Down
14 changes: 14 additions & 0 deletions docs/API-Reference/editor/Editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const Editor = brackets.getModule("editor/Editor")
* [.charCoords(pos, [mode])](#Editor+charCoords) ⇒ <code>Object</code>
* [.getToken([cursor], [precise])](#Editor+getToken) ⇒ <code>Object</code>
* [.getCharacterAtPosition(pos)](#Editor+getCharacterAtPosition) ⇒ <code>string</code> \| <code>null</code>
* [.getLine(lineNumber)](#Editor+getLine) ⇒ <code>string</code> \| <code>null</code>
* [.getPrevCharacterAtPosition(pos)](#Editor+getPrevCharacterAtPosition) ⇒ <code>string</code> \| <code>null</code>
* [.getNextToken([cursor], [skipWhitespace], [precise])](#Editor+getNextToken) ⇒ <code>Object</code>
* [.getPreviousToken([cursor], [skipWhitespace], [precise])](#Editor+getPreviousToken) ⇒ <code>Object</code>
Expand Down Expand Up @@ -554,6 +555,19 @@ x|y where `|` is the cursor, will return y
| --- | --- | --- |
| pos | <code>CodeMirror.Position</code> | The position from which to retrieve the character. This should be an object with `line` and `ch` properties. |

<a name="Editor+getLine"></a>

### editor.getLine(lineNumber) ⇒ <code>string</code> \| <code>null</code>
Retrieves a single line text

**Kind**: instance method of [<code>Editor</code>](#Editor)
**Returns**: <code>string</code> \| <code>null</code> - The text at the given position if within bounds,
otherwise `null` if the position is out of range.

| Param | Type | Description |
| --- | --- | --- |
| lineNumber | <code>number</code> | The lineNumber to extract text from |

<a name="Editor+getPrevCharacterAtPosition"></a>

### editor.getPrevCharacterAtPosition(pos) ⇒ <code>string</code> \| <code>null</code>
Expand Down
25 changes: 18 additions & 7 deletions src/editor/CodeHintManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,17 @@
*
* A code hint provider should implement the following three functions:
*
* ```js
* - `CodeHintProvider.hasHints(editor, implicitChar)`
* - `CodeHintProvider.getHints(implicitChar)`
* - `CodeHintProvider.insertHint(hint)`
* ```
*
* The behavior of these three functions is described in detail below.
*
* ```js
* __CodeHintProvider.hasHints(editor, implicitChar)__
* ```
*
* The method by which a provider indicates intent to provide hints for a
* given editor. The manager calls this method both when hints are
Expand Down Expand Up @@ -99,21 +103,25 @@
* particular, it should keep a reference to the editor object so that it
* can access the editor in future calls to getHints and insertHints.
*
* ```js
* param {Editor} editor
* ```
* A non-null editor object for the active window.
*
* param {string} implicitChar
* param {String} implicitChar
* Either null, if the hinting request was explicit, or a single character
* that represents the last insertion and that indicates an implicit
* hinting request.
*
* return {boolean}
* return {Boolean}
* Determines whether the current provider is able to provide hints for
* the given editor context and, in case implicitChar is non- null,
* whether it is appropriate to do so.
*
*
* ```js
* __CodeHintProvider.getHints(implicitChar)__
* ```
*
* The method by which a provider provides hints for the editor context
* associated with the current session. The getHints method is called only
Expand Down Expand Up @@ -168,15 +176,17 @@
* assume that the document will not be changed outside of the editor
* during a session.
*
* param {string} implicitChar
* param {String} implicitChar
* Either null, if the request to update the hint list was a result of
* navigation, or a single character that represents the last insertion.
*
* ```js
* return {jQuery.Deferred|{
* hints: Array.<string|jQueryObject>,
* match: string,
* selectInitial: boolean,
* handleWideResults: boolean}}
* ```
*
* Null if the provider wishes to end the hinting session. Otherwise, a
* response object, possibly deferred, that provides 1. a sorted array
Expand All @@ -196,8 +206,9 @@
* of prefix matching, or can provide its own emphasis if it wishes to use
* a more sophisticated matching algorithm.
*
*
* ```js
* __CodeHintProvider.insertHint(hint)__
* ```
*
* The method by which a provider inserts a hint into the editor context
* associated with the current session. The provider may assume that the
Expand All @@ -209,17 +220,17 @@
* explicit hinting request, which may result in a new hinting session
* being opened with some provider, but not necessarily the current one.
*
* param {string} hint
* param {String} hint
* The hint to be inserted into the editor context for the current session.
*
* return {boolean}
* return {Boolean}
* Indicates whether the manager should follow hint insertion with an
* explicit hint request.
*
*
* __CodeHintProvider.insertHintOnTab__
*
* type {?boolean} insertHintOnTab
* type {Boolean} insertHintOnTab
* Indicates whether the CodeHintManager should request that the provider of
* the current session insert the currently selected hint on tab key events,
* or if instead a tab character should be inserted into the editor. If omitted,
Expand Down