GtkSource.SnippetManager¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
[ |
r/w/en |
List of directories with snippet definitions (*.snippets) |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class GtkSource.SnippetManager(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Provides access to [class`Snippet`].
GtkSourceSnippetManager
is an object which processes snippet description files and creates [class`Snippet`] objects.Use [func`SnippetManager`.get_default] to retrieve the default instance of
GtkSourceSnippetManager
.Use [method`SnippetManager`.get_snippet] to retrieve snippets for a given snippets.
- classmethod get_default()¶
- Returns:
a
GtkSource.SnippetManager
which is owned byGtkSource.View
library and must not be unref’d.- Return type:
Returns the default
GtkSource.SnippetManager
instance.
- get_search_path()¶
- Returns:
None
-terminated array containing a list of snippet files directories. The array is owned by lm and must not be modified.- Return type:
[
str
]
Gets the list directories where self looks for snippet files.
- get_snippet(group, language_id, trigger)¶
- Parameters:
- Returns:
a
GtkSource.Snippet
orNone
if no matching snippet was found.- Return type:
Queries the known snippets for the first matching group, language_id, and/or trigger.
If group or language_id are
None
, they will be ignored.
- list_all()¶
- Returns:
a [iface`Gio`.ListModel] of [class`GtkSource`.Snippet]
- Return type:
Gets a [iface`Gio`.ListModel] of all snippets.
This can be used to get an unfiltered list of all of the snippets known to the snippet manager.
New in version 5.6.
- list_groups()¶
-
List all the known groups within the snippet manager.
The result should be freed with
GLib.free
(), and the individual strings are owned by self and should never be freed by the caller.
- list_matching(group, language_id, trigger_prefix)¶
- Parameters:
- Returns:
- Return type:
Queries the known snippets for those matching group, language_id, and/or trigger_prefix.
If any of these are
None
, they will be ignored when filtering the available snippets.The [iface`Gio`.ListModel] only contains information about the available snippets until [method`Gio`.ListModel.get_item] is called for a specific snippet. This helps reduce the number of [class`GObject`.Object]’s that are created at runtime to those needed by the calling application.
- set_search_path(dirs)¶
-
Sets the list of directories in which the
GtkSourceSnippetManager
looks for snippet files.If dirs is
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.