Top | ![]() |
![]() |
![]() |
![]() |
void | (*IdeSnippetStorageForeach) () |
IdeSnippetStorage * | ide_snippet_storage_new () |
void | ide_snippet_storage_add () |
void | ide_snippet_storage_foreach () |
void | ide_snippet_storage_query () |
void | ide_snippet_storage_load_async () |
gboolean | ide_snippet_storage_load_finish () |
The IdeSnippetStorage object manages parsing snippet files from disk. To avoid creating lots of small allocations, it delays parsing of snippets fully until necessary.
To do this, mapped files are used and just enough information is extracted to describe the snippets. Then snippets are inflated and fully parsed when requested.
In doing so, we can use GStringChunk for the meta-data, and then only create all the small strings when we inflate the snippet and its chunks.
void (*IdeSnippetStorageForeach) (IdeSnippetStorage *self
,const IdeSnippetInfo *info
,gpointer user_data
);
void ide_snippet_storage_add (IdeSnippetStorage *self
,const gchar *default_scope
,GBytes *bytes
);
void ide_snippet_storage_foreach (IdeSnippetStorage *self
,IdeSnippetStorageForeach foreach
,gpointer user_data
);
This will call foreach
for every item that has been loaded.
self |
||
foreach |
the closure to call for each info. |
[scope call] |
user_data |
closure data for |
Since: 3.30
void ide_snippet_storage_query (IdeSnippetStorage *self
,const gchar *lang
,const gchar *prefix
,IdeSnippetStorageForeach foreach
,gpointer user_data
);
This will call foreach
for every info that matches the query. This is
useful when building autocompletion lists based on word prefixes.
self |
||
lang |
language to query |
|
prefix |
prefix for query. |
[nullable] |
foreach |
the closure to call for each match. |
[scope call] |
user_data |
closure data for |
Since: 3.30
void ide_snippet_storage_load_async (IdeSnippetStorage *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
gboolean ide_snippet_storage_load_finish (IdeSnippetStorage *self
,GAsyncResult *result
,GError **error
);