:right-sidebar: True Completion =================================================================== .. currentmodule:: gi.repository.GtkSource .. class:: Completion(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Main Completion Object. The completion system helps the user when they writes some text, such as words, command names, functions, and suchlike. Proposals can be shown, to complete the text the user is writing. Each proposal can contain an additional piece of information (for example documentation), that is displayed when the "Details" button is clicked. Proposals are created via a :obj:`~gi.repository.GtkSource.CompletionProvider`\. There can be for example a provider to complete words (see :obj:`~gi.repository.GtkSource.CompletionWords`\), another provider for the completion of function names, etc. To add a provider, call :obj:`~gi.repository.Completion.add_provider`\. The :obj:`~gi.repository.GtkSource.CompletionProposal` interface represents a proposal. If a proposal contains extra information (see :const:`~gi.repository.GtkSource.CompletionColumn.DETAILS`), it will be displayed in a supplemental details window, which appears when the "Details" button is clicked. Each :obj:`~gi.repository.GtkSource.View` object is associated with a :obj:`~gi.repository.GtkSource.Completion` instance. This instance can be obtained with :obj:`~gi.repository.View.get_completion`\. The :obj:`~gi.repository.GtkSource.View` class contains also the :obj:`~gi.repository.GtkSource.View.signals.show_completion` signal. A same :obj:`~gi.repository.GtkSource.CompletionProvider` object can be used for several ``GtkSourceCompletion``\'s. 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 .. classmethod:: fuzzy_highlight(casefold_query: str) -> ~gi.repository.Pango.AttrList | None This will add ```` tags around matched characters in ``haystack`` based on ``casefold_query``\. :param casefold_query: the typed-text used to highlight ``haystack`` .. classmethod:: fuzzy_match(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 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 type of the None singleton. .. attribute:: props.page_size :type: int The type of the None singleton. .. attribute:: props.remember_info_visibility :type: bool The type of the None singleton. .. attribute:: props.select_on_show :type: bool The type of the None singleton. .. attribute:: props.show_icons :type: bool The type of the None singleton. .. attribute:: props.view :type: ~gi.repository.GtkSource.View The type of the None singleton. 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 type of the None singleton. :param provider: a :obj:`~gi.repository.GtkSource.CompletionProvider` .. method:: provider_removed(provider: ~gi.repository.GtkSource.CompletionProvider) -> None The type of the None singleton. :param provider: a :obj:`~gi.repository.GtkSource.CompletionProvider` .. method:: show() -> None The "show" signal is emitted when the completion window should be shown.