IdeSnippetStorage

IdeSnippetStorage — storage and loading of snippets

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── IdeSnippetStorage

Description

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.

Functions

IdeSnippetStorageForeach ()

void
(*IdeSnippetStorageForeach) (IdeSnippetStorage *self,
                             const IdeSnippetInfo *info,
                             gpointer user_data);

ide_snippet_storage_new ()

IdeSnippetStorage *
ide_snippet_storage_new (void);

ide_snippet_storage_add ()

void
ide_snippet_storage_add (IdeSnippetStorage *self,
                         const gchar *default_scope,
                         GBytes *bytes);

ide_snippet_storage_foreach ()

void
ide_snippet_storage_foreach (IdeSnippetStorage *self,
                             IdeSnippetStorageForeach foreach,
                             gpointer user_data);

This will call foreach for every item that has been loaded.

Parameters

self

a IdeSnippetStorage

 

foreach

the closure to call for each info.

[scope call]

user_data

closure data for foreach

 

Since: 3.30


ide_snippet_storage_query ()

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.

Parameters

self

a IdeSnippetStorage

 

lang

language to query

 

prefix

prefix for query.

[nullable]

foreach

the closure to call for each match.

[scope call]

user_data

closure data for foreach

 

Since: 3.30


ide_snippet_storage_load_async ()

void
ide_snippet_storage_load_async (IdeSnippetStorage *self,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

ide_snippet_storage_load_finish ()

gboolean
ide_snippet_storage_load_finish (IdeSnippetStorage *self,
                                 GAsyncResult *result,
                                 GError **error);

Types and Values

IDE_TYPE_SNIPPET_STORAGE

#define IDE_TYPE_SNIPPET_STORAGE (ide_snippet_storage_get_type())

IdeSnippetStorage

typedef struct _IdeSnippetStorage IdeSnippetStorage;