### Interface

# GtkSource CompletionProvider

#### Description [src]

    interface GtkSource.CompletionProvider : GObject.Object

Completion provider interface.

You must implement this interface to provide proposals to `GtkSourceCompletion`.

In most cases, implementations of this interface will want to use `GtkSource.CompletionProviderInterface.populate_async` to asynchronously populate the results to avoid blocking the main loop.

#### Prerequisite

In order to implement CompletionProvider, your type must inherit from`GObject`.

#### Implementations

- GtkSourceCompletionSnippets
- GtkSourceCompletionWords

#### Instance methods

###### gtk_source_completion_provider_activate

This function requests `proposal` to be activated by the `GtkSourceCompletionProvider`.

###### gtk_source_completion_provider_display

This function requests that the `GtkSourceCompletionProvider` prepares `cell` to display the contents of `proposal`.

###### gtk_source_completion_provider_get_priority

This function should return the priority of `self` in `context`.

###### gtk_source_completion_provider_get_title

Gets the title of the completion provider, if any.

###### gtk_source_completion_provider_is_trigger

This function is used to determine if a character inserted into the text editor should cause a new completion request to be triggered.

###### gtk_source_completion_provider_key_activates

This function is used to determine if a key typed by the user should activate `proposal` (resulting in committing the text to the editor).

###### gtk_source_completion_provider_list_alternates

Providers should return a list of alternates to `proposal` or `NULL` if there are no alternates available.

###### gtk_source_completion_provider_populate_async

Asynchronously requests that the provider populates the completion results for `context`.

###### gtk_source_completion_provider_populate_finish

Completes an asynchronous operation to populate a completion provider.

###### gtk_source_completion_provider_refilter

This function can be used to filter results previously provided to the `GtkSourceCompletionContext` by the `GtkSourceCompletionProvider`.

#### Interface structure

    struct GtkSourceCompletionProviderInterface {
      GTypeInterface parent_iface;
      char* (* get_title) (
        GtkSourceCompletionProvider* self
      );
      int (* get_priority) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context
      );
      gboolean (* is_trigger) (
        GtkSourceCompletionProvider* self,
        const GtkTextIter* iter,
        gunichar ch
      );
      gboolean (* key_activates) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context,
        GtkSourceCompletionProposal* proposal,
        guint keyval,
        GdkModifierType state
      );
      GListModel* (* populate) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context,
        GError** error
      );
      void (* populate_async) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context,
        GCancellable* cancellable,
        GAsyncReadyCallback callback,
        gpointer user_data
      );
      GListModel* (* populate_finish) (
        GtkSourceCompletionProvider* self,
        GAsyncResult* result,
        GError** error
      );
      void (* refilter) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context,
        GListModel* model
      );
      void (* display) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context,
        GtkSourceCompletionProposal* proposal,
        GtkSourceCompletionCell* cell
      );
      void (* activate) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context,
        GtkSourceCompletionProposal* proposal
      );
      GPtrArray* (* list_alternates) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context,
        GtkSourceCompletionProposal* proposal
      );

    }

No description available.

###### Interface members

`parent_iface` |
    GTypeInterface
| No description available.
`get_title` |
    char* (* get_title) (
        GtkSourceCompletionProvider* self
      )
| No description available.
`get_priority` |
    int (* get_priority) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context
      )
| No description available.
`is_trigger` |
    gboolean (* is_trigger) (
        GtkSourceCompletionProvider* self,
        const GtkTextIter* iter,
        gunichar ch
      )
| No description available.
`key_activates` |
    gboolean (* key_activates) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context,
        GtkSourceCompletionProposal* proposal,
        guint keyval,
        GdkModifierType state
      )
| No description available.
`populate` |
    GListModel* (* populate) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context,
        GError** error
      )
| No description available.
`populate_async` |
    void (* populate_async) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context,
        GCancellable* cancellable,
        GAsyncReadyCallback callback,
        gpointer user_data
      )
| No description available.
`populate_finish` |
    GListModel* (* populate_finish) (
        GtkSourceCompletionProvider* self,
        GAsyncResult* result,
        GError** error
      )
| No description available.
`refilter` |
    void (* refilter) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context,
        GListModel* model
      )
| No description available.
`display` |
    void (* display) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context,
        GtkSourceCompletionProposal* proposal,
        GtkSourceCompletionCell* cell
      )
| No description available.
`activate` |
    void (* activate) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context,
        GtkSourceCompletionProposal* proposal
      )
| No description available.
`list_alternates` |
    GPtrArray* (* list_alternates) (
        GtkSourceCompletionProvider* self,
        GtkSourceCompletionContext* context,
        GtkSourceCompletionProposal* proposal
      )
| No description available.

#### Virtual methods

###### GtkSource.CompletionProvider.activate

This function requests `proposal` to be activated by the `GtkSourceCompletionProvider`.

###### GtkSource.CompletionProvider.display

This function requests that the `GtkSourceCompletionProvider` prepares `cell` to display the contents of `proposal`.

###### GtkSource.CompletionProvider.get_priority

This function should return the priority of `self` in `context`.

###### GtkSource.CompletionProvider.get_title

Gets the title of the completion provider, if any.

###### GtkSource.CompletionProvider.is_trigger

This function is used to determine if a character inserted into the text editor should cause a new completion request to be triggered.

###### GtkSource.CompletionProvider.key_activates

This function is used to determine if a key typed by the user should activate `proposal` (resulting in committing the text to the editor).

###### GtkSource.CompletionProvider.list_alternates

Providers should return a list of alternates to `proposal` or `NULL` if there are no alternates available.

###### GtkSource.CompletionProvider.populate

No description available.

###### GtkSource.CompletionProvider.populate_async

Asynchronously requests that the provider populates the completion results for `context`.

###### GtkSource.CompletionProvider.populate_finish

Completes an asynchronous operation to populate a completion provider.

###### GtkSource.CompletionProvider.refilter

This function can be used to filter results previously provided to the `GtkSourceCompletionContext` by the `GtkSourceCompletionProvider`.