:right-sidebar: True Completion =================================================================== .. currentmodule:: gi.repository.GtkSource .. class:: Completion(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` :Constructors: :: Completion(**properties) Methods ------- .. rst-class:: interim-class .. class:: Completion :no-index: .. method:: add_provider(provider: ~gi.repository.GtkSource.CompletionProvider) -> None Adds a :obj:`~gi.repository.GtkSource.CompletionProvider` to the list of providers to be queried for completion results. :param provider: a :obj:`~gi.repository.GtkSource.CompletionProvider` .. method:: block_interactive() -> None .. method:: fuzzy_highlight(haystack: str, casefold_query: str) -> ~gi.repository.Pango.AttrList | None This will add ```` tags around matched characters in ``haystack`` based on ``casefold_query``. :param haystack: the string to be highlighted :param casefold_query: the typed-text used to highlight ``haystack`` .. method:: fuzzy_match(haystack: str | None, casefold_needle: str) -> tuple[bool, int] This helper function can do a fuzzy match for you giving a haystack and casefolded needle. Casefold your needle using :obj:`~gi.repository.GLib.utf8_casefold` before running the query. Score will be set with the score of the match upon success. Otherwise, it will be set to zero. :param haystack: the string to be searched. :param casefold_needle: A :func:`~gi.repository.GLib.utf8_casefold` version of the needle. .. method:: get_buffer() -> ~gi.repository.GtkSource.Buffer Gets the connected :obj:`~gi.repository.GtkSource.View`'s :obj:`~gi.repository.GtkSource.Buffer` .. method:: get_page_size() -> int .. method:: get_view() -> ~gi.repository.GtkSource.View Gets the :obj:`~gi.repository.GtkSource.View` that owns the :obj:`~gi.repository.GtkSource.Completion`. .. method:: hide() -> None Emits the "hide" signal. When the "hide" signal is emitted, the completion window will be dismissed. .. method:: remove_provider(provider: ~gi.repository.GtkSource.CompletionProvider) -> None Removes a :obj:`~gi.repository.GtkSource.CompletionProvider` previously added with :obj:`~gi.repository.Completion.add_provider`. :param provider: a :obj:`~gi.repository.GtkSource.CompletionProvider` .. method:: set_page_size(page_size: int) -> None :param page_size: .. method:: show() -> None Emits the "show" signal. When the "show" signal is emitted, the completion window will be displayed if there are any results available. .. method:: unblock_interactive() -> None Properties ---------- .. rst-class:: interim-class .. class:: Completion :no-index: .. attribute:: props.buffer :type: ~gi.repository.Gtk.TextView The :obj:`~gi.repository.Gtk.TextBuffer` for the :obj:`~gi.repository.GtkSource.Completion`:view. This is a convenience property for providers. .. attribute:: props.page_size :type: int The number of rows to display to the user before scrolling. .. attribute:: props.remember_info_visibility :type: bool Determines whether the visibility of the info window should be saved when the completion is hidden, and restored when the completion is shown again. .. attribute:: props.select_on_show :type: bool Determines whether the first proposal should be selected when the completion is first shown. .. attribute:: props.show_icons :type: bool The "show-icons" property denotes if icons should be displayed within the list of completions presented to the user. .. attribute:: props.view :type: ~gi.repository.GtkSource.View The "view" property is the :obj:`~gi.repository.Gtk.TextView` for which this :obj:`~gi.repository.GtkSource.Completion` is providing completion features. Signals ------- .. rst-class:: interim-class .. class:: Completion.signals :no-index: .. method:: hide() -> None The "hide" signal is emitted when the completion window should be hidden. .. method:: provider_added(provider: ~gi.repository.GtkSource.CompletionProvider) -> None The "provided-added" signal is emitted when a new provider is added to the completion. :param provider: a :obj:`~gi.repository.GtkSource.CompletionProvider` .. method:: provider_removed(provider: ~gi.repository.GtkSource.CompletionProvider) -> None The "provided-removed" signal is emitted when a provider has been removed from the completion. :param provider: a :obj:`~gi.repository.GtkSource.CompletionProvider` .. method:: show() -> None The "show" signal is emitted when the completion window should be shown.