## GtkSourceCompletionProvider

GtkSourceCompletionProvider — Completion provider interface

## Synopsis

    #include <gtksourceview/gtksourcecompletionprovider.h>

                        GtkSourceCompletionProvider;
    gchar *             gtk_source_completion_provider_get_name
                                                            (GtkSourceCompletionProvider *provider);
    GdkPixbuf *         gtk_source_completion_provider_get_icon
                                                            (GtkSourceCompletionProvider *provider);
    void                gtk_source_completion_provider_populate
                                                            (GtkSourceCompletionProvider *provider,
                                                             GtkSourceCompletionContext *context);
    GtkSourceCompletionActivation gtk_source_completion_provider_get_activation
                                                            (GtkSourceCompletionProvider *provider);
    gboolean            gtk_source_completion_provider_match
                                                            (GtkSourceCompletionProvider *provider,
                                                             GtkSourceCompletionContext *context);
    GtkWidget *         gtk_source_completion_provider_get_info_widget
                                                            (GtkSourceCompletionProvider *provider,
                                                             GtkSourceCompletionProposal *proposal);
    void                gtk_source_completion_provider_update_info
                                                            (GtkSourceCompletionProvider *provider,
                                                             GtkSourceCompletionProposal *proposal,
                                                             GtkSourceCompletionInfo *info);
    gboolean            gtk_source_completion_provider_get_start_iter
                                                            (GtkSourceCompletionProvider *provider,
                                                             GtkSourceCompletionContext *context,
                                                             GtkSourceCompletionProposal *proposal,
                                                             GtkTextIter *iter);
    gboolean            gtk_source_completion_provider_activate_proposal
                                                            (GtkSourceCompletionProvider *provider,
                                                             GtkSourceCompletionProposal *proposal,
                                                             GtkTextIter *iter);
    gint                gtk_source_completion_provider_get_interactive_delay
                                                            (GtkSourceCompletionProvider *provider);
    gint                gtk_source_completion_provider_get_priority
                                                            (GtkSourceCompletionProvider *provider);

## Object Hierarchy

      GInterface
       +----GtkSourceCompletionProvider

## Prerequisites

GtkSourceCompletionProvider requires GObject.

## Description

You must implement this interface to provide proposals to GtkSourceCompletion

## Details

### GtkSourceCompletionProvider

    typedef struct _GtkSourceCompletionProvider GtkSourceCompletionProvider;

### gtk_source_completion_provider_get_name ()

    gchar *             gtk_source_completion_provider_get_name
                                                            (GtkSourceCompletionProvider *provider);

Get the name of the provider. This should be a translatable name for display to the user. For example: _("Document word completion provider"). The returned string must be freed with `g_free()`.

`provider` : | a GtkSourceCompletionProvider.
Returns : | a new string containing the name of the provider.

### gtk_source_completion_provider_get_icon ()

    GdkPixbuf *         gtk_source_completion_provider_get_icon
                                                            (GtkSourceCompletionProvider *provider);

Get the icon of the provider.

`provider` : | The GtkSourceCompletionProvider
Returns : | The icon to be used for the provider, or `NULL` if the provider does not have a special icon. [transfer none]

### gtk_source_completion_provider_populate ()

    void                gtk_source_completion_provider_populate
                                                            (GtkSourceCompletionProvider *provider,
                                                             GtkSourceCompletionContext *context);

Populate `context` with proposals from `provider`.

`provider` : | a GtkSourceCompletionProvider.
`context` : | a GtkSourceCompletionContext.

### gtk_source_completion_provider_get_activation ()

    GtkSourceCompletionActivation gtk_source_completion_provider_get_activation
                                                            (GtkSourceCompletionProvider *provider);

Get with what kind of activation the provider should be activated.

`provider` : | a GtkSourceCompletionProvider.
Returns : | a combination of GtkSourceCompletionActivation.

### gtk_source_completion_provider_match ()

    gboolean            gtk_source_completion_provider_match
                                                            (GtkSourceCompletionProvider *provider,
                                                             GtkSourceCompletionContext *context);

Get whether the provider match the context of completion detailed in `context`.

`provider` : | a GtkSourceCompletionProvider.
`context` : | a GtkSourceCompletionContext.
Returns : | `TRUE` if `provider` matches the completion context, `FALSE` otherwise.

### gtk_source_completion_provider_get_info_widget ()

    GtkWidget *         gtk_source_completion_provider_get_info_widget
                                                            (GtkSourceCompletionProvider *provider,
                                                             GtkSourceCompletionProposal *proposal);

Get a customized info widget to show extra information of a proposal. This allows for customized widgets on a proposal basis, although in general providers will have the same custom widget for all their proposals and `proposal` can be ignored. The implementation of this function is optional. If implemented, gtk_source_completion_provider_update_info MUST also be implemented. If not implemented, the default gtk_source_completion_proposal_get_info will be used to display extra information about a GtkSourceCompletionProposal.

`provider` : | a GtkSourceCompletionProvider.
`proposal` : | a currently selected GtkSourceCompletionProposal.
Returns : | a custom GtkWidget to show extra information about `proposal`. [transfer none]

### gtk_source_completion_provider_update_info ()

    void                gtk_source_completion_provider_update_info
                                                            (GtkSourceCompletionProvider *provider,
                                                             GtkSourceCompletionProposal *proposal,
                                                             GtkSourceCompletionInfo *info);

Update extra information shown in `info` for `proposal`. This should be implemented if your provider sets a custom info widget for `proposal`. This function MUST be implemented when gtk_source_completion_provider_get_info_widget is implemented.

`provider` : | a GtkSourceCompletionProvider.
`proposal` : | a GtkSourceCompletionProposal.
`info` : | a GtkSourceCompletionInfo.

### gtk_source_completion_provider_get_start_iter ()

    gboolean            gtk_source_completion_provider_get_start_iter
                                                            (GtkSourceCompletionProvider *provider,
                                                             GtkSourceCompletionContext *context,
                                                             GtkSourceCompletionProposal *proposal,
                                                             GtkTextIter *iter);

Get the GtkTextIter at which the completion for `proposal` starts. When implemented, the completion can use this information to position the completion window accordingly when a proposal is selected in the completion window.

`provider` : | a GtkSourceCompletionProvider.
`proposal` : | a GtkSourceCompletionProposal.
`context` : | a GtkSourceCompletionContext.
`iter` : | a GtkTextIter.
Returns : | `TRUE` if `iter` was set for `proposal`, `FALSE` otherwise.

### gtk_source_completion_provider_activate_proposal ()

    gboolean            gtk_source_completion_provider_activate_proposal
                                                            (GtkSourceCompletionProvider *provider,
                                                             GtkSourceCompletionProposal *proposal,
                                                             GtkTextIter *iter);

Activate `proposal` at `iter`. When this functions returns `FALSE`, the default activation of `proposal` will take place which replaces the word at `iter` with the label of `proposal`.

`provider` : | a GtkSourceCompletionProvider.
`proposal` : | a GtkSourceCompletionProposal.
`iter` : | a GtkTextIter.
Returns : | `TRUE` to indicate that the proposal activation has been handled, `FALSE` otherwise.

### gtk_source_completion_provider_get_interactive_delay ()

    gint                gtk_source_completion_provider_get_interactive_delay
                                                            (GtkSourceCompletionProvider *provider);

Get the delay in milliseconds before starting interactive completion for this provider. A value of -1 indicates to use the default value as set by "auto-complete-delay".

`provider` : | a GtkSourceCompletionProvider.
Returns : | the interactive delay in milliseconds.

### gtk_source_completion_provider_get_priority ()

    gint                gtk_source_completion_provider_get_priority
                                                            (GtkSourceCompletionProvider *provider);

Get the provider priority. The priority determines the order in which proposals appear in the completion popup. Higher priorities are sorted before lower priorities. The default priority is 0.

`provider` : | a GtkSourceCompletionProvider.
Returns : | the provider priority.