CompletionContext
Superclasses: Object
Implemented Interfaces: ListModel
- Constructors:
CompletionContext(**properties)
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
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() Buffer | None
Gets the underlying buffer used by the context.
This is a convenience function to get the buffer via the
Completion
property.
- get_busy() bool
Gets the “busy” property. This is set to
True
while the completion context is actively fetching proposals from registeredCompletionProvider
’s.
- get_completion() Completion | None
Gets the
Completion
that created the context.
- get_empty() bool
Checks if any proposals have been provided to the context.
Out of convenience, this function will return
True
ifself
isNone
.
- get_proposals_for_provider(provider: CompletionProvider) ListModel | None
Gets the
ListModel
associated 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
CompletionProvider
results – a
ListModel
orNone
Properties
- class CompletionContext
- props.busy: bool
The “busy” property is
True
while the completion context is populating completion proposals.
- props.completion: Completion
The “completion” is the
Completion
that was used to create the context.
Signals
- class CompletionContext.signals
- provider_model_changed(provider: CompletionProvider, model: ListModel | None = None) None
Emitted when a provider changes a model.
This signal is primarily useful for
CompletionProvider
’s that want to track other providers in context. For example, it can be used to create a “top results” provider.Added in version 5.6.
- Parameters:
provider – a
CompletionProvider
model – a
ListModel