Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CompletionHandler

A completion handler for editors.

Hierarchy

  • CompletionHandler

Implements

  • IDisposable

Index

Constructors

constructor

  • Construct a new completion handler for a widget.

    Parameters

    Returns CompletionHandler

Properties

Private _connector

_connector: any

Private _editor

_editor: any

Private _enabled

_enabled: any

Private _isDisposed

_isDisposed: any

Private _isICompletionItemsConnector

_isICompletionItemsConnector: any

Private _makeRequest

_makeRequest: any

Make a completion request.

Private _onFailure

_onFailure: any

If completion request fails, reset model and fail silently.

Private _onFetchItemsReply

_onFetchItemsReply: any

Receive completion items from provider.

param

The state of the editor when completion request was made.

param

The API response returned for a completion request.

Private _onReply

_onReply: any

Receive a completion reply from the connector.

param

The state of the editor when completion request was made.

param

The API response returned for a completion request.

Private _pending

_pending: any

Private _updateModel

_updateModel: any

Updates model with text state and current cursor position.

Private _validate

_validate: any

Readonly completer

completer: Completer

The completer widget managed by the handler.

Accessors

connector

  • The data connector used to populate completion requests.

    Notes

    The only method of this connector that will ever be called is fetch, so it is acceptable for the other methods to be simple functions that return rejected promises.

    Returns IDataConnector<IReply, void, IRequest>

  • The data connector used to populate completion requests.

    Notes

    The only method of this connector that will ever be called is fetch, so it is acceptable for the other methods to be simple functions that return rejected promises.

    Parameters

    Returns any

editor

  • get editor(): CodeEditor.IEditor | null
  • set editor(newValue: CodeEditor.IEditor | null): any
  • The editor used by the completion handler.

    Returns CodeEditor.IEditor | null

  • The editor used by the completion handler.

    Parameters

    • newValue: CodeEditor.IEditor | null

    Returns any

isDisposed

  • get isDisposed(): boolean
  • Get whether the completion handler is disposed.

    Returns boolean

Methods

dispose

  • dispose(): void
  • Dispose of the resources used by the handler.

    Returns void

Protected getState

  • getState(editor: CodeEditor.IEditor, position: CodeEditor.IPosition): ITextState
  • Get the state of the text editor at the given position.

    Parameters

    • editor: CodeEditor.IEditor
    • position: CodeEditor.IPosition

    Returns ITextState

invoke

  • invoke(): void
  • Invoke the handler and launch a completer.

    Returns void

Protected onCompletionSelected

  • onCompletionSelected(completer: Completer, val: string): void
  • Handle a completion selected signal from the completion widget.

    Parameters

    Returns void

Protected onInvokeRequest

  • onInvokeRequest(msg: Message): void
  • Handle invoke-request messages.

    Parameters

    • msg: Message

    Returns void

Protected onSelectionsChanged

  • onSelectionsChanged(): void
  • Handle selection changed signal from an editor.

    Notes

    If a sub-class reimplements this method, then that class must either call its super method or it must take responsibility for adding and removing the completer completable class to the editor host node.

    Despite the fact that the editor widget adds a class whenever there is a primary selection, this method checks independently for two reasons:

    1. The editor widget connects to the same signal to add that class, so there is no guarantee that the class will be added before this method is invoked so simply checking for the CSS class's existence is not an option. Secondarily, checking the editor state should be faster than querying the DOM in either case.
    2. Because this method adds a class that indicates whether completer functionality ought to be enabled, relying on the behavior of the jp-mod-has-primary-selection to filter out any editors that have a selection means the semantic meaning of jp-mod-completer-enabled is obscured because there may be cases where the enabled class is added even though the completer is not available.

    Returns void

Protected onTextChanged

  • onTextChanged(): void
  • Handle a text changed signal from an editor.

    Returns void

Protected onVisibilityChanged

  • onVisibilityChanged(completer: Completer): void
  • Handle a visibility change signal from a completer widget.

    Parameters

    Returns void

processMessage

  • processMessage(msg: Message): void
  • Process a message sent to the completion handler.

    Parameters

    • msg: Message

    Returns void

Generated using TypeDoc