GtkSource.CompletionContext¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r |
Is the completion context busy populating |
||
r/w/co |
Completion |
||
r |
If the context has no results |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
Emitted when a provider changes a model. |
Fields¶
- Inherited:
Class Details¶
- class GtkSource.CompletionContext(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
The context of a completion.
GtkSourceCompletionContextcontains information about an attept to display completion proposals to the user based on typed text in the [class`View`].When typing, [class`Completion`] may use registered [iface`CompletionProvider`] to determine if there may be results which could be displayed. If so, a
GtkSourceCompletionContextis created with information that is provided to the [iface`CompletionProvider`] to populate results which might be useful to the user.[iface`CompletionProvider`] are expected to provide [iface`Gio`.ListModel] with [iface`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 [class`CompletionCell`] which allows for some level of customization.
- get_activation()¶
- Return type:
Gets the mode for which the context was activated.
- get_bounds()¶
- Returns:
Trueif the marks are still valid and begin or end was set.- begin:
- end:
- Return type:
(
bool, begin:Gtk.TextIter, end:Gtk.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 begin is non-
None, it will be set to the start position of the current word being completed.If end is non-
None, it will be set to the insertion cursor for the current word being completed.
- get_buffer()¶
- Returns:
a
Gtk.TextBufferorNone- Return type:
Gets the underlying buffer used by the context.
This is a convenience function to get the buffer via the
GtkSource.Completionproperty.
- get_busy()¶
-
Gets the “busy” property. This is set to
Truewhile the completion context is actively fetching proposals from registeredGtkSource.CompletionProvider's.
- get_completion()¶
- Returns:
an
GtkSource.CompletionorNone- Return type:
Gets the
GtkSource.Completionthat created the context.
- get_empty()¶
-
Checks if any proposals have been provided to the context.
Out of convenience, this function will return
Trueif self isNone.
- get_language()¶
- Returns:
a
GtkSource.LanguageorNone- Return type:
Gets the language of the underlying buffer, if any.
- get_proposals_for_provider(provider)¶
- Parameters:
provider (
GtkSource.CompletionProvider) – aGtkSource.CompletionProvider- Returns:
a
Gio.ListModelorNone- Return type:
Gets the
Gio.ListModelassociated with the provider.You can connect to
GtkSource.CompletionContext::model-changedto receive notifications about when the model has been replaced by a new model.New in version 5.6.
- get_view()¶
- Returns:
a
GtkSource.VieworNone- Return type:
Gets the text view for the context.
- get_word()¶
- Returns:
a string containing the current word
- Return type:
Gets the word that is being completed up to the position of the insert mark.
- list_providers()¶
- Returns:
- Return type:
Gets the providers that are associated with the context.
New in version 5.6.
- set_proposals_for_provider(provider, results)¶
- Parameters:
provider (
GtkSource.CompletionProvider) – anGtkSource.CompletionProviderresults (
Gio.ListModelorNone) – aGio.ListModelorNone
This function allows providers to update their results for a context outside of a call to [method`CompletionProvider`.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.
Signal Details¶
- GtkSource.CompletionContext.signals.provider_model_changed(completion_context, provider, model)¶
- Signal Name:
provider-model-changed- Flags:
- Parameters:
completion_context (
GtkSource.CompletionContext) – The object which received the signalprovider (
GtkSource.CompletionProvider) – aGtkSource.CompletionProvidermodel (
Gio.ListModelorNone) – aGio.ListModel
Emitted when a provider changes a model.
This signal is primarily useful for
GtkSource.CompletionProvider's that want to track other providers in context. For example, it can be used to create a “top results” provider.New in version 5.6.
Property Details¶
- GtkSource.CompletionContext.props.busy¶
-
The “busy” property is
Truewhile the completion context is populating completion proposals.
- GtkSource.CompletionContext.props.completion¶
- Name:
completion- Type:
- Default Value:
- Flags:
The “completion” is the
GtkSource.Completionthat was used to create the context.