ide-completion-context: Builder SDK Reference

## ide-completion-context ide-completion-context |

## Functions

IdeCompletionActivation | ide_completion_context_get_activation ()
const gchar * | ide_completion_context_get_language ()
gboolean | ide_completion_context_is_language ()
GtkTextBuffer * | ide_completion_context_get_buffer ()
GtkTextView * | ide_completion_context_get_view ()
gboolean | ide_completion_context_get_busy ()
gboolean | ide_completion_context_is_empty ()
void | ide_completion_context_set_proposals_for_provider ()
IdeCompletion * | ide_completion_context_get_completion ()
gboolean | ide_completion_context_get_bounds ()
gboolean | ide_completion_context_get_start_iter ()
gchar * | ide_completion_context_get_word ()
gchar * | ide_completion_context_get_line_text ()
gboolean | ide_completion_context_get_item_full ()

## Properties

gboolean | busy | Read
IdeCompletion * | completion | Read / Write / Construct Only
gboolean | empty | Read

## Types and Values

#define | IDE_TYPE_COMPLETION_CONTEXT
| IdeCompletionContext

## Object Hierarchy

        GObject
        ╰── IdeCompletionContext

## Implemented Interfaces

IdeCompletionContext implements GListModel.

## Description

## Functions

### ide_completion_context_get_activation ()

    IdeCompletionActivation
    ide_completion_context_get_activation (IdeCompletionContext *self);

Gets the mode for which the context was activated.

#### Parameters

self | a IdeCompletionContext |

Since: 3.32

### ide_completion_context_get_language ()

    const gchar *
    ide_completion_context_get_language (IdeCompletionContext *self);

Gets the language identifier which can be useful for providers that support multiple languages.

#### Parameters

self | a IdeCompletionContext |

#### Returns

a language identifier or `NULL`.

[nullable]

Since: 3.32

### ide_completion_context_is_language ()

    gboolean
    ide_completion_context_is_language (IdeCompletionContext *self,
                                        const gchar *language);

Helper to check the language of the underlying buffer.

#### Parameters

self | a IdeCompletionContext |

#### Returns

`TRUE` if `language` matches; otherwise `FALSE`.

Since: 3.32

### ide_completion_context_get_buffer ()

    GtkTextBuffer *
    ide_completion_context_get_buffer (IdeCompletionContext *self);

Gets the underlying buffer used by the context.

This is a convenience function to get the buffer via the IdeCompletion property.

#### Parameters

self | an IdeCompletionContext |

#### Returns

a GtkTextBuffer or `NULL`.

[transfer none][nullable]

Since: 3.32

### ide_completion_context_get_view ()

    GtkTextView *
    ide_completion_context_get_view (IdeCompletionContext *self);

Gets the text view for the context.

#### Parameters

self | a IdeCompletionContext |

#### Returns

a GtkTextView or `NULL`.

[nullable][transfer none]

Since: 3.32

### ide_completion_context_get_busy ()

    gboolean
    ide_completion_context_get_busy (IdeCompletionContext *self);

Gets the "busy" property. This is set to `TRUE` while the completion context is actively fetching proposals from the IdeCompletionProvider that were registered with `ide_completion_context_add_provider()`.

#### Returns

`TRUE` if the context is busy

Since: 3.32

### ide_completion_context_is_empty ()

    gboolean
    ide_completion_context_is_empty (IdeCompletionContext *self);

Checks if any proposals have been provided to the context.

Out of convenience, this function will return `TRUE` if `self` is `NULL`.

#### Parameters

self | a IdeCompletionContext |

#### Returns

`TRUE` if there are no proposals in the context

Since: 3.32

### ide_completion_context_set_proposals_for_provider ()

    void
    ide_completion_context_set_proposals_for_provider
                                   (IdeCompletionContext *self,
                                    IdeCompletionProvider *provider,
                                    GListModel *results);

This function allows providers to update their results for a context outside of a call to `ide_completion_provider_populate_async()`. This can be used to immediately return results for a provider while it does additional asynchronous work. Doing so will allow the completions to update while the operation is in progress.

#### Parameters

self | an IdeCompletionContext |
provider | an IdeCompletionProvider |
results | a GListModel or `NULL`. | [nullable]

Since: 3.32

### ide_completion_context_get_completion ()

    IdeCompletion *
    ide_completion_context_get_completion (IdeCompletionContext *self);

Gets the IdeCompletion that created the context.

#### Parameters

self | an IdeCompletionContext |

#### Returns

an IdeCompletion or `NULL`.

[transfer none][nullable]

Since: 3.32

### ide_completion_context_get_bounds ()

    gboolean
    ide_completion_context_get_bounds (IdeCompletionContext *self,
                                       GtkTextIter *begin,
                                       GtkTextIter *end);

Gets the bounds for the completion, which is the beginning of the current word (taking break characters into account) to the current insertion cursor.

If `begin` is non-`NULL`, it will be set to the start position of the current word being completed.

If `end` is non-`NULL`, it will be set to the insertion cursor for the current word being completed.

#### Parameters

self | an IdeCompletionContext |
begin | a GtkTextIter. | [out][optional]
end | a GtkTextIter. | [out][optional]

#### Returns

`TRUE` if the marks are still valid and `begin` or `end` was set.

Since: 3.32

### ide_completion_context_get_start_iter ()

    gboolean
    ide_completion_context_get_start_iter (IdeCompletionContext *self,
                                           GtkTextIter *iter);

Gets the iter for the start of the completion.

#### Parameters

self | a IdeCompletionContext |
iter | a location for a GtkTextIter. | [out]

Since: 3.32

### ide_completion_context_get_word ()

    gchar *
    ide_completion_context_get_word (IdeCompletionContext *self);

Gets the word that is being completed up to the position of the insert mark.

#### Parameters

self | a IdeCompletionContext |

#### Returns

a string containing the current word.

[transfer full]

Since: 3.32

### ide_completion_context_get_line_text ()

    gchar *
    ide_completion_context_get_line_text (IdeCompletionContext *self);

This is a convenience helper to get the line text up until the insertion cursor for the current completion.

#### Parameters

self | a IdeCompletionContext |

#### Returns

a newly allocated string

Since: 3.32

### ide_completion_context_get_item_full ()

    gboolean
    ide_completion_context_get_item_full (IdeCompletionContext *self,
                                          guint position,
                                          IdeCompletionProvider **provider,
                                          IdeCompletionProposal **proposal);

## Types and Values

### IDE_TYPE_COMPLETION_CONTEXT

    #define IDE_TYPE_COMPLETION_CONTEXT (ide_completion_context_get_type())

### IdeCompletionContext

    typedef struct _IdeCompletionContext IdeCompletionContext;

## Property Details

### The `“busy”` property

      “busy”                     gboolean

The "busy" property is `TRUE` while the completion context is populating completion proposals.

Flags: Read

Default value: FALSE

Since: 3.32

### The `“completion”` property

      “completion”               IdeCompletion *

The "completion" is the IdeCompletion that was used to create the context.

Flags: Read / Write / Construct Only

Since: 3.32

### The `“empty”` property

      “empty”                    gboolean

The "empty" property is `TRUE` when there are no results.

It will be notified when the first result is added or the last result is removed.

Flags: Read

Default value: TRUE

Since: 3.32