Show:

A base class for AutoCompleteBase.

Constructor

A.AceEditor.AutoCompleteBase

(
  • config
)

Parameters:

  • config Object

    Object literal specifying widget configuration properties.

Methods

_addSuggestion

(
  • content
)
Do.Halt protected

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:

Do.Halt:

Instance of Do.Halt to stop function execution

_bindUIACBase

() protected

Binds editor events.

_defaultCursorChangeFn

(
  • event
)
protected

Checks if the cursor is out of the row/column on the latest match. If so, fires an cursorOut event.

Parameters:

_destroyUIACBase

() protected

Removes the listeners to editor commands.

_filterResults

(
  • content
  • results
)
Array protected

Filters and sorts the found suggestions using the existing chain of filters and sorters.

Parameters:

  • content String
  • results Array

Returns:

Array:

The filtered results

_getEditor

() Object protected

Returns the editor instance.

Returns:

Object:

Editor instance

_handleEnter

(
  • text
)
Do.Halt protected

Checks for new line or tab character and adds a suggestion to the editor if so.

Parameters:

  • text String

Returns:

Do.Halt:

If text is new line or tab character, returns an instance of Do.Halt to stop function execution

_onEditorChange

(
  • event
)
protected

Handles editor change event. If editor is not locked and data action is insert or remove text, process auto complete.

Parameters:

_onEditorChangeCursor

(
  • event
)
protected

Fires cursor change event providing the current position as event payload.

Parameters:

_onResultsError

(
  • error
)
protected

Fires an resultsError event containing the error.

Parameters:

  • error Object

_onResultsSuccess

(
  • results
)
protected

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
)
Array protected

Checks for phrase match.

Parameters:

  • content String

    The content to be checked for phrase match

  • results Array

    The results to be filtered

  • caseSensitive Boolean

    Should the check be case sensitive or not

Returns:

Array:

The filtered results

_processAutoComplete

(
  • row
  • column
)
protected

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

Parameters:

  • row Number

    The row on which match happened

  • column Number

    The column on which match happened

_removeAutoCompleteCommands

() protected

Detaches the previously attached editor commands.

_sortAscLength

(
  • content
  • results
  • caseSensitive
)
Array protected

Sorts the results in ascending order, taking in consideration the length of the content.

Parameters:

  • content String

    The text content

  • results Array

    The results to be filtered

  • caseSensitive Boolean

    Should we filter these results alphabetically

Returns:

Array:

The sorted results

_validateFillMode

(
  • value
)
Boolean protected

Validates the value of fillMode attribute.

Parameters:

  • value Object

Returns:

Boolean:

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

processor

Object | Function

The default processor which will be used to process matches.

showListKey

Object

The keyboard combination which should be used to show the list with found results.

Default: 'Alt-Space' for Mac, 'Ctrl-Space' for PC

sorters

Array

Provides an array of sorter functions which will sort the results. By default there is one function which sorts the results in ascending order.

Default: Array with one function which sorts results in ascending order