GtkSource.CompletionProvider

g GObject.GInterface GObject.GInterface GtkSource.CompletionProvider GtkSource.CompletionProvider GObject.GInterface->GtkSource.CompletionProvider

Implementations:

GtkSource.CompletionWords

Methods

activate_proposal (proposal, iter)

get_activation ()

get_gicon ()

get_icon ()

get_icon_name ()

get_info_widget (proposal)

get_interactive_delay ()

get_name ()

get_priority ()

get_start_iter (context, proposal)

match (context)

populate (context)

update_info (proposal, info)

Virtual Methods

do_activate_proposal (proposal, iter)

do_get_activation ()

do_get_gicon ()

do_get_icon ()

do_get_icon_name ()

do_get_info_widget (proposal)

do_get_interactive_delay ()

do_get_name ()

do_get_priority ()

do_get_start_iter (context, proposal)

do_match (context)

do_populate (context)

do_update_info (proposal, info)

Properties

None

Signals

None

Fields

None

Class Details

class GtkSource.CompletionProvider
Bases:

GObject.GInterface

Structure:

GtkSource.CompletionProviderIface

activate_proposal(proposal, iter)
Parameters:
Returns:

True to indicate that the proposal activation has been handled, False otherwise.

Return type:

bool

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 text of proposal (see GtkSource.CompletionProposal.get_text()).

Here is how the default activation selects the boundaries of the word to replace. The end of the word is iter. For the start of the word, it depends on whether a start iter is defined for proposal (see GtkSource.CompletionProvider.get_start_iter()). If a start iter is defined, the start of the word is the start iter. Else, the word (as long as possible) will contain only alphanumerical and the “_” characters.

get_activation()
Returns:

a combination of GtkSource.CompletionActivation.

Return type:

GtkSource.CompletionActivation

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

get_gicon()
Returns:

The icon to be used for the provider, or None if the provider does not have a special icon.

Return type:

Gio.Icon or None

Gets the Gio.Icon for the icon of self.

New in version 3.18.

get_icon()
Returns:

The icon to be used for the provider, or None if the provider does not have a special icon.

Return type:

GdkPixbuf.Pixbuf or None

Get the GdkPixbuf.Pixbuf for the icon of the self.

get_icon_name()
Returns:

The icon name to be used for the provider, or None if the provider does not have a special icon.

Return type:

str or None

Gets the icon name of self.

New in version 3.18.

get_info_widget(proposal)
Parameters:

proposal (GtkSource.CompletionProposal) – a currently selected GtkSource.CompletionProposal.

Returns:

a custom Gtk.Widget to show extra information about proposal, or None if the provider does not have a special info widget.

Return type:

Gtk.Widget or None

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 this function is not implemented, the default widget is a Gtk.Label. The return value of GtkSource.CompletionProposal.get_info() is used as the content of the Gtk.Label.

If implemented, GtkSource.CompletionProvider.update_info() must also be implemented.

get_interactive_delay()
Returns:

the interactive delay in milliseconds.

Return type:

int

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 the GtkSource.Completion :auto-complete-delay property.

get_name()
Returns:

a new string containing the name of the provider.

Return type:

str

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 GLib.free().

get_priority()
Returns:

the provider priority.

Return type:

int

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.

get_start_iter(context, proposal)
Parameters:
Returns:

True if iter was set for proposal, False otherwise.

iter:

a Gtk.TextIter.

Return type:

(bool, iter: Gtk.TextIter)

Get the Gtk.TextIter at which the completion for proposal starts. When implemented, this information is used to position the completion window accordingly when a proposal is selected in the completion window. The proposal text inside the completion window is aligned on iter.

If this function is not implemented, the word boundary is taken to position the completion window. See GtkSource.CompletionProvider.activate_proposal() for an explanation on the word boundaries.

When the proposal is activated, the default handler uses iter as the start of the word to replace. See GtkSource.CompletionProvider.activate_proposal() for more information.

match(context)
Parameters:

context (GtkSource.CompletionContext) – a GtkSource.CompletionContext.

Returns:

True if self matches the completion context, False otherwise.

Return type:

bool

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

populate(context)
Parameters:

context (GtkSource.CompletionContext) – a GtkSource.CompletionContext.

Populate context with proposals from self added with the GtkSource.CompletionContext.add_proposals() function.

update_info(proposal, info)
Parameters:

Update extra information shown in info for proposal.

This function must be implemented when GtkSource.CompletionProvider.get_info_widget() is implemented.

do_activate_proposal(proposal, iter) virtual
Parameters:
Returns:

True to indicate that the proposal activation has been handled, False otherwise.

Return type:

bool

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 text of proposal (see GtkSource.CompletionProposal.get_text()).

Here is how the default activation selects the boundaries of the word to replace. The end of the word is iter. For the start of the word, it depends on whether a start iter is defined for proposal (see GtkSource.CompletionProvider.get_start_iter()). If a start iter is defined, the start of the word is the start iter. Else, the word (as long as possible) will contain only alphanumerical and the “_” characters.

do_get_activation() virtual
Returns:

a combination of GtkSource.CompletionActivation.

Return type:

GtkSource.CompletionActivation

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

do_get_gicon() virtual
Returns:

The icon to be used for the provider, or None if the provider does not have a special icon.

Return type:

Gio.Icon or None

Gets the Gio.Icon for the icon of provider.

New in version 3.18.

do_get_icon() virtual
Returns:

The icon to be used for the provider, or None if the provider does not have a special icon.

Return type:

GdkPixbuf.Pixbuf or None

Get the GdkPixbuf.Pixbuf for the icon of the provider.

do_get_icon_name() virtual
Returns:

The icon name to be used for the provider, or None if the provider does not have a special icon.

Return type:

str or None

Gets the icon name of provider.

New in version 3.18.

do_get_info_widget(proposal) virtual
Parameters:

proposal (GtkSource.CompletionProposal) – a currently selected GtkSource.CompletionProposal.

Returns:

a custom Gtk.Widget to show extra information about proposal, or None if the provider does not have a special info widget.

Return type:

Gtk.Widget or None

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 this function is not implemented, the default widget is a Gtk.Label. The return value of GtkSource.CompletionProposal.get_info() is used as the content of the Gtk.Label.

If implemented, GtkSource.CompletionProvider.update_info() must also be implemented.

do_get_interactive_delay() virtual
Returns:

the interactive delay in milliseconds.

Return type:

int

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 the GtkSource.Completion :auto-complete-delay property.

do_get_name() virtual
Returns:

a new string containing the name of the provider.

Return type:

str

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 GLib.free().

do_get_priority() virtual
Returns:

the provider priority.

Return type:

int

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.

do_get_start_iter(context, proposal) virtual
Parameters:
Returns:

True if iter was set for proposal, False otherwise.

iter:

a Gtk.TextIter.

Return type:

(bool, iter: Gtk.TextIter)

Get the Gtk.TextIter at which the completion for proposal starts. When implemented, this information is used to position the completion window accordingly when a proposal is selected in the completion window. The proposal text inside the completion window is aligned on iter.

If this function is not implemented, the word boundary is taken to position the completion window. See GtkSource.CompletionProvider.activate_proposal() for an explanation on the word boundaries.

When the proposal is activated, the default handler uses iter as the start of the word to replace. See GtkSource.CompletionProvider.activate_proposal() for more information.

do_match(context) virtual
Parameters:

context (GtkSource.CompletionContext) – a GtkSource.CompletionContext.

Returns:

True if provider matches the completion context, False otherwise.

Return type:

bool

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

do_populate(context) virtual
Parameters:

context (GtkSource.CompletionContext) – a GtkSource.CompletionContext.

Populate context with proposals from provider added with the GtkSource.CompletionContext.add_proposals() function.

do_update_info(proposal, info) virtual
Parameters:

Update extra information shown in info for proposal.

This function must be implemented when GtkSource.CompletionProvider.get_info_widget() is implemented.