IdeSnippet

IdeSnippet — A snippet to be inserted into a file

Functions

Properties

GtkTextBuffer * buffer Read
gchar * description Read / Write
gchar * language Read / Write
GtkTextMark * mark-begin Read
GtkTextMark * mark-end Read
gint tab-stop Read
gchar * trigger Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── IdeSnippet

Description

The IdeSnippet represents a single snippet that may be inserted into the IdeSourceView.

Functions

ide_snippet_new ()

IdeSnippet *
ide_snippet_new (const gchar *trigger,
                 const gchar *language);

Creates a new IdeSnippet

Parameters

trigger

the trigger word.

[nullable]

language

the source language.

[nullable]

Returns

A new IdeSnippet.

[transfer full]


ide_snippet_copy ()

IdeSnippet *
ide_snippet_copy (IdeSnippet *self);

Does a deep copy of the snippet.

Parameters

self

an IdeSnippet

 

Returns

An IdeSnippet.

[transfer full]


ide_snippet_get_trigger ()

const gchar *
ide_snippet_get_trigger (IdeSnippet *self);

Gets the trigger for the source snippet

Parameters

self

a IdeSnippet

 

Returns

A trigger if specified.

[nullable]


ide_snippet_set_trigger ()

void
ide_snippet_set_trigger (IdeSnippet *self,
                         const gchar *trigger);

Sets the trigger for the snippet.

Parameters

self

a IdeSnippet

 

trigger

the trigger word

 

ide_snippet_get_language ()

const gchar *
ide_snippet_get_language (IdeSnippet *self);

Gets the language used for the source snippet.

The language identifier matches the “id” property.

Parameters

self

a IdeSnippet

 

Returns

the language identifier


ide_snippet_set_language ()

void
ide_snippet_set_language (IdeSnippet *self,
                          const gchar *language);

Sets the language identifier for the snippet.

This should match the “id” identifier.

Parameters

self

a IdeSnippet

 

ide_snippet_get_description ()

const gchar *
ide_snippet_get_description (IdeSnippet *self);

Gets the description for the snippet.

Parameters

self

a IdeSnippet

 

ide_snippet_set_description ()

void
ide_snippet_set_description (IdeSnippet *self,
                             const gchar *description);

Sets the description for the snippet.

Parameters

self

a IdeSnippet

 

description

the snippet description

 

ide_snippet_add_chunk ()

void
ide_snippet_add_chunk (IdeSnippet *self,
                       IdeSnippetChunk *chunk);

ide_snippet_get_n_chunks ()

guint
ide_snippet_get_n_chunks (IdeSnippet *self);

Gets the number of chunks in the snippet. Not all chunks are editable.

Parameters

self

a IdeSnippet

 

Returns

The number of chunks.


ide_snippet_get_tab_stop ()

gint
ide_snippet_get_tab_stop (IdeSnippet *self);

Gets the current tab stop for the snippet. This is changed as the user Tab's through the edit points.

Parameters

self

a IdeSnippet

 

Returns

The tab stop, or -1 if unset.


ide_snippet_get_nth_chunk ()

IdeSnippetChunk *
ide_snippet_get_nth_chunk (IdeSnippet *self,
                           guint n);

Gets the chunk at n .

Parameters

self

an IdeSnippet

 

n

the nth chunk to get

 

Returns

an IdeSnippetChunk.

[transfer none]


ide_snippet_get_chunk_range ()

void
ide_snippet_get_chunk_range (IdeSnippet *self,
                             IdeSnippetChunk *chunk,
                             GtkTextIter *begin,
                             GtkTextIter *end);

ide_snippet_get_context ()

IdeSnippetContext *
ide_snippet_get_context (IdeSnippet *self);

Get's the context used for expanding the snippet.

Parameters

self

an IdeSnippet

 

Returns

an IdeSnippetContext.

[nullable][transfer none]

Types and Values

IDE_TYPE_SNIPPET

#define IDE_TYPE_SNIPPET (ide_snippet_get_type())

IdeSnippet

typedef struct _IdeSnippet IdeSnippet;

Property Details

The “buffer” property

  “buffer”                   GtkTextBuffer *

The GtkTextBuffer for the snippet.

Flags: Read


The “description” property

  “description”              gchar *

The description for the snippet.

Flags: Read / Write

Default value: NULL


The “language” property

  “language”                 gchar *

The language for the snippet.

Flags: Read / Write

Default value: NULL


The “mark-begin” property

  “mark-begin”               GtkTextMark *

The beginning text mark.

Flags: Read


The “mark-end” property

  “mark-end”                 GtkTextMark *

The ending text mark.

Flags: Read


The “tab-stop” property

  “tab-stop”                 gint

The current tab stop.

Flags: Read

Allowed values: >= -1

Default value: -1


The “trigger” property

  “trigger”                  gchar *

The trigger for the snippet.

Flags: Read / Write

Default value: NULL