:right-sidebar: True SnippetManager =================================================================== .. currentmodule:: gi.repository.GtkSource .. class:: SnippetManager(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Provides access to :obj:`~gi.repository.GtkSource.Snippet`\. ``GtkSourceSnippetManager`` is an object which processes snippet description files and creates :obj:`~gi.repository.GtkSource.Snippet` objects. Use :obj:`~gi.repository.SnippetManager.get_default` to retrieve the default instance of ``GtkSourceSnippetManager``\. Use :obj:`~gi.repository.SnippetManager.get_snippet` to retrieve snippets for a given snippets. Methods ------- .. rst-class:: interim-class .. class:: SnippetManager :no-index: .. classmethod:: get_default() -> ~gi.repository.GtkSource.SnippetManager Returns the default :obj:`~gi.repository.GtkSource.SnippetManager` instance. .. method:: get_search_path() -> list[str] Gets the list directories where ``self`` looks for snippet files. .. method:: get_snippet(group: str | None, language_id: str | None, trigger: str) -> ~gi.repository.GtkSource.Snippet | None Queries the known snippets for the first matching ``group``\, ``language_id``\, and/or ``trigger``\. If ``group`` or ``language_id`` are :const:`None`, they will be ignored. :param group: a group name or :const:`None` :param language_id: a :obj:`~gi.repository.GtkSource.Language`\:id or :const:`None` :param trigger: the trigger for the snippet .. method:: list_all() -> ~gi.repository.Gio.ListModel Gets a :obj:`~gi.repository.Gio.ListModel` of all snippets. This can be used to get an unfiltered list of all of the snippets known to the snippet manager. .. versionadded:: 5.6 .. method:: list_groups() -> list[str] List all the known groups within the snippet manager. The result should be freed with :func:`~gi.repository.GLib.free`, and the individual strings are owned by ``self`` and should never be freed by the caller. .. method:: list_matching(group: str | None = None, language_id: str | None = None, trigger_prefix: str | None = None) -> ~gi.repository.Gio.ListModel Queries the known snippets for those matching ``group``\, ``language_id``\, and/or ``trigger_prefix``\. If any of these are :const:`None`, they will be ignored when filtering the available snippets. The :obj:`~gi.repository.Gio.ListModel` only contains information about the available snippets until :obj:`~gi.repository.Gio.ListModel.get_item` is called for a specific snippet. This helps reduce the number of :obj:`~gi.repository.GObject.Object`\'s that are created at runtime to those needed by the calling application. :param group: a group name or :const:`None` :param language_id: a :obj:`~gi.repository.GtkSource.Language`\:id or :const:`None` :param trigger_prefix: a prefix for a trigger to activate .. method:: set_search_path(dirs: list[str] | None = None) -> None Sets the list of directories in which the ``GtkSourceSnippetManager`` looks for snippet files. If ``dirs`` is :const:`None`, the search path is reset to default. At the moment this function can be called only before the snippet files are loaded for the first time. In practice to set a custom search path for a ``GtkSourceSnippetManager``\, you have to call this function right after creating it. :param dirs: a :const:`None`-terminated array of strings or :const:`None`. Properties ---------- .. rst-class:: interim-class .. class:: SnippetManager :no-index: .. attribute:: props.search_path :type: list[str] The type of the None singleton.