:right-sidebar: True CompletionContext =================================================================== .. currentmodule:: gi.repository.GtkSource .. class:: CompletionContext(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gio.ListModel` :Constructors: :: CompletionContext(**properties) Methods ------- .. rst-class:: interim-class .. class:: CompletionContext :no-index: .. method:: get_activation() -> ~gi.repository.GtkSource.CompletionActivation Gets the mode for which the context was activated. .. method:: get_bounds() -> tuple[bool, ~gi.repository.Gtk.TextIter, ~gi.repository.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-:const:`None`, it will be set to the start position of the current word being completed. If ``end`` is non-:const:`None`, it will be set to the insertion cursor for the current word being completed. .. method:: get_buffer() -> ~gi.repository.GtkSource.Buffer | None Gets the underlying buffer used by the context. This is a convenience function to get the buffer via the :obj:`~gi.repository.GtkSource.Completion` property. .. method:: get_busy() -> bool Gets the "busy" property. This is set to :const:`True` while the completion context is actively fetching proposals from registered :obj:`~gi.repository.GtkSource.CompletionProvider`'s. .. method:: get_completion() -> ~gi.repository.GtkSource.Completion | None Gets the :obj:`~gi.repository.GtkSource.Completion` that created the context. .. method:: get_empty() -> bool Checks if any proposals have been provided to the context. Out of convenience, this function will return :const:`True` if ``self`` is :const:`None`. .. method:: get_language() -> ~gi.repository.GtkSource.Language | None Gets the language of the underlying buffer, if any. .. method:: get_proposals_for_provider(provider: ~gi.repository.GtkSource.CompletionProvider) -> ~gi.repository.Gio.ListModel | None Gets the :obj:`~gi.repository.Gio.ListModel` associated with the provider. You can connect to :obj:`~gi.repository.GtkSource.CompletionContext`::model-changed to receive notifications about when the model has been replaced by a new model. .. versionadded:: 5.6 :param provider: a :obj:`~gi.repository.GtkSource.CompletionProvider` .. method:: get_view() -> ~gi.repository.GtkSource.View | None Gets the text view for the context. .. method:: get_word() -> str Gets the word that is being completed up to the position of the insert mark. .. method:: list_providers() -> ~gi.repository.Gio.ListModel Gets the providers that are associated with the context. .. versionadded:: 5.6 .. method:: set_proposals_for_provider(provider: ~gi.repository.GtkSource.CompletionProvider, results: ~gi.repository.Gio.ListModel | None = None) -> None This function allows providers to update their results for a context outside of a call to :obj:`~gi.repository.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. :param provider: an :obj:`~gi.repository.GtkSource.CompletionProvider` :param results: a :obj:`~gi.repository.Gio.ListModel` or :const:`None` Properties ---------- .. rst-class:: interim-class .. class:: CompletionContext :no-index: .. attribute:: props.busy :type: bool The "busy" property is :const:`True` while the completion context is populating completion proposals. .. attribute:: props.completion :type: ~gi.repository.GtkSource.Completion The "completion" is the :obj:`~gi.repository.GtkSource.Completion` that was used to create the context. .. attribute:: props.empty :type: bool The "empty" property is :const:`True` when there are no results. It will be notified when the first result is added or the last result is removed. Signals ------- .. rst-class:: interim-class .. class:: CompletionContext.signals :no-index: .. method:: provider_model_changed(provider: ~gi.repository.GtkSource.CompletionProvider, model: ~gi.repository.Gio.ListModel | None = None) -> None Emitted when a provider changes a model. This signal is primarily useful for :obj:`~gi.repository.GtkSource.CompletionProvider`'s that want to track other providers in context. For example, it can be used to create a "top results" provider. .. versionadded:: 5.6 :param provider: a :obj:`~gi.repository.GtkSource.CompletionProvider` :param model: a :obj:`~gi.repository.Gio.ListModel`