A.AceEditor.AutoCompleteBase Class
A base class for AutoCompleteBase.
Constructor
A.AceEditor.AutoCompleteBase
-
config
Parameters:
-
config
ObjectObject literal specifying widget configuration properties.
Index
Methods
- _addSuggestion
- _bindUIACBase
- _defaultCursorChangeFn
- _destroyUIACBase
- _filterResults
- _getEditor
- _handleEnter
- _onEditorChange
- _onEditorChangeCursor
- _onResultsError
- _onResultsSuccess
- _overwriteCommands
- _phraseMatch
- _processAutoComplete
- _removeAutoCompleteCommands
- _sortAscLength
- _validateFillMode
- initializer
Properties
- ATTRS static
- FILL_MODE_INSERT static
- FILL_MODE_OVERWRITE static
- NAME static
- NS static
Attributes
Methods
_addSuggestion
-
content
Inserts the provided suggestion as a string to the editor. The added text
can overwrite the match or to be inserted depending on the fillMode
attribute.
Parameters:
-
content
String
Returns:
Instance of Do.Halt to stop function execution
_bindUIACBase
()
protected
Binds editor events.
_defaultCursorChangeFn
-
event
Checks if the cursor is out of the row/column on the latest match. If so,
fires an cursorOut
event.
Parameters:
-
event
CustomEventThe fired event
_destroyUIACBase
()
protected
Removes the listeners to editor commands.
_filterResults
-
content
-
results
Filters and sorts the found suggestions using the existing chain of
filters
and sorters
.
Parameters:
-
content
String -
results
Array
Returns:
The filtered results
_getEditor
()
Object
protected
Returns the editor instance.
Returns:
Editor instance
_handleEnter
-
text
Checks for new line or tab character and adds a suggestion to the editor if so.
Parameters:
-
text
String
Returns:
If text is new line or tab character, returns an instance of Do.Halt to stop function execution
_onEditorChange
-
event
Handles editor change event. If editor is not locked and data action is insert or remove text, process auto complete.
Parameters:
-
event
CustomEventThe fired event
_onEditorChangeCursor
-
event
Fires cursor change event providing the current position as event payload.
Parameters:
-
event
CustomEventThe fired event
_onResultsError
-
error
Fires an resultsError
event containing the error.
Parameters:
-
error
Object
_onResultsSuccess
-
results
Updates results
attribute with the provided results.
Parameters:
-
results
Array
_overwriteCommands
()
protected
Overwrites the following editor commands: onTextInput, golinedown golineup gotoend gotolineend gotolinestart gotopagedown gotopageup gotostart
_phraseMatch
-
content
-
results
-
caseSensitive
Checks for phrase match.
Parameters:
-
content
StringThe content to be checked for phrase match
-
results
ArrayThe results to be filtered
-
caseSensitive
BooleanShould the check be case sensitive or not
Returns:
The filtered results
_processAutoComplete
-
row
-
column
Invokes the loaded content processor and checks for match. If found,
provides the match together with information about current row and column
and invokes processor's getResults
function in order to retrieve
results. At the end, fires and match
event with the following
properties: column - the current column coords - the page coordinates of
the match line - the current line match - the current match row - the
current row
_removeAutoCompleteCommands
()
protected
Detaches the previously attached editor commands.
_sortAscLength
-
content
-
results
-
caseSensitive
Sorts the results in ascending order, taking in consideration the length of the content.
Parameters:
-
content
StringThe text content
-
results
ArrayThe results to be filtered
-
caseSensitive
BooleanShould we filter these results alphabetically
Returns:
The sorted results
_validateFillMode
-
value
Validates the value of fillMode
attribute.
Parameters:
-
value
Object
Returns:
True if mode is 'overwrite' - value '0' or 'insert' - value '1'
initializer
()
protected
Construction logic executed during AutoCompleteBase instantiation. Lifecycle.
Properties
ATTRS
Object
static
Static property used to define the default attribute configuration for AutoCompleteBase.
FILL_MODE_INSERT
Unknown
static
Exposes a constant for insert fill mode. See fillMode
for more information.
FILL_MODE_OVERWRITE
Unknown
static
Exposes a constant for overwrite fill mode. See fillMode
for more
information.
NAME
String
static
Static property which provides a string to identify the class.
NS
String
static
Static property which provides a string to identify the namespace.
Attributes
fillMode
Number
The mode in which the AutoComplete should operate. Can be one of these: INSERT - value '0' or OVERWRITE - value '1'. In case of INSERT mode, when Editor adds a suggestion, it will be added next to the matched expression. In case of OVERWRITE mode, the suggestion will overwrite the matched expression.
Default: 1 - OVERWRITE mode
filters
Array
Provides an array of filter functions which will filter the results. By default there is one function which provides phrase match filtering.
Default: Array with one function which provides phrase match filtering