## IdeSnippetStorage IdeSnippetStorage — storage and loading of snippets |

## Functions

void | (*IdeSnippetStorageForeach) ()
IdeSnippetStorage * | ide_snippet_storage_from_context ()
IdeSnippetStorage * | ide_snippet_storage_new ()
void | ide_snippet_storage_add ()
void | ide_snippet_storage_foreach ()
void | ide_snippet_storage_query ()

## Types and Values

#define | IDE_TYPE_SNIPPET_STORAGE
| IdeSnippetStorage

## Object Hierarchy

        GObject
        ╰── IdeObject
            ╰── IdeSnippetStorage

## Implemented Interfaces

IdeSnippetStorage implements GAsyncInitable.

## 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_from_context ()

    IdeSnippetStorage *
    ide_snippet_storage_from_context (IdeContext *context);

Gets the snippet storage for the context.

#### Parameters

context | an IdeContext |

#### Returns

an IdeSnippetStorage.

[transfer none]

Since: 3.32

### 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.32

### 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.32

## Types and Values

### IDE_TYPE_SNIPPET_STORAGE

    #define IDE_TYPE_SNIPPET_STORAGE (ide_snippet_storage_get_type())

### IdeSnippetStorage

    typedef struct _IdeSnippetStorage IdeSnippetStorage;