CompletionContext#
Superclasses: Object
Implemented Interfaces: ListModel
The context of a completion.
GtkSourceCompletionContext contains information about an attept to display
completion proposals to the user based on typed text in the View.
When typing, Completion may use registered
CompletionProvider to determine if there may be results which
could be displayed. If so, a GtkSourceCompletionContext is created with
information that is provided to the CompletionProvider to populate
results which might be useful to the user.
CompletionProvider are expected to provide ListModel with
CompletionProposal which may be joined together in a list of
results for the user. They are also responsible for how the contents are
displayed using CompletionCell which allows for some level of
customization.
Methods#
- class CompletionContext
- get_activation() CompletionActivation#
Gets the mode for which the context was activated.
- get_bounds() tuple[bool, TextIter, TextIter]#
Gets the bounds for the completion, which is the beginning of the current word (taking break characters into account) to the current insertion cursor.
If
beginis non-None, it will be set to the start position of the current word being completed.If
endis non-None, it will be set to the insertion cursor for the current word being completed.
- get_buffer() Buffer | None#
Gets the underlying buffer used by the context.
This is a convenience function to get the buffer via the
Completionproperty.
- get_busy() bool#
Gets the “busy” property. This is set to
Truewhile the completion context is actively fetching proposals from registeredCompletionProvider's.
- get_completion() Completion | None#
Gets the
Completionthat created the context.
- get_empty() bool#
Checks if any proposals have been provided to the context.
Out of convenience, this function will return
TrueifselfisNone.
- get_proposals_for_provider(provider: CompletionProvider) ListModel | None#
Gets the
ListModelassociated with the provider.You can connect to
CompletionContext::model-changed to receive notifications about when the model has been replaced by a new model.Added in version 5.6.
- Parameters:
provider – a
CompletionProvider
- list_providers() ListModel#
Gets the providers that are associated with the context.
Added in version 5.6.
- set_proposals_for_provider(provider: CompletionProvider, results: ListModel | None = None) None#
This function allows providers to update their results for a context outside of a call to
populate_async.This can be used to immediately return results for a provider while it does additional asynchronous work. Doing so will allow the completions to update while the operation is in progress.
- Parameters:
provider – an
CompletionProviderresults – a
ListModelorNone
Properties#
Signals#
- class CompletionContext.signals
- provider_model_changed(provider: CompletionProvider, model: ListModel | None = None) None#
The type of the None singleton.
Added in version 5.6.
- Parameters:
provider – a
CompletionProvidermodel – a
ListModel